From 602e6ce0fe2ec123fdac6c608d9e9157ce1e1579 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Wed, 25 Jan 2012 14:01:57 -0800 Subject: [PATCH] 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 --- .../hypervisor/vmware/resource/VmwareResource.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index e90940b333a..fbea4977419 100755 --- a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -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);