mirror of https://github.com/apache/cloudstack.git
AutoScale. Catching an odd case to get rid of null pointer exception
This commit is contained in:
parent
dc77c8caa5
commit
629053d2f1
|
|
@ -615,6 +615,12 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
List<AutoScaleVmGroupPolicyMapVO> vmGroupPolicyList = _autoScaleVmGroupPolicyMapDao.listByPolicyId(policyId);
|
||||
for (AutoScaleVmGroupPolicyMapVO vmGroupPolicy : vmGroupPolicyList) {
|
||||
AutoScaleVmGroupVO vmGroupVO = _autoScaleVmGroupDao.findById(vmGroupPolicy.getVmGroupId());
|
||||
if(vmGroupVO == null) {
|
||||
s_logger.warn("Stale database entry! There is an entry in VmGroupPolicyMap but the vmGroup is missing:" + vmGroupPolicy.getVmGroupId());
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
if (!vmGroupVO.getState().equals(AutoScaleVmGroup.State_Disabled)) {
|
||||
throw new InvalidParameterValueException("The AutoScale Policy can be updated only if the Vm Group it is associated with is disabled in state");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ StaticNatServiceProvider {
|
|||
int srcPort = rule.getSourcePortStart();
|
||||
List<LbDestination> destinations = rule.getDestinations();
|
||||
|
||||
if (destinations != null && !destinations.isEmpty() || rule.isAutoScaleConfig()) {
|
||||
if ((destinations != null && !destinations.isEmpty()) || rule.isAutoScaleConfig()) {
|
||||
LoadBalancerTO loadBalancer = new LoadBalancerTO(rule.getId(), srcIp, srcPort, protocol, algorithm, revoked, false, destinations, rule.getStickinessPolicies());
|
||||
if(rule.isAutoScaleConfig()) {
|
||||
loadBalancer.setAutoScaleVmGroup(rule.getAutoScaleVmGroup());
|
||||
|
|
|
|||
Loading…
Reference in New Issue