bug 11555: Fixed NPE happening during LB rule cleanup in case when createLB fails

status 11555: resolved fixed

Reviewed-by: frank@cloud.com

Conflicts:

	server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
This commit is contained in:
alena 2011-09-23 11:02:19 -07:00
parent a8d3c7436a
commit 10308d1ea6
2 changed files with 23 additions and 16 deletions

View File

@ -459,13 +459,14 @@ public class LoadBalancingRulesManagerImpl implements LoadBalancingRulesManager,
}
throw new CloudRuntimeException("Unable to add rule for ip address id=" + newRule.getSourceIpAddressId(), e);
} finally {
if (!success) {
txn.start();
//no need to apply the rule as it wasn't programmed on the backend yet
if (!success && newRule != null) {
txn.start();
_firewallMgr.revokeRelatedFirewallRule(newRule.getId(), false);
_lbDao.remove(newRule.getId());
txn.commit();
}
}
}

View File

@ -223,12 +223,16 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
return newRule;
} catch (Exception e) {
txn.start();
//no need to apply the rule as it wasn't programmed on the backend yet
_firewallMgr.revokeRelatedFirewallRule(newRule.getId(), false);
_forwardingDao.remove(newRule.getId());
txn.commit();
if (newRule != null) {
txn.start();
//no need to apply the rule as it wasn't programmed on the backend yet
_firewallMgr.revokeRelatedFirewallRule(newRule.getId(), false);
_forwardingDao.remove(newRule.getId());
txn.commit();
}
if (e instanceof NetworkRuleConflictException) {
throw (NetworkRuleConflictException) e;
@ -292,12 +296,14 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
return staticNatRule;
} catch (Exception e) {
txn.start();
//no need to apply the rule as it wasn't programmed on the backend yet
_firewallMgr.revokeRelatedFirewallRule(newRule.getId(), false);
_forwardingDao.remove(newRule.getId());
txn.commit();
if (newRule != null) {
txn.start();
//no need to apply the rule as it wasn't programmed on the backend yet
_firewallMgr.revokeRelatedFirewallRule(newRule.getId(), false);
_forwardingDao.remove(newRule.getId());
txn.commit();
}
if (e instanceof NetworkRuleConflictException) {
throw (NetworkRuleConflictException) e;
}