Skip to content

Commit 07c4aec

Browse files
author
Kelven Yang
committed
Newly added VR monitoring service has broken VMware basic network mode.
1 parent c6195c3 commit 07c4aec

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,12 +2210,12 @@ public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile prof
22102210

22112211
finalizeUserDataAndDhcpOnStart(cmds, router, provider, guestNetworkId);
22122212
}
2213-
finalizeMonitorServiceOnStrat(cmds, router, provider, routerGuestNtwkIds.get(0));
2213+
finalizeMonitorServiceOnStrat(cmds, profile, router, provider, routerGuestNtwkIds.get(0));
22142214

22152215
return true;
22162216
}
22172217

2218-
private void finalizeMonitorServiceOnStrat(Commands cmds, DomainRouterVO router, Provider provider, long networkId) {
2218+
private void finalizeMonitorServiceOnStrat(Commands cmds, VirtualMachineProfile profile, DomainRouterVO router, Provider provider, long networkId) {
22192219

22202220
NetworkVO network = _networkDao.findById(networkId);
22212221

@@ -2248,18 +2248,18 @@ private void finalizeMonitorServiceOnStrat(Commands cmds, DomainRouterVO router,
22482248
servicesTO.add(serviceTO);
22492249
}
22502250

2251+
// TODO : This is a hacking fix
2252+
// at VR startup time, information in VirtualMachineProfile may not updated to DB yet,
2253+
// getRouterControlIp() may give wrong IP under basic network mode in VMware environment
2254+
NicProfile controlNic = getControlNic(profile);
22512255
SetMonitorServiceCommand command = new SetMonitorServiceCommand(servicesTO);
2252-
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
2256+
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlNic.getIp4Address());
22532257
command.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(networkId, router.getId()));
22542258
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
22552259

22562260
cmds.addCommand("monitor", command);
22572261
}
22582262

2259-
2260-
2261-
2262-
22632263
protected NicProfile getControlNic(VirtualMachineProfile profile) {
22642264
DomainRouterVO router = _routerDao.findById(profile.getId());
22652265
DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());

0 commit comments

Comments
 (0)