Remove AutoScale entities while deleting autoscaled loadbalancer.

This commit is contained in:
Vijay Venkatachalam 2012-11-16 12:21:58 +05:30
parent aea87da410
commit 264f777a2d
3 changed files with 16 additions and 7 deletions

View File

@ -311,6 +311,5 @@ public class EventTypes {
public static final String EVENT_AUTOSCALEVMGROUP_DELETE = "AUTOSCALEVMGROUP.DELETE"; public static final String EVENT_AUTOSCALEVMGROUP_DELETE = "AUTOSCALEVMGROUP.DELETE";
public static final String EVENT_AUTOSCALEVMGROUP_UPDATE = "AUTOSCALEVMGROUP.UPDATE"; public static final String EVENT_AUTOSCALEVMGROUP_UPDATE = "AUTOSCALEVMGROUP.UPDATE";
public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE"; public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE";
public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DIABLE"; public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DISABLE";
} }

View File

@ -755,8 +755,9 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleManager, AutoScaleSe
return _lbRulesMgr.configureLbAutoScaleVmGroup(vmGroupid, currentState); return _lbRulesMgr.configureLbAutoScaleVmGroup(vmGroupid, currentState);
} catch (ResourceUnavailableException re) { } catch (ResourceUnavailableException re) {
throw re; throw re;
} catch (RuntimeException re) { } catch (Exception e) {
s_logger.warn("Exception during configureLbAutoScaleVmGrouop in lb rules manager", re); s_logger.warn("Exception during configureLbAutoScaleVmGroup in lb rules manager", e);
return false;
} }
} }

View File

@ -227,6 +227,7 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
@Inject @Inject
UserDao _userDao; UserDao _userDao;
// Will return a string. For LB Stickiness this will be a json, for autoscale this will be "," separated values // Will return a string. For LB Stickiness this will be a json, for autoscale this will be "," separated values
@Override @Override
public String getLBCapability(long networkid, String capabilityName) { public String getLBCapability(long networkid, String capabilityName) {
@ -351,7 +352,6 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
_lbDao.persist(loadBalancer); _lbDao.persist(loadBalancer);
} }
// LBTODO
try { try {
success = applyAutoScaleConfig(loadBalancer, vmGroup, currentState); success = applyAutoScaleConfig(loadBalancer, vmGroup, currentState);
} catch (ResourceUnavailableException e) { } catch (ResourceUnavailableException e) {
@ -862,10 +862,19 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
if (apply) { if (apply) {
try { try {
if (_autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancerId)) {
// Get the associated VmGroup
AutoScaleVmGroupVO vmGroup = _autoScaleVmGroupDao.listByAll(loadBalancerId, null).get(0);
if (!applyAutoScaleConfig(lb, vmGroup,vmGroup.getState())) {
s_logger.warn("Unable to apply the autoscale config");
return false;
}
} else {
if (!applyLoadBalancerConfig(loadBalancerId)) { if (!applyLoadBalancerConfig(loadBalancerId)) {
s_logger.warn("Unable to apply the load balancer config"); s_logger.warn("Unable to apply the load balancer config");
return false; return false;
} }
}
} catch (ResourceUnavailableException e) { } catch (ResourceUnavailableException e) {
if (rollBack && isRollBackAllowedForProvider(lb)) { if (rollBack && isRollBackAllowedForProvider(lb)) {
if (backupMaps != null) { if (backupMaps != null) {