CLOUDSTACK-5552 fixed private gateway clean up in DB when create failed

This commit is contained in:
Jayapal 2014-01-02 11:52:23 +05:30
parent 914bd1230c
commit 3fe9426824
2 changed files with 18 additions and 6 deletions

View File

@ -363,6 +363,9 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
s_logger.debug ("Failed to apply network acl id "+ gateway.getNetworkACLId() + " on gateway ");
return false;
}
} else {
s_logger.debug ("Failed to setup private gateway "+ gateway);
return false;
}
return true;
}
@ -425,10 +428,15 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
return true;
}
if (!_vpcRouterMgr.applyNetworkACLs(config, rules, routers, false)) {
throw new CloudRuntimeException("Failed to apply network acl rules in network " + config.getId());
} else {
return true;
try {
if (!_vpcRouterMgr.applyNetworkACLs(config, rules, routers, false)) {
return false;
} else {
return true;
}
} catch (Exception ex) {
s_logger.debug("Failed to apply network acl in network " + config.getId());
return false;
}
} else {
return true;

View File

@ -381,9 +381,13 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
throw new CloudRuntimeException("Failed to initialize vpc elements");
}
for (VpcProvider provider: vpcElements){
return provider.applyACLItemsToPrivateGw(gateway, rules);
try {
for (VpcProvider provider: vpcElements){
return provider.applyACLItemsToPrivateGw(gateway, rules);
}
} catch(ResourceUnavailableException e) {
s_logger.debug("Failed to apply acl to private gateway " + gateway);
}
return false;
}