Repository: stratos Updated Branches: refs/heads/master 816500987 -> 34c5cabb1
fixing issue of group scaling not working when there is no deployment policy at the group level Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/34c5cabb Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/34c5cabb Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/34c5cabb Branch: refs/heads/master Commit: 34c5cabb15fad7de4e8e34810aa1ae8fbcef37da Parents: 8165009 Author: reka <[email protected]> Authored: Wed Jun 17 11:36:51 2015 +0530 Committer: reka <[email protected]> Committed: Wed Jun 17 11:37:07 2015 +0530 ---------------------------------------------------------------------- .../monitor/component/GroupMonitor.java | 38 +++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/34c5cabb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java index dbea5e2..ab5d2a5 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java @@ -503,13 +503,15 @@ public class GroupMonitor extends ParentComponentMonitor { if (!active) { onChildTerminatedEvent(childId, instanceId); } else { - log.info("[Group Instance] " + instanceId + " is still active upon termination" + + log.info("[Group Instance] " + instanceId + " for [application] " + appId + + " is still active upon termination" + " of the [child] " + childId); } } } else { - log.warn("The required instance cannot be found in the the [GroupMonitor] " + - id); + log.warn("The required [instance] " + instanceId + " for [application] " + appId + + " cannot be found in the the [GroupMonitor] " + + id + " upon termination of the [child] " + childId); } } @@ -938,19 +940,31 @@ public class GroupMonitor extends ParentComponentMonitor { } else { //have to create one more instance if (group.getInstanceContextCount() < groupMax) { - // Get partitionContext to create instance in - partitionContext = getPartitionContext(parentLevelNetworkPartitionContext, - parentPartitionId); - if (partitionContext != null) { + //Check whether group level deployment policy is there + String deploymentPolicyId = AutoscalerUtil.getDeploymentPolicyIdByAlias(appId, id); + if(deploymentPolicyId != null) { + // Get partitionContext to create instance in + partitionContext = getPartitionContext(parentLevelNetworkPartitionContext, + parentPartitionId); + if (partitionContext != null) { + groupInstanceId = createGroupInstanceAndAddToMonitor(group, parentInstanceContext, + partitionContext, + parentLevelNetworkPartitionContext, + null); + instanceIdsToStart.add(groupInstanceId); + + } else { + log.warn("Partition context is null, there is no more partition available " + + "for the [Group] " + group.getUniqueIdentifier() + " has reached " + + "the maximum limit as [max] " + groupMax + + ". Hence trying to notify the parent."); + } + } else { groupInstanceId = createGroupInstanceAndAddToMonitor(group, parentInstanceContext, - partitionContext, + null, parentLevelNetworkPartitionContext, null); instanceIdsToStart.add(groupInstanceId); - } else { - log.warn("Partition context is null, [Group] " + group.getUniqueIdentifier() + " has reached " + - "the maximum limit as [max] " + groupMax + - ". Hence trying to notify the parent."); } } else { log.warn("[Group] " + group.getUniqueIdentifier() + " has reached " +
