From ff5153f2e8bb7ca94758cf5116580886b77f618d Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Wed, 25 Jan 2012 14:19:41 -0800 Subject: [PATCH] relax the host/VM relationship check, IPAssoc command may be sent to a wrong host when domR is taken over from other host --- .../hypervisor/vmware/resource/VmwareResource.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index adbf50f8d80..8c8850e607f 100755 --- a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -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);