mirror of https://github.com/apache/cloudstack.git
check the Answer correctly
This commit is contained in:
parent
deb87aa5e7
commit
255f1a7316
|
|
@ -956,7 +956,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||
Long dcId = host.getDataCenterId();
|
||||
ReadyCommand ready = new ReadyCommand(dcId);
|
||||
Answer answer = easySend(hostId, ready);
|
||||
if (answer == null) {
|
||||
if (answer == null || !answer.getResult()) {
|
||||
// this is tricky part for secondary storage
|
||||
// make it as disconnected, wait for secondary storage VM to be up
|
||||
// return the attache instead of null, even it is disconnectede
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu
|
|||
return -1;
|
||||
}
|
||||
GetVncPortAnswer answer = (GetVncPortAnswer)_agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getName()));
|
||||
return answer == null ? -1 : answer.getPort();
|
||||
return (answer == null || !answer.getResult()) ? -1 : answer.getPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -2069,7 +2069,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager,
|
|||
final RebootCommand cmd = new RebootCommand(proxy.getInstanceName());
|
||||
final Answer answer = _agentMgr.easySend(proxy.getHostId(), cmd);
|
||||
|
||||
if (answer != null) {
|
||||
if (answer != null && answer.getResult()) {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Successfully reboot console proxy "
|
||||
+ proxy.getName());
|
||||
|
|
@ -2328,7 +2328,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager,
|
|||
|
||||
MigrateCommand cmd = new MigrateCommand(proxy.getInstanceName(), host.getPrivateIpAddress(), false);
|
||||
Answer answer = _agentMgr.easySend(fromHost.getId(), cmd);
|
||||
if (answer == null) {
|
||||
if (answer == null || !answer.getResult()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||
ModifySshKeysCommand cmd = new ModifySshKeysCommand(pubKey, prvKey);
|
||||
final Answer answer = _agentMgr.easySend(hostId, cmd);
|
||||
|
||||
if (answer != null)
|
||||
if (answer != null && answer.getResult())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
|
@ -1268,7 +1268,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||
final RebootRouterCommand cmd = new RebootRouterCommand(router.getInstanceName(), router.getPrivateIpAddress());
|
||||
final RebootAnswer answer = (RebootAnswer)_agentMgr.easySend(router.getHostId(), cmd);
|
||||
|
||||
if (answer != null && resendRouterState(router)) {
|
||||
if (answer != null && answer.getResult() && resendRouterState(router)) {
|
||||
processStopOrRebootAnswer(router, answer);
|
||||
event.setDescription("successfully rebooted Domain Router : " + router.getName());
|
||||
_eventDao.persist(event);
|
||||
|
|
@ -2111,7 +2111,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||
boolean stopped = false;
|
||||
try {
|
||||
answer = _agentMgr.send(router.getHostId(), stop);
|
||||
if (!answer.getResult()) {
|
||||
if (answer == null || !answer.getResult()) {
|
||||
s_logger.error("Unable to stop router");
|
||||
} else {
|
||||
stopped = true;
|
||||
|
|
@ -2185,7 +2185,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||
boolean stopped = false;
|
||||
try {
|
||||
answer = _agentMgr.send(hostId, stop);
|
||||
if (!answer.getResult()) {
|
||||
if (answer == null || !answer.getResult()) {
|
||||
s_logger.error("Unable to stop router");
|
||||
event.setDescription("failed to stop Domain Router : " + router.getName());
|
||||
event.setLevel(EventVO.LEVEL_ERROR);
|
||||
|
|
@ -2286,7 +2286,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||
|
||||
final MigrateCommand cmd = new MigrateCommand(router.getInstanceName(), host.getPrivateIpAddress(), false);
|
||||
final Answer answer = _agentMgr.easySend(fromHost.getId(), cmd);
|
||||
if (answer == null) {
|
||||
if (answer == null || !answer.getResult()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2463,7 +2463,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||
_routerDao.update(router.getId(), router);
|
||||
final CreateZoneVlanCommand cmdCreateZoneVlan = new CreateZoneVlanCommand(router);
|
||||
CreateZoneVlanAnswer answer = (CreateZoneVlanAnswer) _agentMgr.easySend(router.getHostId(), cmdCreateZoneVlan);
|
||||
if(!answer.getResult()){
|
||||
if(answer == null || !answer.getResult()){
|
||||
s_logger.error("Unable to create zone vlan for router: "+router.getName()+ " zoneVlan: "+zoneVlan);
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6014,7 +6014,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
s_logger.trace("Trying to retrieve VNC port from agent about VM " + vm.getName());
|
||||
|
||||
GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getInstanceName()));
|
||||
int port = answer == null ? -1 : answer.getPort();
|
||||
int port = (answer == null || !answer.getResult()) ? -1 : answer.getPort();
|
||||
|
||||
if(s_logger.isTraceEnabled())
|
||||
s_logger.trace("Retrieved VNC port about VM " + vm.getName() + " is " + port);
|
||||
|
|
|
|||
|
|
@ -1334,11 +1334,9 @@ public class StorageManagerImpl implements StorageManager {
|
|||
DeleteStoragePoolCommand cmd = new DeleteStoragePoolCommand(sPool);
|
||||
final Answer answer = _agentMgr.easySend(host.getHostId(), cmd);
|
||||
|
||||
if (answer != null) {
|
||||
if (answer.getResult() == true) {
|
||||
deleteFlag = true;
|
||||
break;
|
||||
}
|
||||
if (answer != null && answer.getResult()) {
|
||||
deleteFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -568,7 +568,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
setupCmd.setCopyPassword(copyPasswd);
|
||||
setupCmd.setCopyUserName(TemplateConstants.DEFAULT_HTTP_AUTH_USER);
|
||||
Answer answer = _agentMgr.easySend(storageHost.getId(), setupCmd);
|
||||
if (answer != null) {
|
||||
if (answer != null && answer.getResult()) {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Successfully programmed http auth into " + secStorageVm.getName());
|
||||
return true;
|
||||
|
|
@ -609,7 +609,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
}
|
||||
}
|
||||
Answer answer = _agentMgr.easySend(storageHost.getId(), cpc);
|
||||
if (answer != null) {
|
||||
if (answer != null && answer.getResult()) {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Successfully programmed firewall rules into " + secStorageVm.getName());
|
||||
return true;
|
||||
|
|
@ -1499,7 +1499,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
final RebootCommand cmd = new RebootCommand(secStorageVm.getInstanceName());
|
||||
final Answer answer = _agentMgr.easySend(secStorageVm.getHostId(), cmd);
|
||||
|
||||
if (answer != null) {
|
||||
if (answer != null && answer.getResult()) {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Successfully reboot secondary storage vm " + secStorageVm.getName());
|
||||
|
||||
|
|
@ -1735,7 +1735,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
|
||||
MigrateCommand cmd = new MigrateCommand(secStorageVm.getInstanceName(), host.getPrivateIpAddress(), false);
|
||||
Answer answer = _agentMgr.easySend(fromHost.getId(), cmd);
|
||||
if (answer == null) {
|
||||
if (answer == null || !answer.getResult()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -534,7 +534,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||
|
||||
AttachIsoCommand cmd = new AttachIsoCommand(vmName, isoPath, attach);
|
||||
Answer a = _agentMgr.easySend(vm.getHostId(), cmd);
|
||||
return (a != null);
|
||||
return (a != null && a.getResult());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1012,7 +1012,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||
RebootCommand cmd = new RebootCommand(vm.getInstanceName());
|
||||
RebootAnswer answer = (RebootAnswer)_agentMgr.easySend(vm.getHostId(), cmd);
|
||||
|
||||
if (answer != null) {
|
||||
if (answer != null && answer.getResult()) {
|
||||
if(!vm.getName().equals(vm.getDisplayName()))
|
||||
event.setDescription("Successfully rebooted VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
|
||||
else
|
||||
|
|
@ -1815,7 +1815,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||
boolean stopped = false;
|
||||
try {
|
||||
Answer answer = _agentMgr.send(vm.getHostId(), stop);
|
||||
if (!answer.getResult()) {
|
||||
if (answer == null || !answer.getResult()) {
|
||||
s_logger.warn("Unable to stop vm " + vm.getName() + " due to " + answer.getDetails());
|
||||
} else {
|
||||
stopped = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue