relax the host/VM relationship check, IPAssoc command may be sent to a wrong host when domR is taken over from other host

This commit is contained in:
Kelven Yang 2012-01-25 14:19:41 -08:00
parent 5e5579a210
commit ff5153f2e8
1 changed files with 11 additions and 0 deletions

View File

@ -867,6 +867,17 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
String controlIp = VmwareResource.getRouterSshControlIp(cmd);
VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(routerName);
// command may sometimes be redirect to a wrong host, we relax
// the check and will try to find it within cluster
if(vmMo == null) {
if(hyperHost instanceof HostMO) {
ClusterMO clusterMo = new ClusterMO(hyperHost.getContext(),
((HostMO)hyperHost).getParentMor());
vmMo = clusterMo.findVmOnHyperHost(routerName);
}
}
if (vmMo == null) {
String msg = "Router " + routerName + " no longer exists to execute IPAssoc command";
s_logger.error(msg);