From 367db2e45fcd6fd172cc3c060f621d81c2a6087a Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Tue, 12 Nov 2013 23:48:56 -0800 Subject: [PATCH] Newly added VR monitoring service has broken VMware basic network mode. --- .../router/VirtualNetworkApplianceManagerImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 3ba6cec453f..806e3afd171 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -2211,12 +2211,12 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V finalizeUserDataAndDhcpOnStart(cmds, router, provider, guestNetworkId); } - finalizeMonitorServiceOnStrat(cmds, router, provider, routerGuestNtwkIds.get(0)); + finalizeMonitorServiceOnStrat(cmds, profile, router, provider, routerGuestNtwkIds.get(0)); return true; } - private void finalizeMonitorServiceOnStrat(Commands cmds, DomainRouterVO router, Provider provider, long networkId) { + private void finalizeMonitorServiceOnStrat(Commands cmds, VirtualMachineProfile profile, DomainRouterVO router, Provider provider, long networkId) { NetworkVO network = _networkDao.findById(networkId); @@ -2249,18 +2249,18 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V servicesTO.add(serviceTO); } + // TODO : This is a hacking fix + // at VR startup time, information in VirtualMachineProfile may not updated to DB yet, + // getRouterControlIp() may give wrong IP under basic network mode in VMware environment + NicProfile controlNic = getControlNic(profile); SetMonitorServiceCommand command = new SetMonitorServiceCommand(servicesTO); - command.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId())); + command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlNic.getIp4Address()); command.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(networkId, router.getId())); command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName()); cmds.addCommand("monitor", command); } - - - - protected NicProfile getControlNic(VirtualMachineProfile profile) { DomainRouterVO router = _routerDao.findById(profile.getId()); DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());