bug 7544: check for null host before getting its status

status 7544: resolved fixed
This commit is contained in:
kishan 2011-01-03 14:26:35 +05:30
parent 02ae55cc96
commit bf2b28a70f
1 changed files with 4 additions and 0 deletions

View File

@ -1590,6 +1590,10 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
public Answer easySend(final Long hostId, final Command cmd, int timeout) {
try {
Host h = _hostDao.findById(hostId);
if (h == null || h.getRemoved() != null) {
s_logger.debug("Host with id " + hostId.toString() + " doesn't exist");
return null;
}
Status status = h.getStatus();
if( !status.equals(Status.Up) && !status.equals(Status.Connecting) ){
return null;