Catch domr creation exception

This commit is contained in:
Sheng Yang 2011-08-09 15:02:41 -07:00
parent fe9ccf33b5
commit bfaa56d471
1 changed files with 13 additions and 4 deletions

View File

@ -940,6 +940,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
txn.commit();
} catch (InsufficientCapacityException ex) {
s_logger.error("Fail to create the virtual router!", ex);
throw ex;
} catch (Exception ex) {
s_logger.error("Fail to create the virtual router due to error: " + ex.getMessage());
} finally {
if (network != null) {
_networkDao.releaseFromLockTable(network.getId());
@ -1018,10 +1023,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
assert guestNetwork.getTrafficType() == TrafficType.Guest;
List<DomainRouterVO> routers = findOrCreateVirtualRouters(guestNetwork, dest, owner, isRedundant);
List<DomainRouterVO> runningRouters = null;
List<DomainRouterVO> runningRouters = new ArrayList<DomainRouterVO>();
if (routers != null) {
runningRouters = new ArrayList<DomainRouterVO>();
if (routers == null) {
return runningRouters;
}
for (DomainRouterVO router : routers) {
@ -1118,7 +1123,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
txn.commit();
} catch (InsufficientCapacityException ex) {
s_logger.error("Fail to create the virtual router!", ex);
throw ex;
} catch (Exception ex) {
s_logger.error("Fail to create the virtual router due to error: " + ex.getMessage());
} finally {
if (network != null) {
_networkDao.releaseFromLockTable(network.getId());