only send command to host which is UP

This commit is contained in:
anthony 2010-10-13 18:13:20 -07:00
parent d33ca58320
commit 2ffab4fe29
2 changed files with 9 additions and 1 deletions

View File

@ -1160,6 +1160,10 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
@Override
public Answer easySend(final Long hostId, final Command cmd, int timeout) {
try {
Host h = _hostDao.findById(hostId);
if( !h.getStatus().equals(Status.Up) ) {
return null;
}
final Answer answer = send(hostId, cmd, timeout);
if (answer == null) {
s_logger.warn("send returns null answer");

View File

@ -35,6 +35,7 @@ import com.cloud.dc.HostPodVO;
import com.cloud.host.DetailVO;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.host.Host.Type;
import com.cloud.host.dao.DetailsDao;
import com.cloud.host.dao.HostDao;
@ -97,7 +98,10 @@ public class FirstFitAllocator implements HostAllocator {
List<StoragePoolHostVO> poolhosts = _storagePoolHostDao.listByPoolId(sp.getId());
List<HostVO> hosts = new ArrayList<HostVO>();
for( StoragePoolHostVO poolhost : poolhosts ){
hosts.add(_hostDao.findById(poolhost.getHostId()));
HostVO h = _hostDao.findById(poolhost.getHostId());
if( h != null && h.getType().equals(Type.Routing) && h.getStatus().equals(Status.Up)) {
hosts.add(h);
}
}
long podId = pod.getId();