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

This commit is contained in:
Sheng Yang 2014-04-16 17:57:59 -07:00
parent 90106f6d8e
commit a28933085c
1 changed files with 6 additions and 2 deletions

View File

@ -188,8 +188,12 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
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!",
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());
}