CLOUDSTACK-6433: Don't return success if only one of RvR successfully created

Conflicts:
	server/src/com/cloud/network/element/VirtualRouterElement.java
This commit is contained in:
Sheng Yang 2014-04-16 17:57:59 -07:00
parent 5d0f507ea6
commit d27c797abc
1 changed files with 10 additions and 4 deletions

View File

@ -188,10 +188,16 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1);
params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
List<DomainRouterVO> routers =
_routerMgr.deployVirtualRouterInGuestNetwork(network, dest, _accountMgr.getAccount(network.getAccountId()), params, offering.getRedundantRouter());
if ((routers == null) || (routers.size() == 0)) {
throw new ResourceUnavailableException("Can't find at least one running router!", DataCenter.class, network.getDataCenterId());
List<DomainRouterVO> routers = _routerMgr.deployVirtualRouterInGuestNetwork(network, dest,
_accountMgr.getAccount(network.getAccountId()), params,
offering.getRedundantRouter());
int routerCounts = 1;
if (offering.getRedundantRouter()) {
routerCounts = 2;
}
if ((routers == null) || (routers.size() < routerCounts)) {
throw new ResourceUnavailableException("Can't find all necessary running routers!",
DataCenter.class, network.getDataCenterId());
}
return true;