VPC: fixed user vm start in case when Implemented network existed w/o VR (it was expunged with DestroyRouter command)

This commit is contained in:
Alena Prokharchyk 2012-06-20 10:36:59 -07:00
parent 9c1d3e6614
commit 1862942bc9
1 changed files with 10 additions and 0 deletions

View File

@ -189,6 +189,16 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
throw new ResourceUnavailableException("Can't find at least one running router!",
DataCenter.class, network.getDataCenterId());
}
for (VirtualRouter router : routers) {
//Add router to guest network if needed
if (!_networkMgr.isVmPartOfNetwork(router.getId(), network.getId())) {
if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(router, network, false)) {
throw new CloudRuntimeException("Failed to add VPC router " + router + " to guest network " + network);
} else {
s_logger.debug("Successfully added VPC router " + router + " to guest network " + network);
}
}
}
}
return true;