You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2014/10/14 16:28:02 UTC
[1/3] git commit: Fixing STRATOS-893
Repository: stratos
Updated Branches:
refs/heads/master a2c62001f -> 7d4abd0bc
Fixing STRATOS-893
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/27f2a6d3
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/27f2a6d3
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/27f2a6d3
Branch: refs/heads/master
Commit: 27f2a6d3c9fde825eca2a13f553c6c774f9dc5f7
Parents: 8105f27
Author: R-Rajkumar <rr...@gmail.com>
Authored: Tue Oct 14 19:07:20 2014 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Tue Oct 14 19:07:20 2014 +0530
----------------------------------------------------------------------
.../monitor/ClusterMonitorFactory.java | 28 ++++++++++++++++++++
.../controller/topology/TopologyBuilder.java | 3 ++-
.../topology/TopologyEventPublisher.java | 4 ++-
.../conf/LoadBalancerConfiguration.java | 4 ++-
.../messaging/domain/topology/Member.java | 13 ++++++---
.../event/topology/InstanceSpawnedEvent.java | 8 +++++-
.../InstanceSpawnedMessageProcessor.java | 2 +-
7 files changed, 54 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/27f2a6d3/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
index 9724690..d3932ea 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
@@ -142,15 +142,24 @@ public class ClusterMonitorFactory {
MemberContext memberContext = new MemberContext();
memberContext.setClusterId(member.getClusterId());
memberContext.setMemberId(memberId);
+ memberContext.setInitTime(member.getInitTime());
memberContext.setPartition(partition);
memberContext.setProperties(convertMemberPropsToMemberContextProps(member.getProperties()));
if (MemberStatus.Activated.equals(member.getStatus())) {
+ if (log.isDebugEnabled()) {
+ String msg = String.format("Active member loaded from topology and added to active member list, %s", member.toString());
+ log.debug(msg);
+ }
partitionContext.addActiveMember(memberContext);
// networkPartitionContext.increaseMemberCountOfPartition(partition.getNetworkPartitionId(), 1);
// partitionContext.incrementCurrentActiveMemberCount(1);
} else if (MemberStatus.Created.equals(member.getStatus()) || MemberStatus.Starting.equals(member.getStatus())) {
+ if (log.isDebugEnabled()) {
+ String msg = String.format("Pending member loaded from topology and added to pending member list, %s", member.toString());
+ log.debug(msg);
+ }
partitionContext.addPendingMember(memberContext);
// networkPartitionContext.increaseMemberCountOfPartition(partition.getNetworkPartitionId(), 1);
@@ -273,13 +282,22 @@ public class ClusterMonitorFactory {
memberContext.setClusterId(member.getClusterId());
memberContext.setMemberId(memberId);
memberContext.setPartition(partition);
+ memberContext.setInitTime(member.getInitTime());
if (MemberStatus.Activated.equals(member.getStatus())) {
+ if (log.isDebugEnabled()) {
+ String msg = String.format("Active member loaded from topology and added to active member list, %s", member.toString());
+ log.debug(msg);
+ }
partitionContext.addActiveMember(memberContext);
// networkPartitionContext.increaseMemberCountOfPartition(partition.getNetworkPartitionId(), 1);
// partitionContext.incrementCurrentActiveMemberCount(1);
} else if (MemberStatus.Created.equals(member.getStatus()) ||
MemberStatus.Starting.equals(member.getStatus())) {
+ if (log.isDebugEnabled()) {
+ String msg = String.format("Pending member loaded from topology and added to pending member list, %s", member.toString());
+ log.debug(msg);
+ }
partitionContext.addPendingMember(memberContext);
// networkPartitionContext.increaseMemberCountOfPartition(partition.getNetworkPartitionId(), 1);
} else if (MemberStatus.Suspended.equals(member.getStatus())) {
@@ -384,17 +402,27 @@ public class ClusterMonitorFactory {
MemberContext memberContext = new MemberContext();
memberContext.setMemberId(memberId);
memberContext.setClusterId(clusterId);
+ memberContext.setInitTime(member.getInitTime());
// if there is at least one member in the topology, that means service has been created already
// this is to avoid calling startContainer() method again
kubernetesClusterCtxt.setServiceClusterCreated(true);
if (MemberStatus.Activated.equals(member.getStatus())) {
+ if (log.isDebugEnabled()) {
+ String msg = String.format("Active member loaded from topology and added to active member list, %s", member.toString());
+ log.debug(msg);
+ }
dockerClusterMonitor.getKubernetesClusterCtxt().addActiveMember(memberContext);
} else if (MemberStatus.Created.equals(member.getStatus())
|| MemberStatus.Starting.equals(member.getStatus())) {
+ if (log.isDebugEnabled()) {
+ String msg = String.format("Pending member loaded from topology and added to pending member list, %s", member.toString());
+ log.debug(msg);
+ }
dockerClusterMonitor.getKubernetesClusterCtxt().addPendingMember(memberContext);
}
+
kubernetesClusterCtxt.addMemberStatsContext(new MemberStatsContext(memberId));
if (log.isInfoEnabled()) {
log.info(String.format("Member stat context has been added: [member] %s", memberId));
http://git-wip-us.apache.org/repos/asf/stratos/blob/27f2a6d3/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
index 2c7b77b..2b91e46 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
@@ -240,6 +240,7 @@ public class TopologyBuilder {
String memberId = context.getMemberId();
String networkPartitionId = context.getNetworkPartitionId();
String lbClusterId = context.getLbClusterId();
+ long initTime = context.getInitTime();
if (cluster.memberExists(memberId)) {
log.warn(String.format("Member %s already exists", memberId));
@@ -249,7 +250,7 @@ public class TopologyBuilder {
try {
TopologyManager.acquireWriteLock();
Member member = new Member(serviceName, clusterId,
- networkPartitionId, partitionId, memberId);
+ networkPartitionId, partitionId, memberId, initTime);
member.setStatus(MemberStatus.Created);
member.setMemberIp(privateIp);
member.setLbClusterId(lbClusterId);
http://git-wip-us.apache.org/repos/asf/stratos/blob/27f2a6d3/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java
index db3059d..4a48a13 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java
@@ -144,9 +144,11 @@ public class TopologyEventPublisher {
String clusterId, String networkPartitionId, String partitionId,
String memberId, String lbClusterId, String publicIp,
String privateIp, MemberContext context) {
+
+ long initTime = context.getInitTime();
InstanceSpawnedEvent instanceSpawnedEvent = new InstanceSpawnedEvent(
serviceName, clusterId, networkPartitionId, partitionId,
- memberId);
+ memberId, initTime);
instanceSpawnedEvent.setLbClusterId(lbClusterId);
instanceSpawnedEvent.setMemberIp(privateIp);
instanceSpawnedEvent.setMemberPublicIp(publicIp);
http://git-wip-us.apache.org/repos/asf/stratos/blob/27f2a6d3/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java
index 3c6c5d1..e6589fa 100644
--- a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java
+++ b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java
@@ -470,7 +470,9 @@ public class LoadBalancerConfiguration {
for (Node memberNode : membersNode.getChildNodes()) {
String memberId = memberNode.getName();
- Member member = new Member(cluster.getServiceName(), cluster.getClusterId(), Constants.STATIC_NETWORK_PARTITION, Constants.STATIC_PARTITION, memberId);
+ // we are making it as 1 because we are not using this for static loadbalancer configuration
+ long initTime = -1;
+ Member member = new Member(cluster.getServiceName(), cluster.getClusterId(), Constants.STATIC_NETWORK_PARTITION, Constants.STATIC_PARTITION, memberId, initTime);
String ip = memberNode.getProperty(Constants.CONF_PROPERTY_IP);
validateRequiredPropertyInNode(Constants.CONF_PROPERTY_IP, ip, String.format("member %s", memberId));
http://git-wip-us.apache.org/repos/asf/stratos/blob/27f2a6d3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
index c3d9e79..70872c5 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
@@ -39,6 +39,8 @@ public class Member implements Serializable {
private final String networkPartitionId;
private final String partitionId;
private final String memberId;
+ // member initiated time
+ private final long initTime;
// Key: Port.proxy
@XmlJavaTypeAdapter(MapAdapter.class)
private final Map<Integer, Port> portMap;
@@ -49,13 +51,14 @@ public class Member implements Serializable {
private Properties properties;
private String lbClusterId;
- public Member(String serviceName, String clusterId, String networkPartitionId, String partitionId, String memberId) {
+ public Member(String serviceName, String clusterId, String networkPartitionId, String partitionId, String memberId, long initTime) {
this.serviceName = serviceName;
this.clusterId = clusterId;
this.networkPartitionId = networkPartitionId;
this.partitionId = partitionId;
this.memberId = memberId;
this.portMap = new HashMap<Integer, Port>();
+ this.initTime = initTime;
}
public String getServiceName() {
@@ -69,7 +72,11 @@ public class Member implements Serializable {
public String getMemberId() {
return memberId;
}
-
+
+ public long getInitTime() {
+ return initTime;
+ }
+
public MemberStatus getStatus() {
return status;
}
@@ -154,7 +161,7 @@ public class Member implements Serializable {
@Override
public String toString() {
return "Member [serviceName=" + serviceName + ", clusterId=" + clusterId + ", networkPartitionId="
- + networkPartitionId + ", partitionId=" + partitionId + ", memberId=" + memberId + ", portMap="
+ + networkPartitionId + ", partitionId=" + partitionId + ", memberId=" + memberId + ", initTime=" + initTime + ", portMap="
+ portMap + ", memberPublicIp=" + memberPublicIp + ", status=" + status + ", memberIp=" + memberIp
+ ", properties=" + properties + ", lbClusterId=" + lbClusterId + "]";
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/27f2a6d3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java
index 3e99a30..bcb1da2 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java
@@ -34,18 +34,20 @@ public class InstanceSpawnedEvent extends TopologyEvent implements Serializable
private final String networkPartitionId;
private final String partitionId;
private final String memberId;
+ private final long initTime;
private String lbClusterId;
private String memberPublicIp;
private String memberIp;
private Properties properties;
- public InstanceSpawnedEvent(String serviceName, String clusterId, String networkPartitionId, String partitionId, String memberId) {
+ public InstanceSpawnedEvent(String serviceName, String clusterId, String networkPartitionId, String partitionId, String memberId, long initTime) {
this.serviceName = serviceName;
this.clusterId = clusterId;
this.networkPartitionId = networkPartitionId;
this.partitionId = partitionId;
this.memberId = memberId;
+ this.initTime = initTime;
}
public String getServiceName() {
@@ -67,6 +69,10 @@ public class InstanceSpawnedEvent extends TopologyEvent implements Serializable
public String getMemberId() {
return memberId;
}
+
+ public long getInitTime() {
+ return initTime;
+ }
public String getLbClusterId() {
return lbClusterId;
http://git-wip-us.apache.org/repos/asf/stratos/blob/27f2a6d3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedMessageProcessor.java
index db7cc20..eec6474 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedMessageProcessor.java
@@ -109,7 +109,7 @@ public class InstanceSpawnedMessageProcessor extends MessageProcessor {
} else {
// Apply changes to the topology
- Member member = new Member(event.getServiceName(), event.getClusterId(), event.getNetworkPartitionId(), event.getPartitionId(), event.getMemberId());
+ Member member = new Member(event.getServiceName(), event.getClusterId(), event.getNetworkPartitionId(), event.getPartitionId(), event.getMemberId(), event.getInitTime());
member.setStatus(MemberStatus.Created);
member.setMemberPublicIp(event.getMemberPublicIp());
member.setMemberIp(event.getMemberIp());
[2/3] git commit: Fixing STRATOS-889
Posted by ra...@apache.org.
Fixing STRATOS-889
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d189b136
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d189b136
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d189b136
Branch: refs/heads/master
Commit: d189b136e7134b531714e22550eb1e785c0786de
Parents: 27f2a6d
Author: R-Rajkumar <rr...@gmail.com>
Authored: Tue Oct 14 19:49:04 2014 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Tue Oct 14 19:49:04 2014 +0530
----------------------------------------------------------------------
.../rule/AutoscalerRuleEvaluator.java | 4 +-
.../stratos/autoscaler/TestRulesPackaged.java | 6 +-
.../common/constants/StratosConstants.java | 1 +
.../modules/distribution/src/assembly/bin.xml | 22 +-
.../src/main/conf/container-mincheck.drl | 73 -------
.../src/main/conf/container-scaling.drl | 173 ----------------
.../src/main/conf/drools/container-mincheck.drl | 73 +++++++
.../src/main/conf/drools/container-scaling.drl | 173 ++++++++++++++++
.../src/main/conf/drools/mincheck.drl | 83 ++++++++
.../src/main/conf/drools/scaling.drl | 205 +++++++++++++++++++
.../src/main/conf/drools/terminateall.drl | 44 ++++
.../distribution/src/main/conf/mincheck.drl | 83 --------
.../distribution/src/main/conf/scaling.drl | 205 -------------------
.../distribution/src/main/conf/terminateall.drl | 44 ----
14 files changed, 597 insertions(+), 592 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
index a402ab4..094aa86 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.NetworkPartitionLbHolder;
import org.apache.stratos.autoscaler.PartitionContext;
import org.apache.stratos.autoscaler.partition.PartitionManager;
+import org.apache.stratos.common.constants.StratosConstants;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.*;
@@ -176,7 +177,8 @@ public class AutoscalerRuleEvaluator {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
String configDir = CarbonUtils.getCarbonConfigDirPath();
- Resource resource = ResourceFactory.newFileResource(configDir + File.separator + drlFileName );
+ String droolsDir = configDir + File.separator + StratosConstants.DROOLS_DIR_NAME;
+ Resource resource = ResourceFactory.newFileResource(droolsDir + File.separator + drlFileName);
kbuilder.add(resource, ResourceType.DRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestRulesPackaged.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestRulesPackaged.java b/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestRulesPackaged.java
index 1c6c687..f6f0148 100644
--- a/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestRulesPackaged.java
+++ b/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestRulesPackaged.java
@@ -32,9 +32,9 @@ import static org.junit.Assert.assertEquals;
public class TestRulesPackaged {
private static final Log log = LogFactory.getLog(TestRulesPackaged.class);
- private String minCheckDrlFilePath = "../../products/stratos/modules/distribution/src/main/conf/mincheck.drl";
- private String scalingDrlFilePath = "../../products/stratos/modules/distribution/src/main/conf/scaling.drl";
- private String terminateAllDrlFilePath = "../../products/stratos/modules/distribution/src/main/conf/terminateall.drl";
+ private String minCheckDrlFilePath = "../../products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl";
+ private String scalingDrlFilePath = "../../products/stratos/modules/distribution/src/main/conf/drools/scaling.drl";
+ private String terminateAllDrlFilePath = "../../products/stratos/modules/distribution/src/main/conf/drools/terminateall.drl";
private KnowledgeBase kbase;
private StatefulKnowledgeSession ksession;
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
index 5d3ad8c..72cbb26 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
@@ -155,6 +155,7 @@ public class StratosConstants {
public static final String ALLOCATED_SERVICE_HOST_PORT = "ALLOCATED_SERVICE_HOST_PORT";
//drools related constants
+ public static final String DROOLS_DIR_NAME = "drools";
public static final String CONTAINER_SCALE_CHECK_DROOL_FILE = "container-scaling.drl";
public static final String VM_SCALE_CHECK_DROOL_FILE = "scaling.drl";
public static final String CONTAINER_MIN_CHECK_DROOL_FILE = "container-mincheck.drl";
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/assembly/bin.xml b/products/stratos/modules/distribution/src/assembly/bin.xml
index 4295576..8614acf 100755
--- a/products/stratos/modules/distribution/src/assembly/bin.xml
+++ b/products/stratos/modules/distribution/src/assembly/bin.xml
@@ -660,38 +660,40 @@
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
+ <!-- drools files start-->
<file>
- <source>src/main/conf/mincheck.drl</source>
- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
+ <source>src/main/conf/drools/mincheck.drl</source>
+ <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/drools</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<file>
- <source>src/main/conf/scaling.drl</source>
- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
+ <source>src/main/conf/drools/scaling.drl</source>
+ <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/drools</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<file>
- <source>src/main/conf/terminateall.drl</source>
- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
+ <source>src/main/conf/drools/terminateall.drl</source>
+ <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/drools</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<!-- container-drools files -->
<file>
- <source>src/main/conf/container-mincheck.drl</source>
- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
+ <source>src/main/conf/drools/container-mincheck.drl</source>
+ <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/drools</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<file>
- <source>src/main/conf/container-scaling.drl</source>
- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
+ <source>src/main/conf/drools/container-scaling.drl</source>
+ <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/drools</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<!-- container-drools files -->
+ <!-- /drools files end-->
<!-- autoscaler -->
<file>
<source>${project.basedir}/INSTALL.txt</source>
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/container-mincheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/container-mincheck.drl b/products/stratos/modules/distribution/src/main/conf/container-mincheck.drl
deleted file mode 100644
index f87a556..0000000
--- a/products/stratos/modules/distribution/src/main/conf/container-mincheck.drl
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.commons.logging.Log;
-import org.apache.stratos.autoscaler.KubernetesClusterContext;
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
-global java.lang.String clusterId;
-
-rule "Container Minimum Rule"
-dialect "mvel"
- when
- $kubernetesClusterContext : KubernetesClusterContext ()
- kubernetesClusterId : String() from $kubernetesClusterContext.getKubernetesClusterID()
- minReplicas : Integer() from $kubernetesClusterContext.getMinReplicas()
- nonTerminatedReplicas : Integer() from $kubernetesClusterContext.getNonTerminatedMemberCount()
- isServiceClusterCreated : Boolean() from $kubernetesClusterContext.isServiceClusterCreated()
-
- eval(log.info("Running minimum rule: [kub-cluster] " + kubernetesClusterId + " [cluster] " + clusterId))
- eval(log.info("[min-check] " + " [cluster] : " + clusterId + " [Replicas] nonTerminated : " + nonTerminatedReplicas))
- eval(log.info("[min-check] " + " [cluster] : " + clusterId + " [Replicas] minReplicas : " + minReplicas))
- eval(nonTerminatedReplicas < minReplicas)
- then
- if (isServiceClusterCreated) {
- // we suceeded calling startContainer() once, can't call it again
- log.info("[min-check] Decided to scale-up : [cluster] : " + clusterId);
- log.info("[min-check] " + " [cluster] : " + clusterId + " ; min-rule not satisfied, scaling up to minReplicas : " + minReplicas);
- $delegator.delegateScaleUpContainers($kubernetesClusterContext, minReplicas);
- } else {
- // we should call startContainer
- log.info("[min-check] Decided to create the cluster : [cluster] : " + clusterId);
- log.info("[min-check] " + " [cluster] : " + clusterId + " ; min-rule not satisfied, no containers created yet, creating minReplicas : " + minReplicas);
- $delegator.delegateStartContainers($kubernetesClusterContext);
- }
-end
-
-rule "Terminate Obsoleted Containers"
-dialect "mvel"
- when
- $kubernetesClusterContext : KubernetesClusterContext ()
- kubernetesClusterId : String() from $kubernetesClusterContext.getKubernetesClusterID()
- obsoleteReplicas : Integer() from $kubernetesClusterContext.getObsoletedMembers().size()
-
- eval(log.info("Running obsolete containers rule [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId))
- eval(log.info("[obsolete-check] " + "[cluster] : " + clusterId + " [Replicas] obsoleteReplicas : " + obsoleteReplicas))
- eval($kubernetesClusterContext.getObsoletedMembers().keySet().size() > 0)
- memberId : String() from $kubernetesClusterContext.getObsoletedMembers().keySet()
- eval(log.debug("[obsolete-check] [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId + " Member id : " + memberId))
- then
- log.info("[obsolete-check] Terminating the obsolete member with id : " + memberId + " in the cluster : " + clusterId);
- $delegator.delegateTerminateContainer($kubernetesClusterContext, memberId);
-end
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/container-scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/container-scaling.drl b/products/stratos/modules/distribution/src/main/conf/container-scaling.drl
deleted file mode 100644
index c5d4272..0000000
--- a/products/stratos/modules/distribution/src/main/conf/container-scaling.drl
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
-import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
-import org.apache.stratos.autoscaler.KubernetesClusterContext;
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
-global org.apache.stratos.autoscaler.policy.model.AutoscalePolicy autoscalePolicy;
-global java.lang.String clusterId;
-global java.lang.Boolean rifReset;
-global java.lang.Boolean mcReset;
-global java.lang.Boolean laReset;
-
-rule "Containers Scaling Rule"
-dialect "mvel"
- when
- $kubernetesClusterContext : KubernetesClusterContext ()
- kubernetesClusterId : String() from $kubernetesClusterContext.getKubernetesClusterID()
- minReplicas : Integer() from $kubernetesClusterContext.getMinReplicas()
- maxReplicas : Integer() from $kubernetesClusterContext.getMaxReplicas()
- nonTerminatedReplicas : Integer() from $kubernetesClusterContext.getNonTerminatedMemberCount()
- activeReplicas : Integer() from $kubernetesClusterContext.getActiveMemberCount()
-
- eval(log.info("Running scaling rule [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId))
-
- $loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds()
-
- rifUpperLimit : Float() from $loadThresholds.getRequestsInFlight().getUpperLimit()
- rifLowerLimit : Float() from $loadThresholds.getRequestsInFlight().getLowerLimit()
-
- rifAverage : Float() from $kubernetesClusterContext.getAverageRequestsInFlight()
- rifGradient : Float() from $kubernetesClusterContext.getRequestsInFlightGradient()
- rifSecondDerivative : Float() from $kubernetesClusterContext.getRequestsInFlightSecondDerivative()
- rifPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(rifAverage, rifGradient, rifSecondDerivative, 1)
-
- mcUpperLimit : Float() from $loadThresholds.getMemoryConsumption().getUpperLimit()
- mcLowerLimit : Float() from $loadThresholds.getMemoryConsumption().getLowerLimit()
-
- memoryConsumptionAverage : Float() from $kubernetesClusterContext.getAverageMemoryConsumption()
- memoryConsumptionGradient : Float() from $kubernetesClusterContext.getMemoryConsumptionGradient()
- memoryConsumptionSecondDerivative : Float() from $kubernetesClusterContext.getMemoryConsumptionSecondDerivative()
- mcPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(memoryConsumptionAverage, memoryConsumptionGradient, memoryConsumptionSecondDerivative, 1)
-
- laUpperLimit : Float() from $loadThresholds.getLoadAverage().getUpperLimit()
- laLowerLimit : Float() from $loadThresholds.getLoadAverage().getLowerLimit()
-
- loadAverageAverage : Float() from $kubernetesClusterContext.getAverageLoadAverage()
- loadAverageGradient : Float() from $kubernetesClusterContext.getLoadAverageGradient()
- loadAverageSecondDerivative : Float() from $kubernetesClusterContext.getLoadAverageSecondDerivative()
- laPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(loadAverageAverage, loadAverageGradient, loadAverageSecondDerivative, 1)
-
- scaleUpForRif : Boolean() from (rifReset && (rifPredictedValue > rifUpperLimit))
- scaleUpForMc : Boolean() from (mcReset && (mcPredictedValue > mcUpperLimit))
- scaleUpForLa : Boolean() from (laReset && (laPredictedValue > laUpperLimit))
-
- scaleDownForRif : Boolean() from (rifPredictedValue < rifUpperLimit)
- scaleDownForMc : Boolean() from (mcReset && (mcPredictedValue < mcUpperLimit))
- scaleDownForLa : Boolean() from (laReset && (laPredictedValue < laUpperLimit))
-
- scaleUp : Boolean() from (scaleUpForRif || scaleUpForMc || scaleUpForLa)
- scaleDown : Boolean() from (scaleDownForRif && scaleDownForMc && scaleDownForLa)
-
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] minReplicas : " + minReplicas))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] maxReplicas : " + maxReplicas))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] nonTerminated : " + nonTerminatedReplicas))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] activeReplicas : " + activeReplicas))
-
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] resetted ? : " + rifReset))
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] predicted value : " + rifPredictedValue))
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] upper limit : " + rifUpperLimit))
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] lower limit : " + rifLowerLimit))
-
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] resetted ? : " + mcReset))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] predicted value : " + mcPredictedValue))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] upper limit : " + mcUpperLimit))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] lower limit : " + mcLowerLimit))
-
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] resetted ? : " + laReset))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] predicted value : " + laPredictedValue))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] upper limit : " + laUpperLimit))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] lower limit : " + laLowerLimit))
-
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " scale-up action : " + scaleUp))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " scale-down action : " + scaleDown))
-
- then
- if (scaleUp) {
- int requiredReplicas = 0;
- if (scaleUpForRif) {
- int predictedReplicasForRif = $delegator.getPredictedReplicasForStat(minReplicas, rifUpperLimit, rifPredictedValue);
- log.info("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] predicted replicas : " + predictedReplicasForRif);
- if (predictedReplicasForRif > requiredReplicas ) {
- requiredReplicas = predictedReplicasForRif;
- }
- }
- if (scaleUpForMc) {
- int predictedReplicasForMc = $delegator.getPredictedReplicasForStat(minReplicas, mcUpperLimit, mcPredictedValue);
- log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] predicted replicas : " + predictedReplicasForMc);
- if (predictedReplicasForMc > requiredReplicas ) {
- requiredReplicas = predictedReplicasForMc;
- }
- }
- if (scaleUpForLa) {
- int predictedReplicasForLa = $delegator.getPredictedReplicasForStat(minReplicas, laUpperLimit, laPredictedValue);
- log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] predicted replicas : " + predictedReplicasForLa);
- if (predictedReplicasForLa > requiredReplicas ) {
- requiredReplicas = predictedReplicasForLa;
- }
- }
- //max-check
- if (requiredReplicas > maxReplicas) {
- log.info("[scaling] " + " [cluster] : " + clusterId + " predicted replicas > max replicas : ");
- requiredReplicas = maxReplicas;
- }
- //min-check
- if (requiredReplicas < minReplicas) {
- log.info("[scaling] " + " [cluster] : " + clusterId + " predicted replicas < min replicas : ");
- requiredReplicas = minReplicas;
- }
- //expand the cluster
- if (requiredReplicas > nonTerminatedReplicas) {
- log.info("[scaling] Decided to scale-up : [cluster] : " + clusterId);
- log.info("[scaling-up] " + " [cluster] : " + clusterId + " valid number of replicas to expand : " + requiredReplicas);
- $delegator.delegateScaleUpContainers($kubernetesClusterContext, requiredReplicas);
- }
- //shrink the cluster
- if (requiredReplicas < nonTerminatedReplicas) {
- if (requiredReplicas < activeReplicas) {
- log.info("[scaling] Decided to scale-down : [cluster] : " + clusterId);
- log.info("[scaling-down] " + " [cluster] : " + clusterId + " valid number of replicas to shrink : " + requiredReplicas);
- $delegator.delegateScaleDownContainers($kubernetesClusterContext, requiredReplicas);
- } else {
- log.info("[scaling] " + " [cluster] : " + clusterId + " Even if requiredReplicas < nonTerminatedReplicas, still requiredReplicas >= activeReplicas ; hence not scaling down ");
- }
- }
- if (requiredReplicas == nonTerminatedReplicas) {
- log.info("[scaling] " + " [cluster] : " + clusterId + " Non terminated replicas and predicted replicas are same");
- }
-
- } else if (scaleDown) {
- if (activeReplicas > minReplicas) {
- log.info("[scaling] Decided to scale-down [cluster] : " + clusterId);
- log.info("[scaling-down] " + " [cluster] : " + clusterId + " shrink the cluster to minReplicas : " + minReplicas);
- //shrink the cluster to minReplicas
- $delegator.delegateScaleDownContainers($kubernetesClusterContext, minReplicas);
- } else {
- log.info("[scaling] " + " [cluster] : " + clusterId + " Even if all predicted stats < upperLimit, still activeReplicas <= minReplicas ; hence not scaling down ");
- }
- } else {
- log.info("[scaling] No decision made to either scale up or down ... ");
- }
-end
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/drools/container-mincheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/container-mincheck.drl b/products/stratos/modules/distribution/src/main/conf/drools/container-mincheck.drl
new file mode 100644
index 0000000..f87a556
--- /dev/null
+++ b/products/stratos/modules/distribution/src/main/conf/drools/container-mincheck.drl
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.autoscaler.rule;
+
+import org.apache.commons.logging.Log;
+import org.apache.stratos.autoscaler.KubernetesClusterContext;
+
+global org.apache.stratos.autoscaler.rule.RuleLog log;
+global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
+global java.lang.String clusterId;
+
+rule "Container Minimum Rule"
+dialect "mvel"
+ when
+ $kubernetesClusterContext : KubernetesClusterContext ()
+ kubernetesClusterId : String() from $kubernetesClusterContext.getKubernetesClusterID()
+ minReplicas : Integer() from $kubernetesClusterContext.getMinReplicas()
+ nonTerminatedReplicas : Integer() from $kubernetesClusterContext.getNonTerminatedMemberCount()
+ isServiceClusterCreated : Boolean() from $kubernetesClusterContext.isServiceClusterCreated()
+
+ eval(log.info("Running minimum rule: [kub-cluster] " + kubernetesClusterId + " [cluster] " + clusterId))
+ eval(log.info("[min-check] " + " [cluster] : " + clusterId + " [Replicas] nonTerminated : " + nonTerminatedReplicas))
+ eval(log.info("[min-check] " + " [cluster] : " + clusterId + " [Replicas] minReplicas : " + minReplicas))
+ eval(nonTerminatedReplicas < minReplicas)
+ then
+ if (isServiceClusterCreated) {
+ // we suceeded calling startContainer() once, can't call it again
+ log.info("[min-check] Decided to scale-up : [cluster] : " + clusterId);
+ log.info("[min-check] " + " [cluster] : " + clusterId + " ; min-rule not satisfied, scaling up to minReplicas : " + minReplicas);
+ $delegator.delegateScaleUpContainers($kubernetesClusterContext, minReplicas);
+ } else {
+ // we should call startContainer
+ log.info("[min-check] Decided to create the cluster : [cluster] : " + clusterId);
+ log.info("[min-check] " + " [cluster] : " + clusterId + " ; min-rule not satisfied, no containers created yet, creating minReplicas : " + minReplicas);
+ $delegator.delegateStartContainers($kubernetesClusterContext);
+ }
+end
+
+rule "Terminate Obsoleted Containers"
+dialect "mvel"
+ when
+ $kubernetesClusterContext : KubernetesClusterContext ()
+ kubernetesClusterId : String() from $kubernetesClusterContext.getKubernetesClusterID()
+ obsoleteReplicas : Integer() from $kubernetesClusterContext.getObsoletedMembers().size()
+
+ eval(log.info("Running obsolete containers rule [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId))
+ eval(log.info("[obsolete-check] " + "[cluster] : " + clusterId + " [Replicas] obsoleteReplicas : " + obsoleteReplicas))
+ eval($kubernetesClusterContext.getObsoletedMembers().keySet().size() > 0)
+ memberId : String() from $kubernetesClusterContext.getObsoletedMembers().keySet()
+ eval(log.debug("[obsolete-check] [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId + " Member id : " + memberId))
+ then
+ log.info("[obsolete-check] Terminating the obsolete member with id : " + memberId + " in the cluster : " + clusterId);
+ $delegator.delegateTerminateContainer($kubernetesClusterContext, memberId);
+end
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/drools/container-scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/container-scaling.drl b/products/stratos/modules/distribution/src/main/conf/drools/container-scaling.drl
new file mode 100644
index 0000000..c5d4272
--- /dev/null
+++ b/products/stratos/modules/distribution/src/main/conf/drools/container-scaling.drl
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.autoscaler.rule;
+
+import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
+import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
+import org.apache.stratos.autoscaler.KubernetesClusterContext;
+
+global org.apache.stratos.autoscaler.rule.RuleLog log;
+global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
+global org.apache.stratos.autoscaler.policy.model.AutoscalePolicy autoscalePolicy;
+global java.lang.String clusterId;
+global java.lang.Boolean rifReset;
+global java.lang.Boolean mcReset;
+global java.lang.Boolean laReset;
+
+rule "Containers Scaling Rule"
+dialect "mvel"
+ when
+ $kubernetesClusterContext : KubernetesClusterContext ()
+ kubernetesClusterId : String() from $kubernetesClusterContext.getKubernetesClusterID()
+ minReplicas : Integer() from $kubernetesClusterContext.getMinReplicas()
+ maxReplicas : Integer() from $kubernetesClusterContext.getMaxReplicas()
+ nonTerminatedReplicas : Integer() from $kubernetesClusterContext.getNonTerminatedMemberCount()
+ activeReplicas : Integer() from $kubernetesClusterContext.getActiveMemberCount()
+
+ eval(log.info("Running scaling rule [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId))
+
+ $loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds()
+
+ rifUpperLimit : Float() from $loadThresholds.getRequestsInFlight().getUpperLimit()
+ rifLowerLimit : Float() from $loadThresholds.getRequestsInFlight().getLowerLimit()
+
+ rifAverage : Float() from $kubernetesClusterContext.getAverageRequestsInFlight()
+ rifGradient : Float() from $kubernetesClusterContext.getRequestsInFlightGradient()
+ rifSecondDerivative : Float() from $kubernetesClusterContext.getRequestsInFlightSecondDerivative()
+ rifPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(rifAverage, rifGradient, rifSecondDerivative, 1)
+
+ mcUpperLimit : Float() from $loadThresholds.getMemoryConsumption().getUpperLimit()
+ mcLowerLimit : Float() from $loadThresholds.getMemoryConsumption().getLowerLimit()
+
+ memoryConsumptionAverage : Float() from $kubernetesClusterContext.getAverageMemoryConsumption()
+ memoryConsumptionGradient : Float() from $kubernetesClusterContext.getMemoryConsumptionGradient()
+ memoryConsumptionSecondDerivative : Float() from $kubernetesClusterContext.getMemoryConsumptionSecondDerivative()
+ mcPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(memoryConsumptionAverage, memoryConsumptionGradient, memoryConsumptionSecondDerivative, 1)
+
+ laUpperLimit : Float() from $loadThresholds.getLoadAverage().getUpperLimit()
+ laLowerLimit : Float() from $loadThresholds.getLoadAverage().getLowerLimit()
+
+ loadAverageAverage : Float() from $kubernetesClusterContext.getAverageLoadAverage()
+ loadAverageGradient : Float() from $kubernetesClusterContext.getLoadAverageGradient()
+ loadAverageSecondDerivative : Float() from $kubernetesClusterContext.getLoadAverageSecondDerivative()
+ laPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(loadAverageAverage, loadAverageGradient, loadAverageSecondDerivative, 1)
+
+ scaleUpForRif : Boolean() from (rifReset && (rifPredictedValue > rifUpperLimit))
+ scaleUpForMc : Boolean() from (mcReset && (mcPredictedValue > mcUpperLimit))
+ scaleUpForLa : Boolean() from (laReset && (laPredictedValue > laUpperLimit))
+
+ scaleDownForRif : Boolean() from (rifPredictedValue < rifUpperLimit)
+ scaleDownForMc : Boolean() from (mcReset && (mcPredictedValue < mcUpperLimit))
+ scaleDownForLa : Boolean() from (laReset && (laPredictedValue < laUpperLimit))
+
+ scaleUp : Boolean() from (scaleUpForRif || scaleUpForMc || scaleUpForLa)
+ scaleDown : Boolean() from (scaleDownForRif && scaleDownForMc && scaleDownForLa)
+
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] minReplicas : " + minReplicas))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] maxReplicas : " + maxReplicas))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] nonTerminated : " + nonTerminatedReplicas))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] activeReplicas : " + activeReplicas))
+
+ eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] resetted ? : " + rifReset))
+ eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] predicted value : " + rifPredictedValue))
+ eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] upper limit : " + rifUpperLimit))
+ eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] lower limit : " + rifLowerLimit))
+
+ eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] resetted ? : " + mcReset))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] predicted value : " + mcPredictedValue))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] upper limit : " + mcUpperLimit))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] lower limit : " + mcLowerLimit))
+
+ eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] resetted ? : " + laReset))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] predicted value : " + laPredictedValue))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] upper limit : " + laUpperLimit))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] lower limit : " + laLowerLimit))
+
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " scale-up action : " + scaleUp))
+ eval(log.info("[scaling] " + " [cluster] : " + clusterId + " scale-down action : " + scaleDown))
+
+ then
+ if (scaleUp) {
+ int requiredReplicas = 0;
+ if (scaleUpForRif) {
+ int predictedReplicasForRif = $delegator.getPredictedReplicasForStat(minReplicas, rifUpperLimit, rifPredictedValue);
+ log.info("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] predicted replicas : " + predictedReplicasForRif);
+ if (predictedReplicasForRif > requiredReplicas ) {
+ requiredReplicas = predictedReplicasForRif;
+ }
+ }
+ if (scaleUpForMc) {
+ int predictedReplicasForMc = $delegator.getPredictedReplicasForStat(minReplicas, mcUpperLimit, mcPredictedValue);
+ log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] predicted replicas : " + predictedReplicasForMc);
+ if (predictedReplicasForMc > requiredReplicas ) {
+ requiredReplicas = predictedReplicasForMc;
+ }
+ }
+ if (scaleUpForLa) {
+ int predictedReplicasForLa = $delegator.getPredictedReplicasForStat(minReplicas, laUpperLimit, laPredictedValue);
+ log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] predicted replicas : " + predictedReplicasForLa);
+ if (predictedReplicasForLa > requiredReplicas ) {
+ requiredReplicas = predictedReplicasForLa;
+ }
+ }
+ //max-check
+ if (requiredReplicas > maxReplicas) {
+ log.info("[scaling] " + " [cluster] : " + clusterId + " predicted replicas > max replicas : ");
+ requiredReplicas = maxReplicas;
+ }
+ //min-check
+ if (requiredReplicas < minReplicas) {
+ log.info("[scaling] " + " [cluster] : " + clusterId + " predicted replicas < min replicas : ");
+ requiredReplicas = minReplicas;
+ }
+ //expand the cluster
+ if (requiredReplicas > nonTerminatedReplicas) {
+ log.info("[scaling] Decided to scale-up : [cluster] : " + clusterId);
+ log.info("[scaling-up] " + " [cluster] : " + clusterId + " valid number of replicas to expand : " + requiredReplicas);
+ $delegator.delegateScaleUpContainers($kubernetesClusterContext, requiredReplicas);
+ }
+ //shrink the cluster
+ if (requiredReplicas < nonTerminatedReplicas) {
+ if (requiredReplicas < activeReplicas) {
+ log.info("[scaling] Decided to scale-down : [cluster] : " + clusterId);
+ log.info("[scaling-down] " + " [cluster] : " + clusterId + " valid number of replicas to shrink : " + requiredReplicas);
+ $delegator.delegateScaleDownContainers($kubernetesClusterContext, requiredReplicas);
+ } else {
+ log.info("[scaling] " + " [cluster] : " + clusterId + " Even if requiredReplicas < nonTerminatedReplicas, still requiredReplicas >= activeReplicas ; hence not scaling down ");
+ }
+ }
+ if (requiredReplicas == nonTerminatedReplicas) {
+ log.info("[scaling] " + " [cluster] : " + clusterId + " Non terminated replicas and predicted replicas are same");
+ }
+
+ } else if (scaleDown) {
+ if (activeReplicas > minReplicas) {
+ log.info("[scaling] Decided to scale-down [cluster] : " + clusterId);
+ log.info("[scaling-down] " + " [cluster] : " + clusterId + " shrink the cluster to minReplicas : " + minReplicas);
+ //shrink the cluster to minReplicas
+ $delegator.delegateScaleDownContainers($kubernetesClusterContext, minReplicas);
+ } else {
+ log.info("[scaling] " + " [cluster] : " + clusterId + " Even if all predicted stats < upperLimit, still activeReplicas <= minReplicas ; hence not scaling down ");
+ }
+ } else {
+ log.info("[scaling] No decision made to either scale up or down ... ");
+ }
+end
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl b/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl
new file mode 100755
index 0000000..71187d6
--- /dev/null
+++ b/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.autoscaler.rule;
+
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.autoscaler.AutoscalerContext;
+import org.apache.stratos.autoscaler.Constants;
+import org.apache.stratos.autoscaler.policy.PolicyManager;
+import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
+import org.apache.stratos.autoscaler.policy.model.RequestsInFlight;
+import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
+import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
+import org.apache.stratos.autoscaler.algorithm.AutoscaleAlgorithm;
+import org.apache.stratos.autoscaler.algorithm.OneAfterAnother;
+import org.apache.stratos.autoscaler.algorithm.RoundRobin;
+import org.apache.stratos.autoscaler.PartitionContext;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
+import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
+import org.apache.commons.logging.Log;
+import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
+import org.apache.stratos.autoscaler.partition.PartitionGroup;
+import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.stub.pojo.MemberContext;
+
+global org.apache.stratos.autoscaler.rule.RuleLog log;
+global org.apache.stratos.autoscaler.policy.PolicyManager $manager;
+global org.apache.stratos.autoscaler.AutoscalerContext $context;
+global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
+global org.apache.stratos.messaging.domain.topology.Topology $topology;
+global java.util.Map partitionCtxts;
+global java.lang.String clusterId;
+global java.lang.String lbRef;
+global java.lang.Boolean isPrimary;
+global Integer primaryMemberCount;
+
+rule "Minimum Rule"
+dialect "mvel"
+ when
+ $ctxt : PartitionContext ()
+ eval(log.debug("Running minimum rule: [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId()))
+ eval(log.debug("[min-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Non terminated member count: " + $ctxt.getNonTerminatedMemberCount()))
+ eval(log.debug("[min-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Minimum member count: " + $ctxt.getMinimumMemberCount()))
+ eval ( (isPrimary && (primaryMemberCount < $ctxt.getMinimumMemberCount() )) || ( !isPrimary && ($ctxt.getNonTerminatedMemberCount() < $ctxt.getMinimumMemberCount() )) )
+ then
+ if (isPrimary){
+ log.debug("[min-check] true [primary] true [primary member count] " + primaryMemberCount);
+ } else{
+ log.debug("[min-check] true [primary] false");
+ }
+ $delegator.delegateSpawn($ctxt, clusterId, lbRef, isPrimary);
+end
+
+rule "Terminate Obsoleted Instances"
+dialect "mvel"
+ when
+ $ctxt : PartitionContext ()
+ eval(log.debug("Running obsolete instances rule: [partition] " + $ctxt.getPartitionId() + " [network-partition] " + $ctxt.getNetworkPartitionId()))
+ eval(log.debug("[obsolete-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() +" Obsolete member count: " + $ctxt.getObsoletedMembers().size()))
+ eval($ctxt.getObsoletedMembers().keySet().size() > 0)
+ memberId : String() from $ctxt.getObsoletedMembers().keySet()
+ eval(log.debug("[obsolete-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Member id: " + memberId))
+ then
+ $delegator.terminateObsoleteInstance(memberId);
+end
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
new file mode 100644
index 0000000..bd331e7
--- /dev/null
+++ b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.autoscaler.rule;
+
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.autoscaler.AutoscalerContext;
+import org.apache.stratos.autoscaler.MemberStatsContext;
+import org.apache.stratos.autoscaler.Constants;
+import org.apache.stratos.autoscaler.NetworkPartitionContext;
+import org.apache.stratos.autoscaler.policy.PolicyManager;
+import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
+import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
+import org.apache.stratos.autoscaler.policy.model.RequestsInFlight;
+import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
+import org.apache.stratos.autoscaler.policy.model.MemoryConsumption;
+import org.apache.stratos.autoscaler.policy.model.LoadAverage;
+import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
+import org.apache.stratos.autoscaler.algorithm.AutoscaleAlgorithm;
+import org.apache.stratos.autoscaler.algorithm.OneAfterAnother;
+import org.apache.stratos.autoscaler.algorithm.RoundRobin;
+import org.apache.stratos.autoscaler.PartitionContext;
+import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
+import org.apache.stratos.autoscaler.partition.PartitionGroup;
+import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.stub.pojo.MemberContext;
+
+import org.apache.stratos.autoscaler.policy.model.LoadAverage
+import org.apache.stratos.autoscaler.policy.model.MemoryConsumption
+
+global org.apache.stratos.autoscaler.rule.RuleLog log;
+global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
+global org.apache.stratos.autoscaler.policy.model.AutoscalePolicy autoscalePolicy;
+global java.lang.String clusterId;
+global java.lang.String lbRef;
+global java.lang.Boolean rifReset;
+global java.lang.Boolean mcReset;
+global java.lang.Boolean laReset;
+global java.lang.Boolean isPrimary;
+global java.util.List primaryMembers;
+
+rule "Scaling Rule"
+dialect "mvel"
+ when
+ $networkPartitionContext : NetworkPartitionContext ()
+
+ $loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds()
+ algorithmName : String() from $networkPartitionContext.getPartitionAlgorithm();
+ autoscaleAlgorithm : AutoscaleAlgorithm() from $delegator.getAutoscaleAlgorithm(algorithmName)
+
+ eval(log.debug("Running scale up rule: [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId))
+ eval(log.debug("[scaling] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm name: " + algorithmName))
+ eval(log.debug("[scaling] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm: " + autoscaleAlgorithm))
+
+
+ rifUpperLimit : Float() from $loadThresholds.getRequestsInFlight().getUpperLimit()
+ rifLowerLimit : Float() from $loadThresholds.getRequestsInFlight().getLowerLimit()
+
+ rifAverage : Float() from $networkPartitionContext.getAverageRequestsInFlight()
+ rifGradient : Float() from $networkPartitionContext.getRequestsInFlightGradient()
+ rifSecondDerivative : Float() from $networkPartitionContext.getRequestsInFlightSecondDerivative()
+ rifPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(rifAverage, rifGradient, rifSecondDerivative, 1)
+
+ mcUpperLimit : Float() from $loadThresholds.getMemoryConsumption().getUpperLimit()
+ mcLowerLimit : Float() from $loadThresholds.getMemoryConsumption().getLowerLimit()
+
+ memoryConsumptionAverage : Float() from $networkPartitionContext.getAverageMemoryConsumption()
+ memoryConsumptionGradient : Float() from $networkPartitionContext.getMemoryConsumptionGradient()
+ memoryConsumptionSecondDerivative : Float() from $networkPartitionContext.getMemoryConsumptionSecondDerivative()
+ mcPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(memoryConsumptionAverage, memoryConsumptionGradient, memoryConsumptionSecondDerivative, 1)
+
+ laUpperLimit : Float() from $loadThresholds.getLoadAverage().getUpperLimit()
+ laLowerLimit : Float() from $loadThresholds.getLoadAverage().getLowerLimit()
+
+ loadAverageAverage : Float() from $networkPartitionContext.getAverageLoadAverage()
+ loadAverageGradient : Float() from $networkPartitionContext.getLoadAverageGradient()
+ loadAverageSecondDerivative : Float() from $networkPartitionContext.getLoadAverageSecondDerivative()
+ laPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(loadAverageAverage, loadAverageGradient, loadAverageSecondDerivative, 1)
+
+ scaleUp : Boolean() from ((rifReset && (rifPredictedValue > rifUpperLimit)) || (mcReset && (mcPredictedValue > mcUpperLimit)) || (laReset && (laPredictedValue > laUpperLimit)))
+ scaleDown : Boolean() from ((rifReset && (rifPredictedValue < rifLowerLimit )) && (mcReset && (mcPredictedValue < mcLowerLimit)) && (laReset && (laPredictedValue < laLowerLimit)))
+
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " RIF Resetted?: " + rifReset))
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " RIF predicted value: " + rifPredictedValue))
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " RIF upper limit: " + rifUpperLimit))
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " RIF lower limit: " + rifLowerLimit))
+
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " MC predicted value: " + mcPredictedValue))
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " MC upper limit: " + mcUpperLimit))
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " MC lower limit: " + mcLowerLimit))
+
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " LA predicted value: " + laPredictedValue))
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " LA upper limit: " + laUpperLimit))
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " LA lower limit: " + laLowerLimit))
+
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " Scale-up action: " + scaleUp))
+ eval(log.debug("[scaling] " + " [cluster] " + clusterId + " Scale-down action: " + scaleDown))
+
+ then
+ if(scaleUp){
+
+ $networkPartitionContext.resetScaleDownRequestsCount();
+ Partition partition = autoscaleAlgorithm.getNextScaleUpPartition($networkPartitionContext, clusterId);
+ if(partition != null){
+ log.info("[scale-up] Partition available, hence trying to spawn an instance to scale up!" );
+ log.debug("[scale-up] " + " [partition] " + partition.getId() + " [cluster] " + clusterId );
+ $delegator.delegateSpawn($networkPartitionContext.getPartitionCtxt(partition.getId()), clusterId, lbRef, isPrimary);
+ }
+ } else if(scaleDown){
+
+ log.debug("[scale-down] Decided to Scale down [cluster] " + clusterId);
+ if($networkPartitionContext.getScaleDownRequestsCount() > 5 ){
+ log.debug("[scale-down] Reached scale down requests threshold [cluster] " + clusterId + " Count " + $networkPartitionContext.getScaleDownRequestsCount());
+ $networkPartitionContext.resetScaleDownRequestsCount();
+ MemberStatsContext selectedMemberStatsContext = null;
+ double lowestOverallLoad = 0.0;
+ boolean foundAValue = false;
+ Partition partition = autoscaleAlgorithm.getNextScaleDownPartition($networkPartitionContext, clusterId);
+ if(partition != null){
+ log.info("[scale-down] Partition available to scale down ");
+ log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] " + clusterId);
+ partitionContext = $networkPartitionContext.getPartitionCtxt(partition.getId());
+
+
+ // In partition context member stat context, all the primary members need to be
+ // avoided being selected as the member to terminated
+
+
+ for(MemberStatsContext memberStatsContext: partitionContext.getMemberStatsContexts().values()){
+
+ if( !primaryMembers.contains(memberStatsContext.getMemberId()) ) {
+
+ LoadAverage loadAverage = memberStatsContext.getLoadAverage();
+ log.debug("[scale-down] " + " [cluster] "
+ + clusterId + " [member] " + memberStatsContext.getMemberId() + " Load average: " + loadAverage);
+
+ MemoryConsumption memoryConsumption = memberStatsContext.getMemoryConsumption();
+ log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
+ + clusterId + " [member] " + memberStatsContext.getMemberId() + " Memory consumption: " + memoryConsumption);
+
+ double predictedCpu = $delegator.getPredictedValueForNextMinute(loadAverage.getAverage(),loadAverage.getGradient(),loadAverage.getSecondDerivative(), 1);
+ log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
+ + clusterId + " [member] " + memberStatsContext.getMemberId() + " Predicted CPU: " + predictedCpu);
+
+ double predictedMemoryConsumption = $delegator.getPredictedValueForNextMinute(memoryConsumption.getAverage(),memoryConsumption.getGradient(),memoryConsumption.getSecondDerivative(), 1);
+ log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
+ + clusterId + " [member] " + memberStatsContext.getMemberId() + " Predicted memory consumption: " + predictedMemoryConsumption);
+
+ double overallLoad = (predictedCpu + predictedMemoryConsumption) / 2;
+ log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
+ + clusterId + " [member] " + memberStatsContext.getMemberId() + " Overall load: " + overallLoad);
+
+ if(!foundAValue){
+ foundAValue = true;
+ selectedMemberStatsContext = memberStatsContext;
+ lowestOverallLoad = overallLoad;
+ } else if(overallLoad < lowestOverallLoad){
+ selectedMemberStatsContext = memberStatsContext;
+ lowestOverallLoad = overallLoad;
+ }
+
+
+ }
+
+ }
+ if(selectedMemberStatsContext != null) {
+ log.info("[scale-down] Trying to terminating an instace to scale down!" );
+ log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
+ + clusterId + " Member with lowest overall load: " + selectedMemberStatsContext.getMemberId());
+
+ $delegator.delegateTerminate(partitionContext, selectedMemberStatsContext.getMemberId());
+ }
+ }
+ } else{
+ log.debug("[scale-down] Not reached scale down requests threshold. " + clusterId + " Count " + $networkPartitionContext.getScaleDownRequestsCount());
+ $networkPartitionContext.increaseScaleDownRequestsCount();
+
+ }
+ } else{
+ log.debug("[scaling] No decision made to either scale up or scale down ... ");
+
+ }
+
+end
+
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/drools/terminateall.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/terminateall.drl b/products/stratos/modules/distribution/src/main/conf/drools/terminateall.drl
new file mode 100644
index 0000000..75c26fc
--- /dev/null
+++ b/products/stratos/modules/distribution/src/main/conf/drools/terminateall.drl
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.autoscaler.rule;
+
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.autoscaler.PartitionContext;
+
+global org.apache.stratos.autoscaler.rule.RuleLog log;
+global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
+
+rule "Terminate all Rule"
+
+dialect "mvel"
+ when
+ $ctxt : PartitionContext ()
+ eval(log.debug("Running terminate all rule: [partition] " + $ctxt.getPartitionId() + " [network-partition] " + $ctxt.getNetworkPartitionId()))
+ eval(log.debug("[terminate all] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() +" Member count: " + $ctxt.getMemberStatsContexts().size()))
+ eval($ctxt.getMemberStatsContexts().size() > 0)
+ memberId : String() from $ctxt.getMemberStatsContexts().keySet()
+ eval(log.debug("[terminate all] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Member id: " + memberId))
+
+ then
+ $delegator.delegateTerminate($ctxt, memberId);
+end
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/mincheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/mincheck.drl b/products/stratos/modules/distribution/src/main/conf/mincheck.drl
deleted file mode 100755
index 71187d6..0000000
--- a/products/stratos/modules/distribution/src/main/conf/mincheck.drl
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.autoscaler.AutoscalerContext;
-import org.apache.stratos.autoscaler.Constants;
-import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
-import org.apache.stratos.autoscaler.policy.model.RequestsInFlight;
-import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
-import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
-import org.apache.stratos.autoscaler.algorithm.AutoscaleAlgorithm;
-import org.apache.stratos.autoscaler.algorithm.OneAfterAnother;
-import org.apache.stratos.autoscaler.algorithm.RoundRobin;
-import org.apache.stratos.autoscaler.PartitionContext;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
-import org.apache.commons.logging.Log;
-import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
-import org.apache.stratos.autoscaler.partition.PartitionGroup;
-import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition;
-import org.apache.stratos.cloud.controller.stub.pojo.MemberContext;
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.policy.PolicyManager $manager;
-global org.apache.stratos.autoscaler.AutoscalerContext $context;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
-global org.apache.stratos.messaging.domain.topology.Topology $topology;
-global java.util.Map partitionCtxts;
-global java.lang.String clusterId;
-global java.lang.String lbRef;
-global java.lang.Boolean isPrimary;
-global Integer primaryMemberCount;
-
-rule "Minimum Rule"
-dialect "mvel"
- when
- $ctxt : PartitionContext ()
- eval(log.debug("Running minimum rule: [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId()))
- eval(log.debug("[min-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Non terminated member count: " + $ctxt.getNonTerminatedMemberCount()))
- eval(log.debug("[min-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Minimum member count: " + $ctxt.getMinimumMemberCount()))
- eval ( (isPrimary && (primaryMemberCount < $ctxt.getMinimumMemberCount() )) || ( !isPrimary && ($ctxt.getNonTerminatedMemberCount() < $ctxt.getMinimumMemberCount() )) )
- then
- if (isPrimary){
- log.debug("[min-check] true [primary] true [primary member count] " + primaryMemberCount);
- } else{
- log.debug("[min-check] true [primary] false");
- }
- $delegator.delegateSpawn($ctxt, clusterId, lbRef, isPrimary);
-end
-
-rule "Terminate Obsoleted Instances"
-dialect "mvel"
- when
- $ctxt : PartitionContext ()
- eval(log.debug("Running obsolete instances rule: [partition] " + $ctxt.getPartitionId() + " [network-partition] " + $ctxt.getNetworkPartitionId()))
- eval(log.debug("[obsolete-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() +" Obsolete member count: " + $ctxt.getObsoletedMembers().size()))
- eval($ctxt.getObsoletedMembers().keySet().size() > 0)
- memberId : String() from $ctxt.getObsoletedMembers().keySet()
- eval(log.debug("[obsolete-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Member id: " + memberId))
- then
- $delegator.terminateObsoleteInstance(memberId);
-end
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/scaling.drl b/products/stratos/modules/distribution/src/main/conf/scaling.drl
deleted file mode 100644
index bd331e7..0000000
--- a/products/stratos/modules/distribution/src/main/conf/scaling.drl
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.autoscaler.AutoscalerContext;
-import org.apache.stratos.autoscaler.MemberStatsContext;
-import org.apache.stratos.autoscaler.Constants;
-import org.apache.stratos.autoscaler.NetworkPartitionContext;
-import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
-import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
-import org.apache.stratos.autoscaler.policy.model.RequestsInFlight;
-import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
-import org.apache.stratos.autoscaler.policy.model.MemoryConsumption;
-import org.apache.stratos.autoscaler.policy.model.LoadAverage;
-import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
-import org.apache.stratos.autoscaler.algorithm.AutoscaleAlgorithm;
-import org.apache.stratos.autoscaler.algorithm.OneAfterAnother;
-import org.apache.stratos.autoscaler.algorithm.RoundRobin;
-import org.apache.stratos.autoscaler.PartitionContext;
-import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
-import org.apache.stratos.autoscaler.partition.PartitionGroup;
-import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition;
-import org.apache.stratos.cloud.controller.stub.pojo.MemberContext;
-
-import org.apache.stratos.autoscaler.policy.model.LoadAverage
-import org.apache.stratos.autoscaler.policy.model.MemoryConsumption
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
-global org.apache.stratos.autoscaler.policy.model.AutoscalePolicy autoscalePolicy;
-global java.lang.String clusterId;
-global java.lang.String lbRef;
-global java.lang.Boolean rifReset;
-global java.lang.Boolean mcReset;
-global java.lang.Boolean laReset;
-global java.lang.Boolean isPrimary;
-global java.util.List primaryMembers;
-
-rule "Scaling Rule"
-dialect "mvel"
- when
- $networkPartitionContext : NetworkPartitionContext ()
-
- $loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds()
- algorithmName : String() from $networkPartitionContext.getPartitionAlgorithm();
- autoscaleAlgorithm : AutoscaleAlgorithm() from $delegator.getAutoscaleAlgorithm(algorithmName)
-
- eval(log.debug("Running scale up rule: [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId))
- eval(log.debug("[scaling] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm name: " + algorithmName))
- eval(log.debug("[scaling] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm: " + autoscaleAlgorithm))
-
-
- rifUpperLimit : Float() from $loadThresholds.getRequestsInFlight().getUpperLimit()
- rifLowerLimit : Float() from $loadThresholds.getRequestsInFlight().getLowerLimit()
-
- rifAverage : Float() from $networkPartitionContext.getAverageRequestsInFlight()
- rifGradient : Float() from $networkPartitionContext.getRequestsInFlightGradient()
- rifSecondDerivative : Float() from $networkPartitionContext.getRequestsInFlightSecondDerivative()
- rifPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(rifAverage, rifGradient, rifSecondDerivative, 1)
-
- mcUpperLimit : Float() from $loadThresholds.getMemoryConsumption().getUpperLimit()
- mcLowerLimit : Float() from $loadThresholds.getMemoryConsumption().getLowerLimit()
-
- memoryConsumptionAverage : Float() from $networkPartitionContext.getAverageMemoryConsumption()
- memoryConsumptionGradient : Float() from $networkPartitionContext.getMemoryConsumptionGradient()
- memoryConsumptionSecondDerivative : Float() from $networkPartitionContext.getMemoryConsumptionSecondDerivative()
- mcPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(memoryConsumptionAverage, memoryConsumptionGradient, memoryConsumptionSecondDerivative, 1)
-
- laUpperLimit : Float() from $loadThresholds.getLoadAverage().getUpperLimit()
- laLowerLimit : Float() from $loadThresholds.getLoadAverage().getLowerLimit()
-
- loadAverageAverage : Float() from $networkPartitionContext.getAverageLoadAverage()
- loadAverageGradient : Float() from $networkPartitionContext.getLoadAverageGradient()
- loadAverageSecondDerivative : Float() from $networkPartitionContext.getLoadAverageSecondDerivative()
- laPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(loadAverageAverage, loadAverageGradient, loadAverageSecondDerivative, 1)
-
- scaleUp : Boolean() from ((rifReset && (rifPredictedValue > rifUpperLimit)) || (mcReset && (mcPredictedValue > mcUpperLimit)) || (laReset && (laPredictedValue > laUpperLimit)))
- scaleDown : Boolean() from ((rifReset && (rifPredictedValue < rifLowerLimit )) && (mcReset && (mcPredictedValue < mcLowerLimit)) && (laReset && (laPredictedValue < laLowerLimit)))
-
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " RIF Resetted?: " + rifReset))
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " RIF predicted value: " + rifPredictedValue))
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " RIF upper limit: " + rifUpperLimit))
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " RIF lower limit: " + rifLowerLimit))
-
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " MC predicted value: " + mcPredictedValue))
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " MC upper limit: " + mcUpperLimit))
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " MC lower limit: " + mcLowerLimit))
-
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " LA predicted value: " + laPredictedValue))
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " LA upper limit: " + laUpperLimit))
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " LA lower limit: " + laLowerLimit))
-
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " Scale-up action: " + scaleUp))
- eval(log.debug("[scaling] " + " [cluster] " + clusterId + " Scale-down action: " + scaleDown))
-
- then
- if(scaleUp){
-
- $networkPartitionContext.resetScaleDownRequestsCount();
- Partition partition = autoscaleAlgorithm.getNextScaleUpPartition($networkPartitionContext, clusterId);
- if(partition != null){
- log.info("[scale-up] Partition available, hence trying to spawn an instance to scale up!" );
- log.debug("[scale-up] " + " [partition] " + partition.getId() + " [cluster] " + clusterId );
- $delegator.delegateSpawn($networkPartitionContext.getPartitionCtxt(partition.getId()), clusterId, lbRef, isPrimary);
- }
- } else if(scaleDown){
-
- log.debug("[scale-down] Decided to Scale down [cluster] " + clusterId);
- if($networkPartitionContext.getScaleDownRequestsCount() > 5 ){
- log.debug("[scale-down] Reached scale down requests threshold [cluster] " + clusterId + " Count " + $networkPartitionContext.getScaleDownRequestsCount());
- $networkPartitionContext.resetScaleDownRequestsCount();
- MemberStatsContext selectedMemberStatsContext = null;
- double lowestOverallLoad = 0.0;
- boolean foundAValue = false;
- Partition partition = autoscaleAlgorithm.getNextScaleDownPartition($networkPartitionContext, clusterId);
- if(partition != null){
- log.info("[scale-down] Partition available to scale down ");
- log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] " + clusterId);
- partitionContext = $networkPartitionContext.getPartitionCtxt(partition.getId());
-
-
- // In partition context member stat context, all the primary members need to be
- // avoided being selected as the member to terminated
-
-
- for(MemberStatsContext memberStatsContext: partitionContext.getMemberStatsContexts().values()){
-
- if( !primaryMembers.contains(memberStatsContext.getMemberId()) ) {
-
- LoadAverage loadAverage = memberStatsContext.getLoadAverage();
- log.debug("[scale-down] " + " [cluster] "
- + clusterId + " [member] " + memberStatsContext.getMemberId() + " Load average: " + loadAverage);
-
- MemoryConsumption memoryConsumption = memberStatsContext.getMemoryConsumption();
- log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
- + clusterId + " [member] " + memberStatsContext.getMemberId() + " Memory consumption: " + memoryConsumption);
-
- double predictedCpu = $delegator.getPredictedValueForNextMinute(loadAverage.getAverage(),loadAverage.getGradient(),loadAverage.getSecondDerivative(), 1);
- log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
- + clusterId + " [member] " + memberStatsContext.getMemberId() + " Predicted CPU: " + predictedCpu);
-
- double predictedMemoryConsumption = $delegator.getPredictedValueForNextMinute(memoryConsumption.getAverage(),memoryConsumption.getGradient(),memoryConsumption.getSecondDerivative(), 1);
- log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
- + clusterId + " [member] " + memberStatsContext.getMemberId() + " Predicted memory consumption: " + predictedMemoryConsumption);
-
- double overallLoad = (predictedCpu + predictedMemoryConsumption) / 2;
- log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
- + clusterId + " [member] " + memberStatsContext.getMemberId() + " Overall load: " + overallLoad);
-
- if(!foundAValue){
- foundAValue = true;
- selectedMemberStatsContext = memberStatsContext;
- lowestOverallLoad = overallLoad;
- } else if(overallLoad < lowestOverallLoad){
- selectedMemberStatsContext = memberStatsContext;
- lowestOverallLoad = overallLoad;
- }
-
-
- }
-
- }
- if(selectedMemberStatsContext != null) {
- log.info("[scale-down] Trying to terminating an instace to scale down!" );
- log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
- + clusterId + " Member with lowest overall load: " + selectedMemberStatsContext.getMemberId());
-
- $delegator.delegateTerminate(partitionContext, selectedMemberStatsContext.getMemberId());
- }
- }
- } else{
- log.debug("[scale-down] Not reached scale down requests threshold. " + clusterId + " Count " + $networkPartitionContext.getScaleDownRequestsCount());
- $networkPartitionContext.increaseScaleDownRequestsCount();
-
- }
- } else{
- log.debug("[scaling] No decision made to either scale up or scale down ... ");
-
- }
-
-end
-
-
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/d189b136/products/stratos/modules/distribution/src/main/conf/terminateall.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/terminateall.drl b/products/stratos/modules/distribution/src/main/conf/terminateall.drl
deleted file mode 100644
index 75c26fc..0000000
--- a/products/stratos/modules/distribution/src/main/conf/terminateall.drl
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.autoscaler.PartitionContext;
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator $delegator;
-
-rule "Terminate all Rule"
-
-dialect "mvel"
- when
- $ctxt : PartitionContext ()
- eval(log.debug("Running terminate all rule: [partition] " + $ctxt.getPartitionId() + " [network-partition] " + $ctxt.getNetworkPartitionId()))
- eval(log.debug("[terminate all] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() +" Member count: " + $ctxt.getMemberStatsContexts().size()))
- eval($ctxt.getMemberStatsContexts().size() > 0)
- memberId : String() from $ctxt.getMemberStatsContexts().keySet()
- eval(log.debug("[terminate all] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Member id: " + memberId))
-
- then
- $delegator.delegateTerminate($ctxt, memberId);
-end
-
-
-
[3/3] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/stratos
Posted by ra...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/stratos
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7d4abd0b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7d4abd0b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7d4abd0b
Branch: refs/heads/master
Commit: 7d4abd0bc59dbf38ffc49f4513d9f0a44d06e44c
Parents: d189b13 a2c6200
Author: R-Rajkumar <rr...@gmail.com>
Authored: Tue Oct 14 19:57:23 2014 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Tue Oct 14 19:57:23 2014 +0530
----------------------------------------------------------------------
.../autoscaler/api/AutoScalerServiceImpl.java | 2 +-
.../exception/InvalidArgumentException.java | 46 +
.../interfaces/AutoScalerServiceInterface.java | 2 +-
.../monitor/AbstractClusterMonitor.java | 3 +-
.../KubernetesServiceClusterMonitor.java | 13 +-
.../autoscaler/monitor/VMLbClusterMonitor.java | 3 +-
.../monitor/VMServiceClusterMonitor.java | 3 +-
.../impl/CloudControllerServiceImpl.java | 3 +
.../manager/client/AutoscalerServiceClient.java | 2 +-
.../rest/endpoint/services/ServiceUtils.java | 9 +-
.../src/main/resources/AutoScalerService.wsdl | 1222 +++++++++---------
11 files changed, 698 insertions(+), 610 deletions(-)
----------------------------------------------------------------------