Relax the host/VM relationship tie check for IPAssoc command, as the command may be sent to a wrong host once host takes over domR from other host

This commit is contained in:
Kelven Yang 2012-01-25 14:01:57 -08:00
parent b0154aeb5c
commit 602e6ce0fe
1 changed files with 12 additions and 1 deletions

View File

@ -854,7 +854,18 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
String controlIp = VmwareResource.getRouterSshControlIp(cmd);
VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(routerName);
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);