bug 10453: fixed NPE in startRouter command - used to happen when domR start was called for existing domR as a part of networkImplement

status 10453: resolved fixed
This commit is contained in:
alena 2011-06-30 11:35:51 -07:00
parent ae665d4b11
commit b2942572e7
1 changed files with 7 additions and 7 deletions

View File

@ -685,11 +685,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
@DB
protected DomainRouterVO findOrCreateVirtualRouter(Network guestNetwork, DataCenterDeployment plan, HypervisorType type, Account owner) throws ConcurrentOperationException, InsufficientCapacityException {
DomainRouterVO router = _routerDao.findByNetwork(guestNetwork.getId());
if (router != null) {
return router;
}
protected DomainRouterVO createVirtualRouter(Network guestNetwork, DataCenterDeployment plan, HypervisorType type, Account owner) throws ConcurrentOperationException, InsufficientCapacityException {
/* Before starting router, already know the hypervisor type */
VMTemplateVO template = _templateDao.findRoutingTemplate(type);
@ -708,6 +704,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
throw new ConcurrentOperationException("Unable to acquire lock on " + guestNetwork.getId());
}
DomainRouterVO router = null;
try {
txn.start();
@ -780,8 +777,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
assert guestNetwork.getTrafficType() == TrafficType.Guest;
DataCenterDeployment plan = new DataCenterDeployment(dcId);
DomainRouterVO router = findOrCreateVirtualRouter(guestNetwork, plan, dest.getCluster().getHypervisorType(), owner);
DomainRouterVO router = _routerDao.findByNetwork(guestNetwork.getId());
if (router == null) {
router = createVirtualRouter(guestNetwork, plan, dest.getCluster().getHypervisorType(), owner);
}
State state = router.getState();
if (state != State.Running) {