bug 11122: Fix router startup

The new created router got hostId = 0.

status 11122: resolved fixed

Conflicts:

	server/src/com/cloud/network/element/VirtualRouterElement.java
This commit is contained in:
Sheng Yang 2011-08-13 00:21:35 -07:00
parent fbd9e2159d
commit bb6c2d48f5
2 changed files with 11 additions and 2 deletions

View File

@ -121,6 +121,9 @@ public class VirtualRouterElement extends DhcpElement implements NetworkElement,
NetworkOffering offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
List<DomainRouterVO> routers = _routerMgr.deployVirtualRouter(network, dest, _accountMgr.getAccount(network.getAccountId()), uservm.getParameters(), offering.getRedundantRouter());
if ((routers == null) || (routers.size() == 0)) {
throw new ResourceUnavailableException("Can't find at least one running router!", this.getClass(), 0);
}
List<VirtualRouter> rets = _routerMgr.addVirtualMachineIntoNetwork(network, nic, uservm, dest, context, routers);
return (rets != null) && (!rets.isEmpty());

View File

@ -1048,8 +1048,14 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
for (DomainRouterVO router : routers) {
HostVO host = _hostDao.findById(router.getHostId());
if (host != null && host.getStatus() == Status.Up) {
boolean skip = false;
if (router.getHostId() != null) {
HostVO host = _hostDao.findById(router.getHostId());
if (host == null || host.getStatus() != Status.Up) {
skip = true;
}
}
if (!skip) {
State state = router.getState();
if (state != State.Running) {
router = startVirtualRouter(router, _accountService.getSystemUser(), _accountService.getSystemAccount(), params);