You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/12/07 13:40:34 UTC

[01/16] stratos git commit: Make cluster monitors to use Cluster as their constructor argument.

Repository: stratos
Updated Branches:
  refs/heads/master 283d21d95 -> b098d8a32


Make cluster monitors to use Cluster as their constructor argument.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c1ad7a52
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c1ad7a52
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c1ad7a52

Branch: refs/heads/master
Commit: c1ad7a52b0fc54f640d7db476ac7ddaaf15bbacc
Parents: 93e7500
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Fri Dec 5 23:04:00 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 17:59:31 2014 +0530

----------------------------------------------------------------------
 .../monitor/cluster/AbstractClusterMonitor.java |  18 +-
 .../monitor/cluster/ClusterMonitorFactory.java  |  93 +-
 .../cluster/KubernetesClusterMonitor.java       | 847 +++++++++----------
 .../KubernetesServiceClusterMonitor.java        | 322 +++----
 .../monitor/cluster/VMClusterMonitor.java       |   4 +-
 .../autoscaler/rule/RuleTasksDelegator.java     |  66 +-
 .../messaging/domain/topology/Cluster.java      |  25 +
 .../modules/distribution/container-mincheck.drl |  54 ++
 8 files changed, 776 insertions(+), 653 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/c1ad7a52/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java
index 19905b1..edfe063 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java
@@ -35,6 +35,7 @@ import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
 import org.apache.stratos.messaging.domain.applications.Group;
 import org.apache.stratos.messaging.domain.applications.GroupStatus;
 import org.apache.stratos.messaging.domain.instance.ClusterInstance;
+import org.apache.stratos.messaging.domain.topology.Cluster;
 import org.apache.stratos.messaging.domain.topology.ClusterStatus;
 import org.apache.stratos.messaging.event.health.stat.*;
 import org.apache.stratos.messaging.event.topology.*;
@@ -68,16 +69,17 @@ public abstract class AbstractClusterMonitor extends Monitor implements Runnable
     protected String serviceType;
     private AtomicBoolean monitoringStarted;
     private String clusterId;
+    private Cluster cluster;
     private ClusterStatus status;
     private int monitoringIntervalMilliseconds;
     private boolean isDestroyed;
 
-    protected AbstractClusterMonitor(String serviceType, String clusterId) {
+    protected AbstractClusterMonitor(Cluster cluster) {
 
         super();
-        this.serviceType = serviceType;
-        this.clusterId = clusterId;
-        this.autoscalerRuleEvaluator = autoscalerRuleEvaluator;
+        this.setCluster(new Cluster(cluster));
+        this.serviceType = cluster.getServiceName();
+        this.clusterId = cluster.getClusterId();
         this.monitoringStarted = new AtomicBoolean(false);
         //this.clusterContext = abstractClusterContext;
         //this.instanceIdToClusterContextMap = new HashMap<String, AbstractClusterContext>();
@@ -407,6 +409,14 @@ public abstract class AbstractClusterMonitor extends Monitor implements Runnable
     public void setClusterContext(AbstractClusterContext clusterContext) {
         this.clusterContext = clusterContext;
     }
+    
+    public Cluster getCluster() {
+        return cluster;
+    }
+
+    public void setCluster(Cluster cluster) {
+        this.cluster = cluster;
+    }
 
 
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/c1ad7a52/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java
index 618c15a..cba5357 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java
@@ -21,6 +21,7 @@ package org.apache.stratos.autoscaler.monitor.cluster;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.autoscaler.context.cluster.VMClusterContext;
 import org.apache.stratos.autoscaler.exception.partition.PartitionValidationException;
 import org.apache.stratos.autoscaler.exception.policy.PolicyValidationException;
 import org.apache.stratos.cloud.controller.stub.domain.MemberContext;
@@ -48,8 +49,8 @@ public class ClusterMonitorFactory {
         AbstractClusterMonitor clusterMonitor;
 //        if (cluster.isKubernetesCluster()) {
 //            clusterMonitor = getDockerServiceClusterMonitor(cluster);
-////        } else if (cluster.isLbCluster()) {
-////            clusterMonitor = getVMLbClusterMonitor(cluster);
+//////        } else if (cluster.isLbCluster()) {
+//////            clusterMonitor = getVMLbClusterMonitor(cluster);
 //        } else {
             clusterMonitor = getVMClusterMonitor(cluster);
 //        }
@@ -64,7 +65,7 @@ public class ClusterMonitorFactory {
             return null;
         }
 
-        VMClusterMonitor clusterMonitor = new VMClusterMonitor(cluster.getServiceName(), cluster.getClusterId());
+        VMClusterMonitor clusterMonitor = new VMClusterMonitor(cluster);
 
         // find lb reference type
         java.util.Properties props = cluster.getProperties();
@@ -107,7 +108,7 @@ public class ClusterMonitorFactory {
      * @param cluster - the cluster which needs to be monitored
      * @return - the cluster monitor
      */
-    private static KubernetesServiceClusterMonitor getDockerServiceClusterMonitor(Cluster cluster)
+    private static KubernetesClusterMonitor getDockerServiceClusterMonitor(Cluster cluster)
             throws PolicyValidationException {
 
         if (null == cluster) {
@@ -155,50 +156,50 @@ public class ClusterMonitorFactory {
 //                cluster.getClusterId(), cluster.getServiceName(),  autoscalePolicy, minReplicas, maxReplicas);
 
 
-        KubernetesServiceClusterMonitor dockerClusterMonitor = new KubernetesServiceClusterMonitor(cluster.getServiceName(), cluster.getClusterId());
+        KubernetesClusterMonitor dockerClusterMonitor = new KubernetesClusterMonitor(cluster);
 
         //populate the members after restarting
-        for (Member member : cluster.getMembers()) {
-            String memberId = member.getMemberId();
-            String clusterId = member.getClusterId();
-            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));
-            }
-        }
-
-        // find lb reference type
-        if (properties.containsKey(StratosConstants.LOAD_BALANCER_REF)) {
-            String value = properties.getProperty(StratosConstants.LOAD_BALANCER_REF);
-            dockerClusterMonitor.setLbReferenceType(value);
-            if (log.isDebugEnabled()) {
-                log.debug("Set the lb reference type: " + value);
-            }
-        }
+//        for (Member member : cluster.getMembers()) {
+//            String memberId = member.getMemberId();
+//            String clusterId = member.getClusterId();
+//            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);
+//                }
+//                ((VMClusterContext) dockerClusterMonitor.getClusterContext()).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));
+//            }
+//        }
+//
+//        // find lb reference type
+//        if (properties.containsKey(StratosConstants.LOAD_BALANCER_REF)) {
+//            String value = properties.getProperty(StratosConstants.LOAD_BALANCER_REF);
+//            dockerClusterMonitor.setLbReferenceType(value);
+//            if (log.isDebugEnabled()) {
+//                log.debug("Set the lb reference type: " + value);
+//            }
+//        }
 
         log.info("KubernetesServiceClusterMonitor created: " + dockerClusterMonitor.toString());
         return dockerClusterMonitor;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c1ad7a52/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesClusterMonitor.java
index b5d6da3..c2b0f31 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesClusterMonitor.java
@@ -58,16 +58,15 @@ import org.drools.runtime.StatefulKnowledgeSession;
 /*
  * Every kubernetes cluster monitor should extend this class
  */
-public abstract class KubernetesClusterMonitor extends AbstractClusterMonitor {
+public class KubernetesClusterMonitor extends VMClusterMonitor {
 
     private static final Log log = LogFactory.getLog(KubernetesClusterMonitor.class);
 
-    private StatefulKnowledgeSession dependentScaleCheckKnowledgeSession;
+//    private StatefulKnowledgeSession dependentScaleCheckKnowledgeSession;
 
-    protected KubernetesClusterMonitor(String serviceType, String clusterId,
-                                       AutoscalerRuleEvaluator autoscalerRuleEvaluator) {
+    protected KubernetesClusterMonitor(Cluster cluster) {
 
-        super(serviceType, clusterId);
+        super(cluster);
 
         autoscalerRuleEvaluator = new AutoscalerRuleEvaluator();
         autoscalerRuleEvaluator.parseAndBuildKnowledgeBaseForDroolsFile(StratosConstants.CONTAINER_OBSOLETE_CHECK_DROOL_FILE);
@@ -87,431 +86,431 @@ public abstract class KubernetesClusterMonitor extends AbstractClusterMonitor {
         //this.kubernetesClusterCtxt = kubernetesClusterContext;
     }
 
-    @Override
-    public void handleAverageLoadAverageEvent(
-            AverageLoadAverageEvent averageLoadAverageEvent) {
-
-        String clusterId = averageLoadAverageEvent.getClusterId();
-        float value = averageLoadAverageEvent.getValue();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Avg load avg event: [cluster] %s [value] %s",
-                                    clusterId, value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setAverageLoadAverage(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-
-    }
-
-    @Override
-    public void handleGradientOfLoadAverageEvent(
-            GradientOfLoadAverageEvent gradientOfLoadAverageEvent) {
-
-        String clusterId = gradientOfLoadAverageEvent.getClusterId();
-        float value = gradientOfLoadAverageEvent.getValue();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Grad of load avg event: [cluster] %s [value] %s",
-                                    clusterId, value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setLoadAverageGradient(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-    }
-
-    @Override
-    public void handleSecondDerivativeOfLoadAverageEvent(
-            SecondDerivativeOfLoadAverageEvent secondDerivativeOfLoadAverageEvent) {
-
-        String clusterId = secondDerivativeOfLoadAverageEvent.getClusterId();
-        float value = secondDerivativeOfLoadAverageEvent.getValue();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Second Derivation of load avg event: [cluster] %s "
-                                    + "[value] %s", clusterId, value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setLoadAverageSecondDerivative(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-    }
-
-    @Override
-    public void handleAverageMemoryConsumptionEvent(
-            AverageMemoryConsumptionEvent averageMemoryConsumptionEvent) {
-
-        String clusterId = averageMemoryConsumptionEvent.getClusterId();
-        float value = averageMemoryConsumptionEvent.getValue();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Avg Memory Consumption event: [cluster] %s "
-                                    + "[value] %s", averageMemoryConsumptionEvent.getClusterId(), value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setAverageMemoryConsumption(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-    }
-
-    @Override
-    public void handleGradientOfMemoryConsumptionEvent(
-            GradientOfMemoryConsumptionEvent gradientOfMemoryConsumptionEvent) {
-
-        String clusterId = gradientOfMemoryConsumptionEvent.getClusterId();
-        float value = gradientOfMemoryConsumptionEvent.getValue();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Grad of Memory Consumption event: [cluster] %s "
-                                    + "[value] %s", clusterId, value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setMemoryConsumptionGradient(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-    }
-
-    @Override
-    public void handleSecondDerivativeOfMemoryConsumptionEvent(
-            SecondDerivativeOfMemoryConsumptionEvent secondDerivativeOfMemoryConsumptionEvent) {
-
-        String clusterId = secondDerivativeOfMemoryConsumptionEvent.getClusterId();
-        float value = secondDerivativeOfMemoryConsumptionEvent.getValue();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Second Derivation of Memory Consumption event: [cluster] %s "
-                                    + "[value] %s", clusterId, value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setMemoryConsumptionSecondDerivative(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-    }
-
-    @Override
-    public void handleAverageRequestsInFlightEvent(
-            AverageRequestsInFlightEvent averageRequestsInFlightEvent) {
-
-        float value = averageRequestsInFlightEvent.getValue();
-        String clusterId = averageRequestsInFlightEvent.getClusterId();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Average Rif event: [cluster] %s [value] %s",
-                                    clusterId, value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setAverageRequestsInFlight(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-    }
-
-    @Override
-    public void handleGradientOfRequestsInFlightEvent(
-            GradientOfRequestsInFlightEvent gradientOfRequestsInFlightEvent) {
-
-        String clusterId = gradientOfRequestsInFlightEvent.getClusterId();
-        float value = gradientOfRequestsInFlightEvent.getValue();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Gradient of Rif event: [cluster] %s [value] %s",
-                                    clusterId, value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setRequestsInFlightGradient(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-    }
-
-    @Override
-    public void handleSecondDerivativeOfRequestsInFlightEvent(
-            SecondDerivativeOfRequestsInFlightEvent secondDerivativeOfRequestsInFlightEvent) {
-
-        String clusterId = secondDerivativeOfRequestsInFlightEvent.getClusterId();
-        float value = secondDerivativeOfRequestsInFlightEvent.getValue();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Second derivative of Rif event: [cluster] %s "
-                                    + "[value] %s", clusterId, value));
-        }
-        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
-        if (null != kubernetesClusterContext) {
-            kubernetesClusterContext.setRequestsInFlightSecondDerivative(value);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Kubernetes cluster context is not available for :" +
-                                        " [cluster] %s", clusterId));
-            }
-        }
-    }
-
-    @Override
-    public void handleMemberAverageMemoryConsumptionEvent(
-            MemberAverageMemoryConsumptionEvent memberAverageMemoryConsumptionEvent) {
-
-        String memberId = memberAverageMemoryConsumptionEvent.getMemberId();
-        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
-        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
-        if (null == memberStatsContext) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member context is not available for : [member] %s", memberId));
-            }
-            return;
-        }
-        float value = memberAverageMemoryConsumptionEvent.getValue();
-        memberStatsContext.setAverageMemoryConsumption(value);
-    }
-
-    @Override
-    public void handleMemberGradientOfMemoryConsumptionEvent(
-            MemberGradientOfMemoryConsumptionEvent memberGradientOfMemoryConsumptionEvent) {
-
-        String memberId = memberGradientOfMemoryConsumptionEvent.getMemberId();
-        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
-        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
-        if (null == memberStatsContext) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member context is not available for : [member] %s", memberId));
-            }
-            return;
-        }
-        float value = memberGradientOfMemoryConsumptionEvent.getValue();
-        memberStatsContext.setGradientOfMemoryConsumption(value);
-    }
-
-    @Override
-    public void handleMemberSecondDerivativeOfMemoryConsumptionEvent(
-            MemberSecondDerivativeOfMemoryConsumptionEvent memberSecondDerivativeOfMemoryConsumptionEvent) {
-
-    }
-
-    @Override
-    public void handleMemberAverageLoadAverageEvent(
-            MemberAverageLoadAverageEvent memberAverageLoadAverageEvent) {
-
-        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
-        String memberId = memberAverageLoadAverageEvent.getMemberId();
-        float value = memberAverageLoadAverageEvent.getValue();
-        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
-        if (null == memberStatsContext) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member context is not available for : [member] %s", memberId));
-            }
-            return;
-        }
-        memberStatsContext.setAverageLoadAverage(value);
-    }
-
-    @Override
-    public void handleMemberGradientOfLoadAverageEvent(
-            MemberGradientOfLoadAverageEvent memberGradientOfLoadAverageEvent) {
-
-        String memberId = memberGradientOfLoadAverageEvent.getMemberId();
-        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
-        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
-        if (null == memberStatsContext) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member context is not available for : [member] %s", memberId));
-            }
-            return;
-        }
-        float value = memberGradientOfLoadAverageEvent.getValue();
-        memberStatsContext.setGradientOfLoadAverage(value);
-    }
-
-    @Override
-    public void handleMemberSecondDerivativeOfLoadAverageEvent(
-            MemberSecondDerivativeOfLoadAverageEvent memberSecondDerivativeOfLoadAverageEvent) {
-
-        String memberId = memberSecondDerivativeOfLoadAverageEvent.getMemberId();
-        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
-        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
-        if (null == memberStatsContext) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member context is not available for : [member] %s", memberId));
-            }
-            return;
-        }
-        float value = memberSecondDerivativeOfLoadAverageEvent.getValue();
-        memberStatsContext.setSecondDerivativeOfLoadAverage(value);
-    }
-
-    @Override
-    public void handleMemberFaultEvent(MemberFaultEvent memberFaultEvent) {
-    	// kill the container
-        String memberId = memberFaultEvent.getMemberId();
-        Member member = getMemberByMemberId(memberId);
-        if (null == member) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member not found in the Topology: [member] %s", memberId));
-            }
-            return;
-        }
-        if (!member.isActive()) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member activated event has not received for the member %s. "
-                                        + "Therefore ignoring" + " the member fault health stat", memberId));
-            }
-            return;
-        }
-
-        if (!getKubernetesClusterCtxt().activeMemberExist(memberId)) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Could not find the active member in kubernetes cluster context, "
-                                        + "[member] %s ", memberId));
-            }
-            return;
-        }
-
-        // move member to obsolete list
-        getKubernetesClusterCtxt().moveMemberToObsoleteList(memberId);
-        if (log.isInfoEnabled()) {
-            String clusterId = memberFaultEvent.getClusterId();
-            String kubernetesClusterID = getKubernetesClusterCtxt().getKubernetesClusterID();
-            log.info(String.format("Faulty member is moved to obsolete list and removed from the active members list: "
-                    + "[member] %s [kub-cluster] %s [cluster] %s ", memberId, kubernetesClusterID, clusterId));
-        }
-    }
-
-    @Override
-    public void handleMemberStartedEvent(
-            MemberStartedEvent memberStartedEvent) {
-
-    }
-
-    @Override
-    public void handleMemberActivatedEvent(
-            MemberActivatedEvent memberActivatedEvent) {
-
-        KubernetesClusterContext kubernetesClusterContext;
-        kubernetesClusterContext = getKubernetesClusterCtxt();
-        String memberId = memberActivatedEvent.getMemberId();
-        kubernetesClusterContext.addMemberStatsContext(new MemberStatsContext(memberId));
-        if (log.isInfoEnabled()) {
-            log.info(String.format("Member stat context has been added successfully: "
-                                   + "[member] %s", memberId));
-        }
-        kubernetesClusterContext.movePendingMemberToActiveMembers(memberId);
-    }
-
-    @Override
-    public void handleMemberMaintenanceModeEvent(
-            MemberMaintenanceModeEvent maintenanceModeEvent) {
-
-        // no need to do anything here
-        // we will not be receiving this event for containers
-        // we will only receive member terminated event
-    }
-
-    @Override
-    public void handleMemberReadyToShutdownEvent(
-            MemberReadyToShutdownEvent memberReadyToShutdownEvent) {
-
-        // no need to do anything here
-        // we will not be receiving this event for containers
-    	// we will only receive member terminated event
-    }
-
-    @Override
-    public void handleMemberTerminatedEvent(
-            MemberTerminatedEvent memberTerminatedEvent) {
-
-        String memberId = memberTerminatedEvent.getMemberId();
-        if (getKubernetesClusterCtxt().removeTerminationPendingMember(memberId)) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member is removed from termination pending members list: "
-                                        + "[member] %s", memberId));
-            }
-        } else if (getKubernetesClusterCtxt().removePendingMember(memberId)) {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Member is removed from pending members list: "
-                                        + "[member] %s", memberId));
-            }
-        } else if (getKubernetesClusterCtxt().removeActiveMemberById(memberId)) {
-            log.warn(String.format("Member is in the wrong list and it is removed from "
-                                   + "active members list: %s", memberId));
-        } else if (getKubernetesClusterCtxt().removeObsoleteMember(memberId)) {
-            log.warn(String.format("Obsolete member has either been terminated or its obsolete time out has expired and"
-                                   + " it is removed from obsolete members list: %s", memberId));
-        } else {
-            log.warn(String.format("Member is not available in any of the list active, "
-                                   + "pending and termination pending: %s", memberId));
-        }
-
-        if (log.isInfoEnabled()) {
-            log.info(String.format("Member stat context has been removed successfully: "
-                                   + "[member] %s", memberId));
-        }
-    }
-
-    @Override
-    public void handleClusterRemovedEvent(
-            ClusterRemovedEvent clusterRemovedEvent) {
-    	getKubernetesClusterCtxt().getPendingMembers().clear();
-    	getKubernetesClusterCtxt().getActiveMembers().clear();
-    	getKubernetesClusterCtxt().getTerminationPendingMembers().clear();
-    	getKubernetesClusterCtxt().getObsoletedMembers().clear();
-    }
-
-    public KubernetesClusterContext getKubernetesClusterCtxt() {
-        return (KubernetesClusterContext) getClusterContext();
-    }
-
-    private Member getMemberByMemberId(String memberId) {
-        try {
-            TopologyManager.acquireReadLock();
-            for (Service service : TopologyManager.getTopology().getServices()) {
-                for (Cluster cluster : service.getClusters()) {
-                    if (cluster.memberExists(memberId)) {
-                        return cluster.getMember(memberId);
-                    }
-                }
-            }
-            return null;
-        } finally {
-            TopologyManager.releaseReadLock();
-        }
-    }
+//    @Override
+//    public void handleAverageLoadAverageEvent(
+//            AverageLoadAverageEvent averageLoadAverageEvent) {
+//
+//        String clusterId = averageLoadAverageEvent.getClusterId();
+//        float value = averageLoadAverageEvent.getValue();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Avg load avg event: [cluster] %s [value] %s",
+//                                    clusterId, value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setAverageLoadAverage(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//
+//    }
+//
+//    @Override
+//    public void handleGradientOfLoadAverageEvent(
+//            GradientOfLoadAverageEvent gradientOfLoadAverageEvent) {
+//
+//        String clusterId = gradientOfLoadAverageEvent.getClusterId();
+//        float value = gradientOfLoadAverageEvent.getValue();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Grad of load avg event: [cluster] %s [value] %s",
+//                                    clusterId, value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setLoadAverageGradient(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void handleSecondDerivativeOfLoadAverageEvent(
+//            SecondDerivativeOfLoadAverageEvent secondDerivativeOfLoadAverageEvent) {
+//
+//        String clusterId = secondDerivativeOfLoadAverageEvent.getClusterId();
+//        float value = secondDerivativeOfLoadAverageEvent.getValue();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Second Derivation of load avg event: [cluster] %s "
+//                                    + "[value] %s", clusterId, value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setLoadAverageSecondDerivative(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void handleAverageMemoryConsumptionEvent(
+//            AverageMemoryConsumptionEvent averageMemoryConsumptionEvent) {
+//
+//        String clusterId = averageMemoryConsumptionEvent.getClusterId();
+//        float value = averageMemoryConsumptionEvent.getValue();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Avg Memory Consumption event: [cluster] %s "
+//                                    + "[value] %s", averageMemoryConsumptionEvent.getClusterId(), value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setAverageMemoryConsumption(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void handleGradientOfMemoryConsumptionEvent(
+//            GradientOfMemoryConsumptionEvent gradientOfMemoryConsumptionEvent) {
+//
+//        String clusterId = gradientOfMemoryConsumptionEvent.getClusterId();
+//        float value = gradientOfMemoryConsumptionEvent.getValue();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Grad of Memory Consumption event: [cluster] %s "
+//                                    + "[value] %s", clusterId, value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setMemoryConsumptionGradient(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void handleSecondDerivativeOfMemoryConsumptionEvent(
+//            SecondDerivativeOfMemoryConsumptionEvent secondDerivativeOfMemoryConsumptionEvent) {
+//
+//        String clusterId = secondDerivativeOfMemoryConsumptionEvent.getClusterId();
+//        float value = secondDerivativeOfMemoryConsumptionEvent.getValue();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Second Derivation of Memory Consumption event: [cluster] %s "
+//                                    + "[value] %s", clusterId, value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setMemoryConsumptionSecondDerivative(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void handleAverageRequestsInFlightEvent(
+//            AverageRequestsInFlightEvent averageRequestsInFlightEvent) {
+//
+//        float value = averageRequestsInFlightEvent.getValue();
+//        String clusterId = averageRequestsInFlightEvent.getClusterId();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Average Rif event: [cluster] %s [value] %s",
+//                                    clusterId, value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setAverageRequestsInFlight(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void handleGradientOfRequestsInFlightEvent(
+//            GradientOfRequestsInFlightEvent gradientOfRequestsInFlightEvent) {
+//
+//        String clusterId = gradientOfRequestsInFlightEvent.getClusterId();
+//        float value = gradientOfRequestsInFlightEvent.getValue();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Gradient of Rif event: [cluster] %s [value] %s",
+//                                    clusterId, value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setRequestsInFlightGradient(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void handleSecondDerivativeOfRequestsInFlightEvent(
+//            SecondDerivativeOfRequestsInFlightEvent secondDerivativeOfRequestsInFlightEvent) {
+//
+//        String clusterId = secondDerivativeOfRequestsInFlightEvent.getClusterId();
+//        float value = secondDerivativeOfRequestsInFlightEvent.getValue();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format("Second derivative of Rif event: [cluster] %s "
+//                                    + "[value] %s", clusterId, value));
+//        }
+//        KubernetesClusterContext kubernetesClusterContext = getKubernetesClusterCtxt();
+//        if (null != kubernetesClusterContext) {
+//            kubernetesClusterContext.setRequestsInFlightSecondDerivative(value);
+//        } else {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Kubernetes cluster context is not available for :" +
+//                                        " [cluster] %s", clusterId));
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void handleMemberAverageMemoryConsumptionEvent(
+//            MemberAverageMemoryConsumptionEvent memberAverageMemoryConsumptionEvent) {
+//
+//        String memberId = memberAverageMemoryConsumptionEvent.getMemberId();
+//        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
+//        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
+//        if (null == memberStatsContext) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member context is not available for : [member] %s", memberId));
+//            }
+//            return;
+//        }
+//        float value = memberAverageMemoryConsumptionEvent.getValue();
+//        memberStatsContext.setAverageMemoryConsumption(value);
+//    }
+//
+//    @Override
+//    public void handleMemberGradientOfMemoryConsumptionEvent(
+//            MemberGradientOfMemoryConsumptionEvent memberGradientOfMemoryConsumptionEvent) {
+//
+//        String memberId = memberGradientOfMemoryConsumptionEvent.getMemberId();
+//        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
+//        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
+//        if (null == memberStatsContext) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member context is not available for : [member] %s", memberId));
+//            }
+//            return;
+//        }
+//        float value = memberGradientOfMemoryConsumptionEvent.getValue();
+//        memberStatsContext.setGradientOfMemoryConsumption(value);
+//    }
+//
+//    @Override
+//    public void handleMemberSecondDerivativeOfMemoryConsumptionEvent(
+//            MemberSecondDerivativeOfMemoryConsumptionEvent memberSecondDerivativeOfMemoryConsumptionEvent) {
+//
+//    }
+//
+//    @Override
+//    public void handleMemberAverageLoadAverageEvent(
+//            MemberAverageLoadAverageEvent memberAverageLoadAverageEvent) {
+//
+//        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
+//        String memberId = memberAverageLoadAverageEvent.getMemberId();
+//        float value = memberAverageLoadAverageEvent.getValue();
+//        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
+//        if (null == memberStatsContext) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member context is not available for : [member] %s", memberId));
+//            }
+//            return;
+//        }
+//        memberStatsContext.setAverageLoadAverage(value);
+//    }
+//
+//    @Override
+//    public void handleMemberGradientOfLoadAverageEvent(
+//            MemberGradientOfLoadAverageEvent memberGradientOfLoadAverageEvent) {
+//
+//        String memberId = memberGradientOfLoadAverageEvent.getMemberId();
+//        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
+//        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
+//        if (null == memberStatsContext) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member context is not available for : [member] %s", memberId));
+//            }
+//            return;
+//        }
+//        float value = memberGradientOfLoadAverageEvent.getValue();
+//        memberStatsContext.setGradientOfLoadAverage(value);
+//    }
+//
+//    @Override
+//    public void handleMemberSecondDerivativeOfLoadAverageEvent(
+//            MemberSecondDerivativeOfLoadAverageEvent memberSecondDerivativeOfLoadAverageEvent) {
+//
+//        String memberId = memberSecondDerivativeOfLoadAverageEvent.getMemberId();
+//        KubernetesClusterContext kubernetesClusterCtxt = getKubernetesClusterCtxt();
+//        MemberStatsContext memberStatsContext = kubernetesClusterCtxt.getMemberStatsContext(memberId);
+//        if (null == memberStatsContext) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member context is not available for : [member] %s", memberId));
+//            }
+//            return;
+//        }
+//        float value = memberSecondDerivativeOfLoadAverageEvent.getValue();
+//        memberStatsContext.setSecondDerivativeOfLoadAverage(value);
+//    }
+//
+//    @Override
+//    public void handleMemberFaultEvent(MemberFaultEvent memberFaultEvent) {
+//    	// kill the container
+//        String memberId = memberFaultEvent.getMemberId();
+//        Member member = getMemberByMemberId(memberId);
+//        if (null == member) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member not found in the Topology: [member] %s", memberId));
+//            }
+//            return;
+//        }
+//        if (!member.isActive()) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member activated event has not received for the member %s. "
+//                                        + "Therefore ignoring" + " the member fault health stat", memberId));
+//            }
+//            return;
+//        }
+//
+//        if (!getKubernetesClusterCtxt().activeMemberExist(memberId)) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Could not find the active member in kubernetes cluster context, "
+//                                        + "[member] %s ", memberId));
+//            }
+//            return;
+//        }
+//
+//        // move member to obsolete list
+//        getKubernetesClusterCtxt().moveMemberToObsoleteList(memberId);
+//        if (log.isInfoEnabled()) {
+//            String clusterId = memberFaultEvent.getClusterId();
+//            String kubernetesClusterID = getKubernetesClusterCtxt().getKubernetesClusterID();
+//            log.info(String.format("Faulty member is moved to obsolete list and removed from the active members list: "
+//                    + "[member] %s [kub-cluster] %s [cluster] %s ", memberId, kubernetesClusterID, clusterId));
+//        }
+//    }
+//
+//    @Override
+//    public void handleMemberStartedEvent(
+//            MemberStartedEvent memberStartedEvent) {
+//
+//    }
+//
+//    @Override
+//    public void handleMemberActivatedEvent(
+//            MemberActivatedEvent memberActivatedEvent) {
+//
+//        KubernetesClusterContext kubernetesClusterContext;
+//        kubernetesClusterContext = getKubernetesClusterCtxt();
+//        String memberId = memberActivatedEvent.getMemberId();
+//        kubernetesClusterContext.addMemberStatsContext(new MemberStatsContext(memberId));
+//        if (log.isInfoEnabled()) {
+//            log.info(String.format("Member stat context has been added successfully: "
+//                                   + "[member] %s", memberId));
+//        }
+//        kubernetesClusterContext.movePendingMemberToActiveMembers(memberId);
+//    }
+//
+//    @Override
+//    public void handleMemberMaintenanceModeEvent(
+//            MemberMaintenanceModeEvent maintenanceModeEvent) {
+//
+//        // no need to do anything here
+//        // we will not be receiving this event for containers
+//        // we will only receive member terminated event
+//    }
+//
+//    @Override
+//    public void handleMemberReadyToShutdownEvent(
+//            MemberReadyToShutdownEvent memberReadyToShutdownEvent) {
+//
+//        // no need to do anything here
+//        // we will not be receiving this event for containers
+//    	// we will only receive member terminated event
+//    }
+//
+//    @Override
+//    public void handleMemberTerminatedEvent(
+//            MemberTerminatedEvent memberTerminatedEvent) {
+//
+//        String memberId = memberTerminatedEvent.getMemberId();
+//        if (getKubernetesClusterCtxt().removeTerminationPendingMember(memberId)) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member is removed from termination pending members list: "
+//                                        + "[member] %s", memberId));
+//            }
+//        } else if (getKubernetesClusterCtxt().removePendingMember(memberId)) {
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format("Member is removed from pending members list: "
+//                                        + "[member] %s", memberId));
+//            }
+//        } else if (getKubernetesClusterCtxt().removeActiveMemberById(memberId)) {
+//            log.warn(String.format("Member is in the wrong list and it is removed from "
+//                                   + "active members list: %s", memberId));
+//        } else if (getKubernetesClusterCtxt().removeObsoleteMember(memberId)) {
+//            log.warn(String.format("Obsolete member has either been terminated or its obsolete time out has expired and"
+//                                   + " it is removed from obsolete members list: %s", memberId));
+//        } else {
+//            log.warn(String.format("Member is not available in any of the list active, "
+//                                   + "pending and termination pending: %s", memberId));
+//        }
+//
+//        if (log.isInfoEnabled()) {
+//            log.info(String.format("Member stat context has been removed successfully: "
+//                                   + "[member] %s", memberId));
+//        }
+//    }
+//
+//    @Override
+//    public void handleClusterRemovedEvent(
+//            ClusterRemovedEvent clusterRemovedEvent) {
+//    	getKubernetesClusterCtxt().getPendingMembers().clear();
+//    	getKubernetesClusterCtxt().getActiveMembers().clear();
+//    	getKubernetesClusterCtxt().getTerminationPendingMembers().clear();
+//    	getKubernetesClusterCtxt().getObsoletedMembers().clear();
+//    }
+//
+//    public KubernetesClusterContext getKubernetesClusterCtxt() {
+//        return (KubernetesClusterContext) getClusterContext();
+//    }
+//
+//    private Member getMemberByMemberId(String memberId) {
+//        try {
+//            TopologyManager.acquireReadLock();
+//            for (Service service : TopologyManager.getTopology().getServices()) {
+//                for (Cluster cluster : service.getClusters()) {
+//                    if (cluster.memberExists(memberId)) {
+//                        return cluster.getMember(memberId);
+//                    }
+//                }
+//            }
+//            return null;
+//        } finally {
+//            TopologyManager.releaseReadLock();
+//        }
+//    }
 
     @Override
     public void terminateAllMembers(String instanceId, String networkPartitionId) {
         try {
-            CloudControllerClient.getInstance().terminateAllContainers(getKubernetesClusterCtxt().getClusterId());
+            CloudControllerClient.getInstance().terminateAllContainers(getClusterId());
         } catch (TerminationException e) {
             log.error(String.format("Could not terminate containers: [cluster-id] %s",
-                    getKubernetesClusterCtxt().getClusterId()), e);
+                    getClusterId()), e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/c1ad7a52/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java
index edcaa65..0221a05 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java
@@ -31,6 +31,7 @@ import org.apache.stratos.autoscaler.util.ConfUtil;
 import org.apache.stratos.common.Properties;
 import org.apache.stratos.common.Property;
 import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.messaging.domain.topology.Cluster;
 import org.apache.stratos.messaging.domain.topology.ClusterStatus;
 
 import java.util.Arrays;
@@ -45,9 +46,8 @@ public final class KubernetesServiceClusterMonitor extends KubernetesClusterMoni
 
     private String lbReferenceType;
 
-    public KubernetesServiceClusterMonitor(String serviceType, String clusterId) {
-        super(serviceType, clusterId,
-                new AutoscalerRuleEvaluator());
+    public KubernetesServiceClusterMonitor(Cluster cluster) {
+        super(cluster);
         readConfigurations();
     }
 
@@ -73,162 +73,162 @@ public final class KubernetesServiceClusterMonitor extends KubernetesClusterMoni
         }
     }
 
-    @Override
-    protected void monitor() {
-        final String instanceId = this.getKubernetesClusterCtxt().getInstanceId();
-        Runnable monitoringRunnable = new Runnable() {
-
-            @Override
-            public void run() {
-                obsoleteCheck();
-                minCheck();
-                scaleCheck(instanceId);
-            }
-        };
-        monitoringRunnable.run();
-    }
-
-
-    private void scaleCheck(String instanceId) {
-        boolean rifReset = getKubernetesClusterCtxt().isRifReset();
-        boolean memoryConsumptionReset = getKubernetesClusterCtxt().isMemoryConsumptionReset();
-        boolean loadAverageReset = getKubernetesClusterCtxt().isLoadAverageReset();
-        if (log.isDebugEnabled()) {
-            log.debug("flag of rifReset : " + rifReset
-                    + " flag of memoryConsumptionReset : "
-                    + memoryConsumptionReset + " flag of loadAverageReset : "
-                    + loadAverageReset);
-        }
-        String kubernetesClusterID = getKubernetesClusterCtxt().getKubernetesClusterID();
-        String clusterId = getClusterId();
-        if (rifReset || memoryConsumptionReset || loadAverageReset) {
-            getScaleCheckKnowledgeSession().setGlobal("clusterId", clusterId);
-            getScaleCheckKnowledgeSession().setGlobal("autoscalePolicy", getAutoscalePolicy(instanceId));
-            getScaleCheckKnowledgeSession().setGlobal("rifReset", rifReset);
-            getScaleCheckKnowledgeSession().setGlobal("mcReset", memoryConsumptionReset);
-            getScaleCheckKnowledgeSession().setGlobal("laReset", loadAverageReset);
-            if (log.isDebugEnabled()) {
-                log.debug(String.format(
-                        "Running scale check for [kub-cluster] : %s [cluster] : %s ", kubernetesClusterID, getClusterId()));
-            }
-            scaleCheckFactHandle = AutoscalerRuleEvaluator.evaluate(
-                    getScaleCheckKnowledgeSession(), scaleCheckFactHandle, getKubernetesClusterCtxt());
-            getKubernetesClusterCtxt().setRifReset(false);
-            getKubernetesClusterCtxt().setMemoryConsumptionReset(false);
-            getKubernetesClusterCtxt().setLoadAverageReset(false);
-        } else if (log.isDebugEnabled()) {
-            log.debug(String.format("Scale check will not run since none of the statistics have not received yet for "
-                    + "[kub-cluster] : %s [cluster] : %s", kubernetesClusterID, clusterId));
-        }
-    }
-
-    private AutoscalePolicy getAutoscalePolicy(String instanceId) {
-        KubernetesClusterContext kubernetesClusterContext = (KubernetesClusterContext) this.clusterContext;
-        return kubernetesClusterContext.getAutoscalePolicy();
-    }
-
-    private void minCheck() {
-        getMinCheckKnowledgeSession().setGlobal("clusterId", getClusterId());
-        String kubernetesClusterID = getKubernetesClusterCtxt().getKubernetesClusterID();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format(
-                    "Running min check for [kub-cluster] : %s [cluster] : %s ", kubernetesClusterID, getClusterId()));
-        }
-        minCheckFactHandle = AutoscalerRuleEvaluator.evaluate(
-                getMinCheckKnowledgeSession(), minCheckFactHandle,
-                getKubernetesClusterCtxt());
-    }
-
-    private void obsoleteCheck() {
-        getObsoleteCheckKnowledgeSession().setGlobal("clusterId", getClusterId());
-        String kubernetesClusterID = getKubernetesClusterCtxt().getKubernetesClusterID();
-        if (log.isDebugEnabled()) {
-            log.debug(String.format(
-                    "Running obsolete check for [kub-cluster] : %s [cluster] : %s ", kubernetesClusterID, getClusterId()));
-        }
-        obsoleteCheckFactHandle = AutoscalerRuleEvaluator.evaluate(
-                getObsoleteCheckKnowledgeSession(), obsoleteCheckFactHandle,
-                getKubernetesClusterCtxt());
-    }
-
-    @Override
-    public void destroy() {
-        getMinCheckKnowledgeSession().dispose();
-        getObsoleteCheckKnowledgeSession().dispose();
-        getScaleCheckKnowledgeSession().dispose();
-        setDestroyed(true);
-        stopScheduler();
-        if (log.isDebugEnabled()) {
-            log.debug("KubernetesServiceClusterMonitor Drools session has been disposed. " + this.toString());
-        }
-    }
-
-    @Override
-    protected void readConfigurations() {
-        XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
-        int monitorInterval = conf.getInt(AutoScalerConstants.KubernetesService_Cluster_MONITOR_INTERVAL, 60000);
-        setMonitorIntervalMilliseconds(monitorInterval);
-        if (log.isDebugEnabled()) {
-            log.debug("KubernetesServiceClusterMonitor task interval set to : " + getMonitorIntervalMilliseconds());
-        }
-    }
-
-    @Override
-    public String toString() {
-        return "KubernetesServiceClusterMonitor for " + "[ clusterId=" + getClusterId() + "]";
-    }
-
-    public String getLbReferenceType() {
-        return lbReferenceType;
-    }
-
-    public void setLbReferenceType(String lbReferenceType) {
-        this.lbReferenceType = lbReferenceType;
-    }
-
-    @Override
-    public void handleDynamicUpdates(Properties properties) throws InvalidArgumentException {
-
-        if (properties != null) {
-            Property[] propertyArray = properties.getProperties();
-            if (propertyArray == null) {
-                return;
-            }
-            List<Property> propertyList = Arrays.asList(propertyArray);
-
-            for (Property property : propertyList) {
-                String key = property.getName();
-                String value = property.getValue();
-
-                if (StratosConstants.KUBERNETES_MIN_REPLICAS.equals(key)) {
-                    int min = Integer.parseInt(value);
-                    int max = getKubernetesClusterCtxt().getMaxReplicas();
-                    if (min > max) {
-                        String msg = String.format("%s should be less than %s . But %s is not less than %s.",
-                                StratosConstants.KUBERNETES_MIN_REPLICAS, StratosConstants.KUBERNETES_MAX_REPLICAS, min, max);
-                        log.error(msg);
-                        throw new InvalidArgumentException(msg);
-                    }
-                    getKubernetesClusterCtxt().setMinReplicas(min);
-                    break;
-                }
-            }
-
-        }
-    }
-
-    @Override
-    public void terminateAllMembers(String instanceId, String networkPartitionId) {
-
-    }
-
-    @Override
-    public void onChildScalingEvent(MonitorScalingEvent scalingEvent) {
-
-    }
-
-    @Override
-    public void onParentScalingEvent(MonitorScalingEvent scalingEvent) {
-
-    }
+//    @Override
+//    public void monitor() {
+//        final String instanceId = this.getKubernetesClusterCtxt().getInstanceId();
+//        Runnable monitoringRunnable = new Runnable() {
+//
+//            @Override
+//            public void run() {
+//                obsoleteCheck();
+//                minCheck();
+//                scaleCheck(instanceId);
+//            }
+//        };
+//        monitoringRunnable.run();
+//    }
+//
+//
+//    private void scaleCheck(String instanceId) {
+//        boolean rifReset = getKubernetesClusterCtxt().isRifReset();
+//        boolean memoryConsumptionReset = getKubernetesClusterCtxt().isMemoryConsumptionReset();
+//        boolean loadAverageReset = getKubernetesClusterCtxt().isLoadAverageReset();
+//        if (log.isDebugEnabled()) {
+//            log.debug("flag of rifReset : " + rifReset
+//                    + " flag of memoryConsumptionReset : "
+//                    + memoryConsumptionReset + " flag of loadAverageReset : "
+//                    + loadAverageReset);
+//        }
+//        String kubernetesClusterID = getKubernetesClusterCtxt().getKubernetesClusterID();
+//        String clusterId = getClusterId();
+//        if (rifReset || memoryConsumptionReset || loadAverageReset) {
+//            getScaleCheckKnowledgeSession().setGlobal("clusterId", clusterId);
+//            getScaleCheckKnowledgeSession().setGlobal("autoscalePolicy", getAutoscalePolicy(instanceId));
+//            getScaleCheckKnowledgeSession().setGlobal("rifReset", rifReset);
+//            getScaleCheckKnowledgeSession().setGlobal("mcReset", memoryConsumptionReset);
+//            getScaleCheckKnowledgeSession().setGlobal("laReset", loadAverageReset);
+//            if (log.isDebugEnabled()) {
+//                log.debug(String.format(
+//                        "Running scale check for [kub-cluster] : %s [cluster] : %s ", kubernetesClusterID, getClusterId()));
+//            }
+//            scaleCheckFactHandle = AutoscalerRuleEvaluator.evaluate(
+//                    getScaleCheckKnowledgeSession(), scaleCheckFactHandle, getKubernetesClusterCtxt());
+//            getKubernetesClusterCtxt().setRifReset(false);
+//            getKubernetesClusterCtxt().setMemoryConsumptionReset(false);
+//            getKubernetesClusterCtxt().setLoadAverageReset(false);
+//        } else if (log.isDebugEnabled()) {
+//            log.debug(String.format("Scale check will not run since none of the statistics have not received yet for "
+//                    + "[kub-cluster] : %s [cluster] : %s", kubernetesClusterID, clusterId));
+//        }
+//    }
+//
+//    private AutoscalePolicy getAutoscalePolicy(String instanceId) {
+//        KubernetesClusterContext kubernetesClusterContext = (KubernetesClusterContext) this.clusterContext;
+//        return kubernetesClusterContext.getAutoscalePolicy();
+//    }
+//
+//    private void minCheck() {
+//        getMinCheckKnowledgeSession().setGlobal("clusterId", getClusterId());
+//        String kubernetesClusterID = getKubernetesClusterCtxt().getKubernetesClusterID();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format(
+//                    "Running min check for [kub-cluster] : %s [cluster] : %s ", kubernetesClusterID, getClusterId()));
+//        }
+//        minCheckFactHandle = AutoscalerRuleEvaluator.evaluate(
+//                getMinCheckKnowledgeSession(), minCheckFactHandle,
+//                getKubernetesClusterCtxt());
+//    }
+//
+//    private void obsoleteCheck() {
+//        getObsoleteCheckKnowledgeSession().setGlobal("clusterId", getClusterId());
+//        String kubernetesClusterID = getKubernetesClusterCtxt().getKubernetesClusterID();
+//        if (log.isDebugEnabled()) {
+//            log.debug(String.format(
+//                    "Running obsolete check for [kub-cluster] : %s [cluster] : %s ", kubernetesClusterID, getClusterId()));
+//        }
+//        obsoleteCheckFactHandle = AutoscalerRuleEvaluator.evaluate(
+//                getObsoleteCheckKnowledgeSession(), obsoleteCheckFactHandle,
+//                getKubernetesClusterCtxt());
+//    }
+//
+//    @Override
+//    public void destroy() {
+//        getMinCheckKnowledgeSession().dispose();
+//        getObsoleteCheckKnowledgeSession().dispose();
+//        getScaleCheckKnowledgeSession().dispose();
+//        setDestroyed(true);
+//        stopScheduler();
+//        if (log.isDebugEnabled()) {
+//            log.debug("KubernetesServiceClusterMonitor Drools session has been disposed. " + this.toString());
+//        }
+//    }
+//
+//    @Override
+//    protected void readConfigurations() {
+//        XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
+//        int monitorInterval = conf.getInt(AutoScalerConstants.KubernetesService_Cluster_MONITOR_INTERVAL, 60000);
+//        setMonitorIntervalMilliseconds(monitorInterval);
+//        if (log.isDebugEnabled()) {
+//            log.debug("KubernetesServiceClusterMonitor task interval set to : " + getMonitorIntervalMilliseconds());
+//        }
+//    }
+//
+//    @Override
+//    public String toString() {
+//        return "KubernetesServiceClusterMonitor for " + "[ clusterId=" + getClusterId() + "]";
+//    }
+//
+//    public String getLbReferenceType() {
+//        return lbReferenceType;
+//    }
+//
+//    public void setLbReferenceType(String lbReferenceType) {
+//        this.lbReferenceType = lbReferenceType;
+//    }
+//
+//    @Override
+//    public void handleDynamicUpdates(Properties properties) throws InvalidArgumentException {
+//
+//        if (properties != null) {
+//            Property[] propertyArray = properties.getProperties();
+//            if (propertyArray == null) {
+//                return;
+//            }
+//            List<Property> propertyList = Arrays.asList(propertyArray);
+//
+//            for (Property property : propertyList) {
+//                String key = property.getName();
+//                String value = property.getValue();
+//
+//                if (StratosConstants.KUBERNETES_MIN_REPLICAS.equals(key)) {
+//                    int min = Integer.parseInt(value);
+//                    int max = getKubernetesClusterCtxt().getMaxReplicas();
+//                    if (min > max) {
+//                        String msg = String.format("%s should be less than %s . But %s is not less than %s.",
+//                                StratosConstants.KUBERNETES_MIN_REPLICAS, StratosConstants.KUBERNETES_MAX_REPLICAS, min, max);
+//                        log.error(msg);
+//                        throw new InvalidArgumentException(msg);
+//                    }
+//                    getKubernetesClusterCtxt().setMinReplicas(min);
+//                    break;
+//                }
+//            }
+//
+//        }
+//    }
+//
+//    @Override
+//    public void terminateAllMembers(String instanceId, String networkPartitionId) {
+//
+//    }
+//
+//    @Override
+//    public void onChildScalingEvent(MonitorScalingEvent scalingEvent) {
+//
+//    }
+//
+//    @Override
+//    public void onParentScalingEvent(MonitorScalingEvent scalingEvent) {
+//
+//    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/c1ad7a52/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
index d000b88..718ede9 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
@@ -70,8 +70,8 @@ public class VMClusterMonitor extends AbstractClusterMonitor {
     private boolean hasPrimary;
     private float scalingFactorBasedOnDependencies = 1.0f;
 
-    protected VMClusterMonitor(String serviceType, String clusterId) {
-        super(serviceType, clusterId);
+    protected VMClusterMonitor(Cluster cluster) {
+        super(cluster);
         this.networkPartitionIdToClusterLevelNetworkPartitionCtxts = new HashMap<String, ClusterLevelNetworkPartitionContext>();
 
         readConfigurations();

http://git-wip-us.apache.org/repos/asf/stratos/blob/c1ad7a52/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
index 2bfd091..bd0ea1c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
@@ -190,6 +190,8 @@ public class RuleTasksDelegator {
             ClusterLevelNetworkPartitionContext  clusterLevelNetworkPartitionContext = clusterContext.getNetworkPartitionCtxt(nwPartitionId);
             ClusterInstanceContext clusterInstanceContext = clusterLevelNetworkPartitionContext.getClusterInstanceContext(instanceId);
             minimumCountOfNetworkPartition = clusterInstanceContext.getMinInstanceCount();
+            
+            
             MemberContext[] memberContexts =
                     CloudControllerClient.getInstance()
                             .startContainers(clusterMonitorPartitionContext.getPartition(),
@@ -241,25 +243,57 @@ public class RuleTasksDelegator {
             ClusterLevelNetworkPartitionContext  clusterLevelNetworkPartitionContext = clusterContext.getNetworkPartitionCtxt(nwPartitionId);
             ClusterInstanceContext clusterInstanceContext = clusterLevelNetworkPartitionContext.getClusterInstanceContext(instanceId);
             minimumCountOfNetworkPartition = clusterInstanceContext.getMinInstanceCount();
-            MemberContext memberContext =
-                    CloudControllerClient.getInstance()
-                            .spawnAnInstance(clusterMonitorPartitionContext.getPartition(),
-                                    clusterId,
-                                    clusterMonitorPartitionContext.getNetworkPartitionId(),
-                                    instanceId,
-                                    isPrimary,
-                                    minimumCountOfNetworkPartition);
-            if (memberContext != null) {
-                clusterMonitorPartitionContext.addPendingMember(memberContext);
-                if (log.isDebugEnabled()) {
-                    log.debug(String.format("Pending member added, [member] %s [partition] %s", memberContext.getMemberId(),
-                            memberContext.getPartition().getId()));
+            
+            if (vmClusterMonitor.getCluster().isKubernetesCluster()) {
+                MemberContext[] memberContexts =
+                        CloudControllerClient.getInstance()
+                                .startContainers(clusterMonitorPartitionContext.getPartition(),
+                                        clusterId,
+                                        instanceId,
+                                        clusterMonitorPartitionContext.getNetworkPartitionId(),
+                                        isPrimary,
+                                        minimumCountOfNetworkPartition);
+                if (null != memberContexts) {
+                    for (MemberContext memberContext : memberContexts) {
+                        if (null != memberContext) {
+                            clusterMonitorPartitionContext.addPendingMember(memberContext);
+                            if (log.isDebugEnabled()) {
+                                log.debug(String.format("Pending member added, [member] %s [partition] %s", memberContext.getMemberId(),
+                                        memberContext.getPartition().getId()));
+                            }
+                        } else {
+                            if (log.isDebugEnabled()) {
+                                log.debug("Returned member context is null, did not add any pending members");
+                            }
+                        }
+                    }
+                } else {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Returned member context is null, did not add to pending members");
+                    }
                 }
+            } else {
+                
+                MemberContext memberContext =
+                        CloudControllerClient.getInstance()
+                                .spawnAnInstance(clusterMonitorPartitionContext.getPartition(),
+                                        clusterId,
+                                        clusterMonitorPartitionContext.getNetworkPartitionId(),
+                                        instanceId,
+                                        isPrimary,
+                                        minimumCountOfNetworkPartition);
+                if (memberContext != null) {
+                    clusterMonitorPartitionContext.addPendingMember(memberContext);
+                    if (log.isDebugEnabled()) {
+                        log.debug(String.format("Pending member added, [member] %s [partition] %s", memberContext.getMemberId(),
+                                memberContext.getPartition().getId()));
+                    }
 
-            } else if (log.isDebugEnabled()) {
-                log.debug("Returned member context is null, did not add to pending members");
+                } else if (log.isDebugEnabled()) {
+                    log.debug("Returned member context is null, did not add to pending members");
+                }
             }
-
+            
         } catch (Throwable e) {
             String message = "Cannot spawn an instance";
             log.error(message, e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/c1ad7a52/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java
index 2e345d4..3d26183 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java
@@ -63,6 +63,23 @@ public class Cluster implements Serializable {
     private Map<String, ClusterInstance> instanceIdToInstanceContextMap;
     //private LifeCycleStateManager<ClusterStatus> clusterStateManager;
 
+    public Cluster(Cluster cluster) {
+        this.serviceName = cluster.getServiceName();
+        this.clusterId = cluster.getClusterId();
+        this.deploymentPolicyName = cluster.getDeploymentPolicyName();
+        this.autoscalePolicyName = cluster.getAutoscalePolicyName();
+        this.appId = cluster.getAppId();
+        this.setKubernetesCluster(cluster.isKubernetesCluster());
+        this.setHostNames(cluster.getHostNames());
+        this.memberMap = cluster.getMemberMap();
+        this.setInstanceIdToInstanceContextMap(cluster.getInstanceIdToInstanceContextMap());
+        this.properties = cluster.getProperties();
+        this.loadBalanceAlgorithmName = cluster.getLoadBalanceAlgorithmName();
+        this.parentId = cluster.getParentId();
+        this.tenantRange = cluster.getTenantRange();
+        this.setLbCluster(cluster.isLbCluster());
+    }
+    
     public Cluster(String serviceName, String clusterId, String deploymentPolicyName,
                    String autoscalePolicyName, String appId) {
         this.serviceName = serviceName;
@@ -258,6 +275,14 @@ public class Cluster implements Serializable {
         return getInstanceIdToInstanceContextMap().keySet().size();
     }
 
+    public Map<String, Member> getMemberMap() {
+        return memberMap;
+    }
+
+    public void setMemberMap(Map<String, Member> memberMap) {
+        this.memberMap = memberMap;
+    }
+
     public boolean equals(Object other) {
         if (other == null || !(other instanceof Cluster)) {
             return false;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c1ad7a52/products/stratos/modules/distribution/container-mincheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/container-mincheck.drl b/products/stratos/modules/distribution/container-mincheck.drl
new file mode 100755
index 0000000..2679d25
--- /dev/null
+++ b/products/stratos/modules/distribution/container-mincheck.drl
@@ -0,0 +1,54 @@
+/*
+ * 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.context.cluster.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


[06/16] stratos git commit: Autoscaler changes with partition validation changes.

Posted by ni...@apache.org.
Autoscaler changes with partition validation changes.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/93e75006
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/93e75006
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/93e75006

Branch: refs/heads/master
Commit: 93e75006ae2af510a236144e79d19d62ca193806
Parents: d3fcf9b
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Fri Dec 5 08:09:55 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 17:59:31 2014 +0530

----------------------------------------------------------------------
 .../client/CloudControllerClient.java           | 22 ++++-
 .../monitor/cluster/ClusterMonitorFactory.java  | 12 +--
 .../autoscaler/rule/RuleTasksDelegator.java     | 95 +++++++++++++++-----
 3 files changed, 100 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/93e75006/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
index 854e80f..bf68913 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
@@ -355,7 +355,10 @@ public class CloudControllerClient {
      * 				cartridge not found for the given cluster id, or if the given
      * 				kubernetes cluster id is not valid
      */
-    public synchronized MemberContext[] startContainers(String kubernetesClusterId, String clusterId) throws SpawningException {
+    public synchronized MemberContext[] startContainers(Partition partition,
+            String clusterId,
+            String networkPartitionId,String instanceID, boolean isPrimary,
+            int minMemberCount) throws SpawningException {
         try {
 
 //            KubernetesManager kubernetesManager = KubernetesManager.getInstance();
@@ -368,6 +371,23 @@ public class CloudControllerClient {
 
             ContainerClusterContext context = new ContainerClusterContext();
             context.setClusterId(clusterId);
+            context.setPartition(partition);
+            context.setNetworkPartitionId(networkPartitionId);
+            context.setInstanceId(instanceID);
+            
+            Properties memberContextProps = new Properties();
+            Property isPrimaryProp = new Property();
+            isPrimaryProp.setName("PRIMARY");
+            isPrimaryProp.setValue(String.valueOf(isPrimary));
+
+            Property minCountProp = new Property();
+            minCountProp.setName("MIN_COUNT");
+            minCountProp.setValue(String.valueOf(minMemberCount));
+
+            memberContextProps.addProperty(isPrimaryProp);
+            memberContextProps.addProperty(minCountProp);
+            context.setProperties(AutoscalerUtil.toStubProperties(memberContextProps));
+            
 //            Properties memberContextProps = new Properties();
 //            Property kubernetesClusterMasterIPProps = new Property();
 //            kubernetesClusterMasterIPProps.setName(StratosConstants.KUBERNETES_MASTER_IP);

http://git-wip-us.apache.org/repos/asf/stratos/blob/93e75006/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java
index f906f64..618c15a 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java
@@ -46,13 +46,13 @@ public class ClusterMonitorFactory {
             throws PolicyValidationException, PartitionValidationException {
 
         AbstractClusterMonitor clusterMonitor;
-        if (cluster.isKubernetesCluster()) {
-            clusterMonitor = getDockerServiceClusterMonitor(cluster);
-//        } else if (cluster.isLbCluster()) {
-//            clusterMonitor = getVMLbClusterMonitor(cluster);
-        } else {
+//        if (cluster.isKubernetesCluster()) {
+//            clusterMonitor = getDockerServiceClusterMonitor(cluster);
+////        } else if (cluster.isLbCluster()) {
+////            clusterMonitor = getVMLbClusterMonitor(cluster);
+//        } else {
             clusterMonitor = getVMClusterMonitor(cluster);
-        }
+//        }
 
         return clusterMonitor;
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/93e75006/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
index 6a4766c..2bfd091 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
@@ -174,6 +174,57 @@ public class RuleTasksDelegator {
         }
     }
 
+    public void delegateStartContainers(ClusterLevelPartitionContext clusterMonitorPartitionContext, String clusterId, String instanceId, boolean isPrimary) {
+
+        try {
+
+            String nwPartitionId = clusterMonitorPartitionContext.getNetworkPartitionId();
+//            NetworkPartitionLbHolder lbHolder =
+//                    PartitionManager.getInstance()
+//                            .getNetworkPartitionLbHolder(nwPartitionId);
+//            String lbClusterId = getLbClusterId(lbRefType, clusterMonitorPartitionContext, lbHolder);
+            //Calculate accumulation of minimum counts of all the partition of current network partition
+            int minimumCountOfNetworkPartition = 0;
+            VMClusterMonitor vmClusterMonitor = (VMClusterMonitor) AutoscalerContext.getInstance().getClusterMonitor(clusterId);
+            VMClusterContext clusterContext = (VMClusterContext) vmClusterMonitor.getClusterContext();
+            ClusterLevelNetworkPartitionContext  clusterLevelNetworkPartitionContext = clusterContext.getNetworkPartitionCtxt(nwPartitionId);
+            ClusterInstanceContext clusterInstanceContext = clusterLevelNetworkPartitionContext.getClusterInstanceContext(instanceId);
+            minimumCountOfNetworkPartition = clusterInstanceContext.getMinInstanceCount();
+            MemberContext[] memberContexts =
+                    CloudControllerClient.getInstance()
+                            .startContainers(clusterMonitorPartitionContext.getPartition(),
+                                    clusterId,
+                                    instanceId,
+                                    clusterMonitorPartitionContext.getNetworkPartitionId(),
+                                    isPrimary,
+                                    minimumCountOfNetworkPartition);
+            if (null != memberContexts) {
+                for (MemberContext memberContext : memberContexts) {
+                    if (null != memberContext) {
+                        clusterMonitorPartitionContext.addPendingMember(memberContext);
+                        if (log.isDebugEnabled()) {
+                            log.debug(String.format("Pending member added, [member] %s [partition] %s", memberContext.getMemberId(),
+                                    memberContext.getPartition().getId()));
+                        }
+                    } else {
+                        if (log.isDebugEnabled()) {
+                            log.debug("Returned member context is null, did not add any pending members");
+                        }
+                    }
+                }
+            } else {
+                if (log.isDebugEnabled()) {
+                    log.debug("Returned member context is null, did not add to pending members");
+                }
+            }
+
+        } catch (Throwable e) {
+            String message = "Cannot spawn an instance";
+            log.error(message, e);
+            throw new RuntimeException(message, e);
+        }
+    }
+    
     public void delegateSpawn(ClusterLevelPartitionContext clusterMonitorPartitionContext, String clusterId, String instanceId, boolean isPrimary) {
 
         try {
@@ -377,28 +428,28 @@ public class RuleTasksDelegator {
             String kubernetesClusterId = kubernetesClusterContext.getKubernetesClusterID();
             String clusterId = kubernetesClusterContext.getClusterId();
             CloudControllerClient ccClient = CloudControllerClient.getInstance();
-            MemberContext[] memberContexts = ccClient.startContainers(kubernetesClusterId, clusterId);
-            if (null != memberContexts) {
-                for (MemberContext memberContext : memberContexts) {
-                    if (null != memberContext) {
-                        kubernetesClusterContext.addPendingMember(memberContext);
-                        kubernetesClusterContext.setServiceClusterCreated(true);
-                        if (log.isDebugEnabled()) {
-                            log.debug(String.format(
-                                    "Pending member added, [member] %s [kub cluster] %s",
-                                    memberContext.getMemberId(), kubernetesClusterId));
-                        }
-                    } else {
-                        if (log.isDebugEnabled()) {
-                            log.debug("Returned member context is null, did not add any pending members");
-                        }
-                    }
-                }
-            } else {
-                if (log.isDebugEnabled()) {
-                    log.debug("Returned member context is null, did not add to pending members");
-                }
-            }
+//            MemberContext[] memberContexts = ccClient.startContainers(kubernetesClusterId, clusterId);
+//            if (null != memberContexts) {
+//                for (MemberContext memberContext : memberContexts) {
+//                    if (null != memberContext) {
+//                        kubernetesClusterContext.addPendingMember(memberContext);
+//                        kubernetesClusterContext.setServiceClusterCreated(true);
+//                        if (log.isDebugEnabled()) {
+//                            log.debug(String.format(
+//                                    "Pending member added, [member] %s [kub cluster] %s",
+//                                    memberContext.getMemberId(), kubernetesClusterId));
+//                        }
+//                    } else {
+//                        if (log.isDebugEnabled()) {
+//                            log.debug("Returned member context is null, did not add any pending members");
+//                        }
+//                    }
+//                }
+//            } else {
+//                if (log.isDebugEnabled()) {
+//                    log.debug("Returned member context is null, did not add to pending members");
+//                }
+//            }
         } catch (Exception e) {
             log.error("Cannot create containers ", e);
         }


[11/16] stratos git commit: Removing docker iaas provider from cc xml

Posted by ni...@apache.org.
Removing docker iaas provider from cc xml


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/2b5cbd81
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/2b5cbd81
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/2b5cbd81

Branch: refs/heads/master
Commit: 2b5cbd818aa035f58f7b3c8f97ca84c04949008f
Parents: c1ad7a5
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sat Dec 6 17:03:51 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:00:49 2014 +0530

----------------------------------------------------------------------
 .../src/main/resources/conf/cloud-controller.xml          | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/2b5cbd81/features/cloud-controller/org.apache.stratos.cloud.controller.feature/src/main/resources/conf/cloud-controller.xml
----------------------------------------------------------------------
diff --git a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/src/main/resources/conf/cloud-controller.xml b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/src/main/resources/conf/cloud-controller.xml
index 8817d9a..7d9424c 100644
--- a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/src/main/resources/conf/cloud-controller.xml
+++ b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/src/main/resources/conf/cloud-controller.xml
@@ -49,7 +49,7 @@
 		is not necessary [0..1]. But you can use this section to avoid specifying 
 		same property over and over again. -->
 	<iaasProviders>
-		<!-- iaasProvider type="openstack" name="openstack specific details">
+		<iaasProvider type="openstack" name="openstack specific details">
             		<className>org.apache.stratos.cloud.controller.iaases.OpenstackNovaIaas</className>
 			<provider>openstack-nova</provider>
 			<identity svns:secretAlias="cloud.controller.openstack.identity">demo:demo</identity>
@@ -60,12 +60,6 @@
 			<property name="openstack.networking.provider" value="nova" />
 			<property name="X" value="x" />
 			<property name="Y" value="y" />
-		</iaasProvider -->
-        <iaasProvider type="docker" name="Docker">
-            <className>org.apache.stratos.cloud.controller.iaases.DockerIaas</className>
-            <provider>docker</provider>
-            <identity svns:secretAlias="cloud.controller.docker.identity">identity</identity>
-            <credential svns:secretAlias="cloud.controller.docker.credential">credential</credential>
-        </iaasProvider>
+		</iaasProvider>
 	</iaasProviders>
 </cloudController>


[14/16] stratos git commit: Fixing toString method of properties.

Posted by ni...@apache.org.
Fixing toString method of properties.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/1821ee06
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/1821ee06
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/1821ee06

Branch: refs/heads/master
Commit: 1821ee0622641b63a11de39298bd105dea399927
Parents: 6439580
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sun Dec 7 12:48:16 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:00:49 2014 +0530

----------------------------------------------------------------------
 .../org/apache/stratos/common/Properties.java     | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/1821ee06/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Properties.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Properties.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Properties.java
index f842672..638daba 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Properties.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Properties.java
@@ -61,7 +61,7 @@ public class Properties implements Serializable {
 
     @Override
     public String toString() {
-        return "Properties [properties=" + this.getProperties() + "]";
+        return "Properties [properties=" + properties + "]";
     }
 
     @Override
@@ -89,20 +89,4 @@ public class Properties implements Serializable {
         return true;
     }
 
-//    @Override
-//    public boolean equals(Object object) {
-//        if (object == null) {
-//            return false;
-//        }
-//
-//        if (!(object instanceof Properties)) {
-//            return false;
-//        }
-//
-//        Properties propertiesObject = (Properties) object;
-//        return Arrays.equals(propertiesObject.getProperties(), this.getProperties());
-//    }
-    
-    
-
 }
\ No newline at end of file


[02/16] stratos git commit: Partition validation changes to CC, to cater docker partitions.

Posted by ni...@apache.org.
Partition validation changes to CC, to cater docker partitions.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c2fc25fb
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c2fc25fb
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c2fc25fb

Branch: refs/heads/master
Commit: c2fc25fbcb1b3c2e05bf223b59b8f32c0999e66e
Parents: 4d2dcdd
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Fri Dec 5 08:08:03 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 17:59:31 2014 +0530

----------------------------------------------------------------------
 .../concurrent/PartitionValidatorCallable.java  |  3 +-
 .../domain/ContainerClusterContext.java         | 30 ++++++++++
 .../validators/AWSEC2PartitionValidator.java    |  2 +-
 .../CloudstackPartitionValidator.java           |  2 +-
 .../validators/DockerPartitionValidator.java    |  2 +-
 .../validators/GCEPartitionValidator.java       |  2 +-
 .../OpenstackNovaPartitionValidator.java        |  2 +-
 .../iaases/validators/PartitionValidator.java   | 12 +---
 .../validators/VCloudPartitionValidator.java    |  2 +-
 .../impl/CloudControllerServiceImpl.java        | 63 ++++++++++++--------
 .../util/CloudControllerConstants.java          |  2 +
 11 files changed, 80 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
index 0b56eee..7cb88f1 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
@@ -29,6 +29,7 @@ import org.apache.stratos.cloud.controller.domain.Cartridge;
 import org.apache.stratos.cloud.controller.domain.IaasProvider;
 import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
 import org.apache.stratos.cloud.controller.iaases.Iaas;
+import org.apache.stratos.cloud.controller.iaases.validators.IaasBasedPartitionValidator;
 import org.apache.stratos.cloud.controller.iaases.validators.PartitionValidator;
 
 public class PartitionValidatorCallable implements Callable<IaasProvider> {
@@ -75,7 +76,7 @@ public class PartitionValidatorCallable implements Callable<IaasProvider> {
             
         }
         
-        PartitionValidator validator = iaas.getPartitionValidator();
+        IaasBasedPartitionValidator validator = (IaasBasedPartitionValidator) iaas.getPartitionValidator();
         validator.setIaasProvider(iaasProvider);
         IaasProvider updatedIaasProvider =
                                            validator.validate(partition.getId(),

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ContainerClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ContainerClusterContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ContainerClusterContext.java
index de7dd84..fa6e33f 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ContainerClusterContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ContainerClusterContext.java
@@ -31,6 +31,12 @@ public class ContainerClusterContext implements Serializable {
     private static final long serialVersionUID = -388327475844701869L;
     // cluster id this Pod belongs to
     private String clusterId;
+    // partition this member is in.
+    private Partition partition;
+ // instance id - derived from nodeId
+    private String instanceId;
+  //network partition id
+    private String networkPartitionId;
     // properties
     private Properties properties;
     
@@ -55,6 +61,30 @@ public class ContainerClusterContext implements Serializable {
         this.properties = properties;
     }
 
+    public Partition getPartition() {
+        return partition;
+    }
+
+    public void setPartition(Partition partition) {
+        this.partition = partition;
+    }
+
+    public String getInstanceId() {
+        return instanceId;
+    }
+
+    public void setInstanceId(String instanceId) {
+        this.instanceId = instanceId;
+    }
+
+    public String getNetworkPartitionId() {
+        return networkPartitionId;
+    }
+
+    public void setNetworkPartitionId(String networkPartitionId) {
+        this.networkPartitionId = networkPartitionId;
+    }
+
     @Override
     public int hashCode() {
         final int prime = 31;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/AWSEC2PartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/AWSEC2PartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/AWSEC2PartitionValidator.java
index b8ecfdb..17e31ac 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/AWSEC2PartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/AWSEC2PartitionValidator.java
@@ -36,7 +36,7 @@ import java.util.Properties;
  *
  *
  */
-public class AWSEC2PartitionValidator implements PartitionValidator {
+public class AWSEC2PartitionValidator extends IaasBasedPartitionValidator {
     
     private static final Log log = LogFactory.getLog(AWSEC2PartitionValidator.class);
     private IaasProvider iaasProvider;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/CloudstackPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/CloudstackPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/CloudstackPartitionValidator.java
index 9b3d159..4a818a8 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/CloudstackPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/CloudstackPartitionValidator.java
@@ -12,7 +12,7 @@ import org.apache.stratos.messaging.domain.topology.Scope;
 import java.util.Properties;
 
 
-public class CloudstackPartitionValidator implements PartitionValidator {
+public class CloudstackPartitionValidator extends IaasBasedPartitionValidator {
 
 
     private static final Log log = LogFactory.getLog(AWSEC2PartitionValidator.class);

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
index 5c00c4c..73a4e78 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
@@ -33,7 +33,7 @@ import java.util.Properties;
 /**
  * Docker partition validator definition.
  */
-public class DockerPartitionValidator implements PartitionValidator {
+public class DockerPartitionValidator extends IaasBasedPartitionValidator {
     private static final Log log = LogFactory.getLog(AWSEC2Iaas.class);
 
     private IaasProvider iaasProvider;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/GCEPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/GCEPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/GCEPartitionValidator.java
index f1b4556..ada45cd 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/GCEPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/GCEPartitionValidator.java
@@ -31,7 +31,7 @@ import org.apache.stratos.cloud.controller.domain.IaasProvider;
  * The VCloud {@link PartitionValidator} implementation.
  *
  */
-public class GCEPartitionValidator implements PartitionValidator {
+public class GCEPartitionValidator extends IaasBasedPartitionValidator {
     
     private static final Log log = LogFactory.getLog(VCloudPartitionValidator.class);
     private IaasProvider iaasProvider;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/OpenstackNovaPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/OpenstackNovaPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/OpenstackNovaPartitionValidator.java
index 1983e08..a385062 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/OpenstackNovaPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/OpenstackNovaPartitionValidator.java
@@ -36,7 +36,7 @@ import java.util.Properties;
  *
  *
  */
-public class OpenstackNovaPartitionValidator implements PartitionValidator {
+public class OpenstackNovaPartitionValidator extends IaasBasedPartitionValidator {
     
     private static final Log log = LogFactory.getLog(OpenstackNovaPartitionValidator.class);
     private IaasProvider iaasProvider;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/PartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/PartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/PartitionValidator.java
index 162713a..ed29c2d 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/PartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/PartitionValidator.java
@@ -21,27 +21,19 @@ package org.apache.stratos.cloud.controller.iaases.validators;
 import java.util.Properties;
 
 import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
-import org.apache.stratos.cloud.controller.domain.IaasProvider;
 
 /**
  * All the Partition Validators should implement this interface.
  *
- *
  */
 public interface PartitionValidator {
     
     /**
-     * set the IaasProvider reference.
-     * @param iaas {@link IaasProvider}
-     */
-    public void setIaasProvider(IaasProvider iaas);
-
-    /**
      * Validate the given properties for its existent in this partition.
      * @param partitionId partition id.
      * @param properties set of properties to be validated.
-     * @return cloned and modified {@link IaasProvider} which maps to the given partition. 
+     * @return cloned and modified {@link Object} which maps to the given partition. 
      * @throws InvalidPartitionException if at least one property is evaluated to be invalid.
      */
-    public IaasProvider validate(String partitionId, Properties properties) throws InvalidPartitionException;
+    public Object validate(String partitionId, Properties properties) throws InvalidPartitionException;
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/VCloudPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/VCloudPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/VCloudPartitionValidator.java
index 8af42d7..21b3417 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/VCloudPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/VCloudPartitionValidator.java
@@ -31,7 +31,7 @@ import org.apache.stratos.cloud.controller.domain.IaasProvider;
  * The VCloud {@link PartitionValidator} implementation.
  *
  */
-public class VCloudPartitionValidator implements PartitionValidator {
+public class VCloudPartitionValidator extends IaasBasedPartitionValidator {
     
     @SuppressWarnings("unused")
 	private static final Log log = LogFactory.getLog(VCloudPartitionValidator.class);

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index 3b5eef5..3049735 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -45,6 +45,8 @@ import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
 import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
 import org.apache.stratos.cloud.controller.util.PodActivationWatcher;
 import org.apache.stratos.common.Property;
+import org.apache.stratos.cloud.controller.iaases.validators.IaasBasedPartitionValidator;
+import org.apache.stratos.cloud.controller.iaases.validators.KubernetesBasedPartitionValidator;
 import org.apache.stratos.common.constants.StratosConstants;
 import org.apache.stratos.common.kubernetes.KubernetesGroup;
 import org.apache.stratos.common.kubernetes.KubernetesHost;
@@ -1045,40 +1047,51 @@ public class CloudControllerServiceImpl implements CloudControllerService {
     @Override
     public boolean validatePartition(Partition partition) throws InvalidPartitionException {
         handleNullObject(partition, "Partition validation failed. Partition is null.");
+
         String provider = partition.getProvider();
-        handleNullObject(provider, "Partition [" + partition.getId() + "] validation failed. Partition provider is null.");
-        IaasProvider iaasProvider = CloudControllerConfig.getInstance().getIaasProvider(provider);
+        String partitionId = partition.getId();
+        Properties partitionProperties = CloudControllerUtil.toJavaUtilProperties(partition.getProperties());
 
-        if (iaasProvider == null) {
-            String msg =
-                    "Invalid Partition - " + partition.toString() + ". Cause: Iaas Provider " +
-                            "is null for Partition Provider: " + provider;
-            log.error(msg);
-            throw new InvalidPartitionException(msg);
-        }
+        handleNullObject(provider, "Partition [" + partitionId + "] validation failed. Partition provider is null.");
+        IaasProvider iaasProvider = CloudControllerConfig.getInstance().getIaasProvider(provider);
 
-        Iaas iaas = iaasProvider.getIaas();
+        if (iaasProvider != null) {
+            // if this is a IaaS based partition
+            Iaas iaas = iaasProvider.getIaas();
 
-        if (iaas == null) {
+            if (iaas == null) {
 
-            try {
-                iaas = CloudControllerUtil.getIaas(iaasProvider);
-            } catch (InvalidIaasProviderException e) {
-                String msg =
-                        "Invalid Partition - " + partition.toString() +
-                                ". Cause: Unable to build Iaas of this IaasProvider [Provider] : " + provider + ". " + e.getMessage();
-                log.error(msg, e);
-                throw new InvalidPartitionException(msg, e);
+                try {
+                    iaas = CloudControllerUtil.getIaas(iaasProvider);
+                } catch (InvalidIaasProviderException e) {
+                    String msg =
+                            "Invalid Partition - " + partition.toString()
+                                    + ". Cause: Unable to build Iaas of this IaasProvider [Provider] : " + provider
+                                    + ". " + e.getMessage();
+                    log.error(msg, e);
+                    throw new InvalidPartitionException(msg, e);
+                }
             }
 
-        }
+            IaasBasedPartitionValidator validator = (IaasBasedPartitionValidator) iaas.getPartitionValidator();
+            validator.setIaasProvider(iaasProvider);
+            validator.validate(partitionId, partitionProperties);
+            return true;
+
+        } else if (CloudControllerConstants.DOCKER_PARTITION_PROVIDER.equals(provider)) {
+            // if this is a docker based Partition
+            KubernetesBasedPartitionValidator validator = new KubernetesBasedPartitionValidator();
+            validator.validate(partitionId, partitionProperties);
+            return true;
 
-        PartitionValidator validator = iaas.getPartitionValidator();
-        validator.setIaasProvider(iaasProvider);
-        validator.validate(partition.getId(),
-                CloudControllerUtil.toJavaUtilProperties(partition.getProperties()));
+        } else {
+
+            String msg =
+                    "Invalid Partition - " + partition.toString() + ". Cause: Cannot identify as a valid partition.";
+            log.error(msg);
+            throw new InvalidPartitionException(msg);
+        }
 
-        return true;
     }
 
     public ClusterContext getClusterContext(String clusterId) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/c2fc25fb/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerConstants.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerConstants.java
index 21664e2..f15e450 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerConstants.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerConstants.java
@@ -294,4 +294,6 @@ public final class CloudControllerConstants {
      */
     public static final int PORT_RANGE_MAX = 65535;
     public static final int PORT_RANGE_MIN = 1;
+    
+    public static final String DOCKER_PARTITION_PROVIDER = "docker";
 }


[09/16] stratos git commit: Resolving conflicts

Posted by ni...@apache.org.
Resolving conflicts


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/826bc65b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/826bc65b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/826bc65b

Branch: refs/heads/master
Commit: 826bc65bd56f37e3a60c66767ee45b59f85cd9ca
Parents: 2b5cbd8
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sat Dec 6 18:17:29 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:00:49 2014 +0530

----------------------------------------------------------------------
 .../AutoscalerTopologyEventReceiver.java        | 65 ++++++++------------
 1 file changed, 27 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/826bc65b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java
index 3cf6d81..fff3b73 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java
@@ -433,44 +433,33 @@ public class AutoscalerTopologyEventReceiver {
 
                        if (service != null) {
                            Cluster cluster = service.getCluster(clusterInstanceCreatedEvent.getClusterId());
-                           if (cluster != null) {
-                               try {
-                                   if (cluster.isKubernetesCluster()) {
-                                       clusterMonitor.setClusterContext(
-                                               ClusterContextFactory.getKubernetesClusterContext(
-                                                       instanceId,
-                                                       cluster));
-                                   } else {
-                                       VMClusterContext clusterContext =
-                                               (VMClusterContext) clusterMonitor.getClusterContext();
-                                       if (clusterContext == null) {
-                                           clusterContext = ClusterContextFactory.
-                                                   getVMClusterContext(instanceId,
-                                                           cluster);
-                                           clusterMonitor.setClusterContext(clusterContext);
-
-                                       }
-                                       clusterContext.addInstanceContext(instanceId, cluster);
-                                       if (clusterMonitor.getInstance(instanceId) == null) {
-                                           //adding the same instance in topology to monitor as a reference
-                                           ClusterInstance clusterInstance1 = cluster.
-                                                   getInstanceContexts(instanceId);
-                                           clusterMonitor.addInstance(clusterInstance1);
-                                       }
-
-
-                                   }
-                                   if (clusterMonitor.hasMonitoringStarted().compareAndSet(false, true)) {
-                                       clusterMonitor.startScheduler();
-                                       log.info("Monitoring task for Cluster Monitor with cluster id " +
-                                               clusterInstanceCreatedEvent.getClusterId() + " started successfully");
-                                   }
-                               } catch (PolicyValidationException e) {
-                                   log.error(e.getMessage(), e);
-                               } catch (PartitionValidationException e) {
-                                   log.error(e.getMessage(), e);
-                               }
-                           }
+                            if (cluster != null) {
+                                try {
+                                    VMClusterContext clusterContext =
+                                            (VMClusterContext) clusterMonitor.getClusterContext();
+                                    if (clusterContext == null) {
+                                        clusterContext = ClusterContextFactory.getVMClusterContext(instanceId, cluster);
+                                        clusterMonitor.setClusterContext(clusterContext);
+
+                                    }
+                                    clusterContext.addInstanceContext(instanceId, cluster);
+                                    if (clusterMonitor.getInstance(instanceId) == null) {
+                                        // adding the same instance in topology to monitor as a reference
+                                        ClusterInstance clusterInstance1 = cluster.getInstanceContexts(instanceId);
+                                        clusterMonitor.addInstance(clusterInstance1);
+                                    }
+
+                                    if (clusterMonitor.hasMonitoringStarted().compareAndSet(false, true)) {
+                                        clusterMonitor.startScheduler();
+                                        log.info("Monitoring task for Cluster Monitor with cluster id "
+                                                + clusterInstanceCreatedEvent.getClusterId() + " started successfully");
+                                    }
+                                } catch (PolicyValidationException e) {
+                                    log.error(e.getMessage(), e);
+                                } catch (PartitionValidationException e) {
+                                    log.error(e.getMessage(), e);
+                                }
+                            }
 
                        } else {
                            log.error("Service " + clusterInstanceCreatedEvent.getServiceName() +


[10/16] stratos git commit: Porting container APIs with grouping changes.

Posted by ni...@apache.org.
Porting container APIs with grouping changes.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/2e9edf45
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/2e9edf45
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/2e9edf45

Branch: refs/heads/master
Commit: 2e9edf4579418e831b3a6e0e8b28e62ca6265530
Parents: 1821ee0
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sun Dec 7 12:50:24 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:00:49 2014 +0530

----------------------------------------------------------------------
 .../client/CloudControllerClient.java           |   4 +-
 .../domain/KubernetesClusterContext.java        | 160 +++++++++----------
 .../impl/CloudControllerServiceImpl.java        |  81 +++++++---
 .../impl/CloudControllerServiceUtil.java        |   2 +
 .../controller/util/CloudControllerUtil.java    |  43 +++--
 .../common/constants/StratosConstants.java      |   2 +
 6 files changed, 171 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/2e9edf45/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
index bf68913..e902dfb 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
@@ -197,7 +197,7 @@ public class CloudControllerClient {
             isPrimaryProp.setValue(String.valueOf(isPrimary));
 
             Property minCountProp = new Property();
-            minCountProp.setName("MIN_COUNT");
+            minCountProp.setName(StratosConstants.MIN_COUNT);
             minCountProp.setValue(String.valueOf(minMemberCount));
 
             memberContextProps.addProperty(isPrimaryProp);
@@ -381,7 +381,7 @@ public class CloudControllerClient {
             isPrimaryProp.setValue(String.valueOf(isPrimary));
 
             Property minCountProp = new Property();
-            minCountProp.setName("MIN_COUNT");
+            minCountProp.setName(StratosConstants.MIN_COUNT);
             minCountProp.setValue(String.valueOf(minMemberCount));
 
             memberContextProps.addProperty(isPrimaryProp);

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e9edf45/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java
index 1f19271..a92db26 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java
@@ -38,26 +38,31 @@ public class KubernetesClusterContext implements Serializable {
 	
 	// id of the Kubernetes cluster
     private String kubernetesClusterId;
-    // available host port range, delimited by a hyphen
-    private String hostPortRange;
+    private int upperPort;
+    private int lowerPort;
     // kubernetes master ip
     private String masterIp;
+    private String masterPort;
     // available list of ports
     private List<Integer> availableHostPorts;
     // kubernetes client API instance
     private transient KubernetesApiClient kubApi;
     
-    public KubernetesClusterContext(String id, String portRange, String masterIp) {
+    public KubernetesClusterContext(String id, String masterIp, String masterPort, int upperPort, int lowerPort) {
     	availableHostPorts = new ArrayList<Integer>();
+    	this.upperPort = upperPort;
+    	this.lowerPort = lowerPort;
+    	// populate the ports
+        populatePorts(lowerPort, upperPort);
     	this.kubernetesClusterId = id;
-    	this.hostPortRange = portRange;
     	this.masterIp = masterIp;
-    	this.setKubApi(new KubernetesApiClient(getEndpoint(masterIp)));
+    	this.masterPort = masterPort;
+    	this.setKubApi(new KubernetesApiClient(getEndpoint(masterIp, masterPort)));
     	
 	}
     
-	private String getEndpoint(String ip) {
-		return "http://"+ip+":8080/api/v1beta1/";
+	private String getEndpoint(String ip, String port) {
+		return "http://"+ip+":"+port+"/api/v1beta1/";
 	}
 
 	public String getKubernetesClusterId() {
@@ -67,14 +72,6 @@ public class KubernetesClusterContext implements Serializable {
 		this.kubernetesClusterId = kubernetesClusterId;
 	}
 
-	public String getHostPortRange() {
-		return hostPortRange;
-	}
-
-	public void setHostPortRange(String hostPortRange) {
-		this.hostPortRange = hostPortRange;
-	}
-
 	public List<Integer> getAvailableHostPorts() {
 		return availableHostPorts;
 	}
@@ -83,30 +80,10 @@ public class KubernetesClusterContext implements Serializable {
 		this.availableHostPorts = availableHostPorts;
 	}
 	
-	private int[] portBoundaries() {
-		String[] portStrings = hostPortRange.split("-");
-		int[] portInts = new int[2];
-		portInts[0] = Integer.parseInt(portStrings[0]);
-		portInts[1] = Integer.parseInt(portStrings[1]);
-		return portInts;
-	}
-	
 	public int getAnAvailableHostPort() {
-		int[] ports = {4000, 5000};
-		if (availableHostPorts.isEmpty()) {
-			try {
-
-				ports = portBoundaries();
-			} catch (Exception ignore) {
-				// on an exception, we use the default range
-				log.warn("Unable to find a port range, hence using the default. [4000-5000]"
-						+ " Exception");
-			}
-
-			// populate the ports
-			populatePorts(ports[0], ports[1]);
-		}
-		
+	    if (availableHostPorts.isEmpty()) {
+	        return -1;
+	    }
 		return availableHostPorts.remove(0);
 	}
 	
@@ -133,7 +110,7 @@ public class KubernetesClusterContext implements Serializable {
 
 	public KubernetesApiClient getKubApi() {
 		if (kubApi == null) {
-			kubApi = new KubernetesApiClient(getEndpoint(masterIp));
+			kubApi = new KubernetesApiClient(getEndpoint(masterIp, masterPort));
 		}
 		return kubApi;
 	}
@@ -142,46 +119,69 @@ public class KubernetesClusterContext implements Serializable {
 		this.kubApi = kubApi;
 	}
 
-	@Override
-	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result
-				+ ((hostPortRange == null) ? 0 : hostPortRange.hashCode());
-		result = prime
-				* result
-				+ ((kubernetesClusterId == null) ? 0 : kubernetesClusterId
-						.hashCode());
-		result = prime * result
-				+ ((masterIp == null) ? 0 : masterIp.hashCode());
-		return result;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-		KubernetesClusterContext other = (KubernetesClusterContext) obj;
-		if (hostPortRange == null) {
-			if (other.hostPortRange != null)
-				return false;
-		} else if (!hostPortRange.equals(other.hostPortRange))
-			return false;
-		if (kubernetesClusterId == null) {
-			if (other.kubernetesClusterId != null)
-				return false;
-		} else if (!kubernetesClusterId.equals(other.kubernetesClusterId))
-			return false;
-		if (masterIp == null) {
-			if (other.masterIp != null)
-				return false;
-		} else if (!masterIp.equals(other.masterIp))
-			return false;
-		return true;
-	}
+	public int getUpperPort() {
+        return upperPort;
+    }
+
+    public void setUpperPort(int upperPort) {
+        this.upperPort = upperPort;
+    }
+
+    public int getLowerPort() {
+        return lowerPort;
+    }
+
+    public void setLowerPort(int lowerPort) {
+        this.lowerPort = lowerPort;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((availableHostPorts == null) ? 0 : availableHostPorts.hashCode());
+        result = prime * result + ((kubernetesClusterId == null) ? 0 : kubernetesClusterId.hashCode());
+        result = prime * result + lowerPort;
+        result = prime * result + ((masterIp == null) ? 0 : masterIp.hashCode());
+        result = prime * result + ((masterPort == null) ? 0 : masterPort.hashCode());
+        result = prime * result + upperPort;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        KubernetesClusterContext other = (KubernetesClusterContext) obj;
+        if (availableHostPorts == null) {
+            if (other.availableHostPorts != null)
+                return false;
+        } else if (!availableHostPorts.equals(other.availableHostPorts))
+            return false;
+        if (kubernetesClusterId == null) {
+            if (other.kubernetesClusterId != null)
+                return false;
+        } else if (!kubernetesClusterId.equals(other.kubernetesClusterId))
+            return false;
+        if (lowerPort != other.lowerPort)
+            return false;
+        if (masterIp == null) {
+            if (other.masterIp != null)
+                return false;
+        } else if (!masterIp.equals(other.masterIp))
+            return false;
+        if (masterPort == null) {
+            if (other.masterPort != null)
+                return false;
+        } else if (!masterPort.equals(other.masterPort))
+            return false;
+        if (upperPort != other.upperPort)
+            return false;
+        return true;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e9edf45/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index b8fd6c5..1679e3f 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -51,6 +51,7 @@ import org.apache.stratos.common.constants.StratosConstants;
 import org.apache.stratos.common.kubernetes.KubernetesGroup;
 import org.apache.stratos.common.kubernetes.KubernetesHost;
 import org.apache.stratos.common.kubernetes.KubernetesMaster;
+import org.apache.stratos.common.kubernetes.PortRange;
 import org.apache.stratos.kubernetes.client.KubernetesApiClient;
 import org.apache.stratos.kubernetes.client.exceptions.KubernetesClientException;
 import org.apache.stratos.kubernetes.client.model.Label;
@@ -1082,6 +1083,9 @@ public class CloudControllerServiceImpl implements CloudControllerService {
 
             String clusterId = containerClusterContext.getClusterId();
             handleNullObject(clusterId, "Container start-up failed. Cluster id is null.");
+            
+            Partition partition = containerClusterContext.getPartition();
+            handleNullObject(partition, "Container start-up failed. Null partition found in ContainerClusterContext.");
 
             if (log.isDebugEnabled()) {
                 log.debug("Received a container spawn request : " + containerClusterContext.toString());
@@ -1102,13 +1106,28 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             }
 
             try {
-                String minReplicas = validateProperty(StratosConstants.KUBERNETES_MIN_REPLICAS, ctxt);
-                String kubernetesClusterId = validateProperty(StratosConstants.KUBERNETES_CLUSTER_ID, ctxt);
-                String kubernetesMasterIp = validateProperty(StratosConstants.KUBERNETES_MASTER_IP, containerClusterContext);
-                String kubernetesPortRange = validateProperty(StratosConstants.KUBERNETES_PORT_RANGE, containerClusterContext);
+                String minReplicas =
+                        validateProperty(StratosConstants.MIN_COUNT, containerClusterContext.getProperties(),
+                                containerClusterContext.toString());
+                String kubernetesClusterId =
+                        validateProperty(StratosConstants.KUBERNETES_CLUSTER_ID, partition.getProperties(),
+                                partition.toString());
+
+                KubernetesGroup kubernetesGroup =
+                        CloudControllerContext.getInstance().getKubernetesGroup(kubernetesClusterId);
+                handleNullObject(kubernetesGroup, "Container start-up failed. Kubernetes group not found for id: "
+                        + kubernetesClusterId);
+
+                String kubernetesMasterIp = kubernetesGroup.getKubernetesMaster().getHostIpAddress();
+                PortRange kubernetesPortRange = kubernetesGroup.getPortRange();
+                // optional
+                String kubernetesMasterPort =
+                        CloudControllerUtil.getProperty(kubernetesGroup.getKubernetesMaster().getProperties(),
+                                StratosConstants.KUBERNETES_MASTER_PORT,
+                                StratosConstants.KUBERNETES_MASTER_DEFAULT_PORT);
 
                 KubernetesClusterContext kubClusterContext = getKubernetesClusterContext(kubernetesClusterId,
-                        kubernetesMasterIp, kubernetesPortRange);
+                        kubernetesMasterIp, kubernetesMasterPort, kubernetesPortRange.getLower(), kubernetesPortRange.getUpper());
                 KubernetesApiClient kubApi = kubClusterContext.getKubApi();
 
                 // first let's create a replication controller.
@@ -1227,27 +1246,45 @@ public class CloudControllerServiceImpl implements CloudControllerService {
         }
     }
 
-    private String validateProperty(String property, ClusterContext ctxt) {
-
-        String propVal = CloudControllerUtil.getProperty(ctxt.getProperties(), property);
-        handleNullObject(propVal, "Property validation failed. Cannot find '" + property + "' in " + ctxt);
-        return propVal;
-    }
-
-    private String validateProperty(String property, ContainerClusterContext ctxt) {
+//    private String validateProperty(String property, ClusterContext ctxt) {
+//
+//        String propVal = CloudControllerUtil.getProperty(ctxt.getProperties(), property);
+//        handleNullObject(propVal, "Property validation failed. Cannot find '" + property + "' in " + ctxt);
+//        return propVal;
+//    }
+//
+//    private String validateProperty(String property, ContainerClusterContext ctxt) {
+//
+//        String propVal = CloudControllerUtil.getProperty(ctxt.getProperties(), property);
+//        handleNullObject(propVal, "Property validation failed. Cannot find '" + property + "' in " + ctxt);
+//        return propVal;
+//
+//    }
+//    
+//    private String validateProperty(String property, Partition partition) {
+//
+//        String propVal = CloudControllerUtil.getProperty(partition.getProperties(), property);
+//        handleNullObject(propVal, "Property validation failed. Cannot find property: '" + property);
+//        return propVal;
+//
+//    }
+    
+    private String validateProperty(String property, org.apache.stratos.common.Properties properties, String object) {
 
-        String propVal = CloudControllerUtil.getProperty(ctxt.getProperties(), property);
-        handleNullObject(propVal, "Property validation failed. '" + property + "' in " + ctxt);
+        String propVal = CloudControllerUtil.getProperty(properties, property);
+        handleNullObject(propVal, "Property validation failed. Cannot find property: '" + property+ " in "+object);
         return propVal;
 
     }
 
-    private KubernetesClusterContext getKubernetesClusterContext(
-            String kubernetesClusterId, String kubernetesMasterIp,
-            String kubernetesPortRange) {
+    private KubernetesClusterContext getKubernetesClusterContext(String kubernetesClusterId, String kubernetesMasterIp,
+            String kubernetesMasterPort, int upperPort, int lowerPort) {
 
-        KubernetesClusterContext origCtxt = CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesClusterId);
-        KubernetesClusterContext newCtxt = new KubernetesClusterContext(kubernetesClusterId, kubernetesPortRange, kubernetesMasterIp);
+        KubernetesClusterContext origCtxt =
+                CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesClusterId);
+        KubernetesClusterContext newCtxt =
+                new KubernetesClusterContext(kubernetesClusterId, kubernetesMasterIp,
+                        kubernetesMasterPort, upperPort, lowerPort);
 
         if (origCtxt == null) {
             CloudControllerContext.getInstance().addKubernetesClusterContext(newCtxt);
@@ -1385,7 +1422,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             }
 
             try {
-                String kubernetesClusterId = validateProperty(StratosConstants.KUBERNETES_CLUSTER_ID, ctxt);
+                String kubernetesClusterId = validateProperty(StratosConstants.KUBERNETES_CLUSTER_ID, ctxt.getProperties(), ctxt.toString());
 
                 KubernetesClusterContext kubClusterContext = CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesClusterId);
 
@@ -1555,7 +1592,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             }
         }
     }
-
+    
     private void handleNullObject(Object obj, String errorMsg) {
         if (obj == null) {
             log.error(errorMsg);

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e9edf45/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
index 4fbf294..b992643 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
@@ -27,6 +27,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.context.CloudControllerContext;
 import org.apache.stratos.cloud.controller.domain.ClusterContext;
+import org.apache.stratos.cloud.controller.domain.ContainerClusterContext;
 import org.apache.stratos.cloud.controller.domain.IaasProvider;
 import org.apache.stratos.cloud.controller.domain.MemberContext;
 import org.apache.stratos.cloud.controller.domain.Partition;
@@ -197,4 +198,5 @@ public class CloudControllerServiceUtil {
         validatePartitionAndGetIaasProvider(partition, iaasProvider);
         return true;
     }
+    
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e9edf45/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
index 2e4e505..82baef8 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
@@ -295,9 +295,15 @@ public class CloudControllerUtil {
     	
     }
 	
-	public static String getProperty(Properties properties, String key) {
-    	if (key != null && properties != null) {
-    	    for (Iterator<Entry<Object, Object>> iterator = properties.entrySet().iterator(); iterator.hasNext();) {
+    public static String getProperty(org.apache.stratos.common.Properties properties, String key, String defaultValue) {
+        Properties props = toJavaUtilProperties(properties);
+
+        return getProperty(props, key, defaultValue);
+    }
+
+    public static String getProperty(Properties properties, String key, String defaultValue) {
+        if (key != null && properties != null) {
+            for (Iterator<Entry<Object, Object>> iterator = properties.entrySet().iterator(); iterator.hasNext();) {
                 Entry<Object, Object> type = (Entry<Object, Object>) iterator.next();
                 String propName = type.getKey().toString();
                 String propValue = type.getValue().toString();
@@ -305,25 +311,28 @@ public class CloudControllerUtil {
                     return propValue;
                 }
             }
-    	}
-    	
-    	return null;
+        }
+
+        return defaultValue;
     }
-	
-	public static String getProperty(org.apache.stratos.common.Properties properties, String key) {
-		Properties props = toJavaUtilProperties(properties);
-		
-		return getProperty(props, key);
-	}
-	
-    public static org.apache.stratos.common.Properties addProperty(
-            org.apache.stratos.common.Properties properties, String key, String value) {
+
+    public static String getProperty(Properties properties, String key) {
+        return getProperty(properties, key, null);
+    }
+
+    public static String getProperty(org.apache.stratos.common.Properties properties, String key) {
+        Properties props = toJavaUtilProperties(properties);
+
+        return getProperty(props, key);
+    }
+
+    public static org.apache.stratos.common.Properties addProperty(org.apache.stratos.common.Properties properties,
+            String key, String value) {
         Property property = new Property();
         property.setName(key);
         property.setValue(value);
 
-        org.apache.stratos.common.Properties newProperties =
-                new org.apache.stratos.common.Properties();
+        org.apache.stratos.common.Properties newProperties = new org.apache.stratos.common.Properties();
         newProperties.setProperties(ArrayUtils.add(properties.getProperties(), property));
         return newProperties;
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e9edf45/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 df9dec2..d6bf002 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
@@ -149,6 +149,8 @@ public class StratosConstants {
     public static final String KUBERNETES_CLUSTER_ID = "KUBERNETES_CLUSTER_ID";
     public static final String KUBERNETES_DEPLOYER_TYPE = "kubernetes";
     public static final String KUBERNETES_MASTER_IP = "KUBERNETES_MASTER_IP";
+    public static final String KUBERNETES_MASTER_PORT = "KUBERNETES_MASTER_PORT";
+    public static final String KUBERNETES_MASTER_DEFAULT_PORT = "8080";
     public static final String KUBERNETES_MIN_REPLICAS = "KUBERNETES_REPLICAS_MIN";
     public static final String KUBERNETES_MAX_REPLICAS = "KUBERNETES_REPLICAS_MAX";
     public static final String KUBERNETES_PORT_RANGE = "KUBERNETES_PORT_RANGE";


[03/16] stratos git commit: Fixing startContainers after removal of Kub from AS.

Posted by ni...@apache.org.
Fixing startContainers after removal of Kub from AS.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/f0f5590d
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/f0f5590d
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/f0f5590d

Branch: refs/heads/master
Commit: f0f5590d28498cfc6bade328f358a6f28041bccf
Parents: 1ac296f
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Thu Dec 4 11:55:26 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 17:59:31 2014 +0530

----------------------------------------------------------------------
 .../client/CloudControllerClient.java           | 45 ++++++++++----------
 1 file changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/f0f5590d/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
index 8bc60fa..854e80f 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java
@@ -358,26 +358,26 @@ public class CloudControllerClient {
     public synchronized MemberContext[] startContainers(String kubernetesClusterId, String clusterId) throws SpawningException {
         try {
 
-            KubernetesManager kubernetesManager = KubernetesManager.getInstance();
-            KubernetesMaster kubernetesMaster = kubernetesManager.getKubernetesMasterInGroup(kubernetesClusterId);
-            String kubernetesMasterIP = kubernetesMaster.getHostIpAddress();
-            KubernetesGroup kubernetesGroup = kubernetesManager.getKubernetesGroup(kubernetesClusterId);
-            int lower = kubernetesGroup.getPortRange().getLower();
-            int upper = kubernetesGroup.getPortRange().getUpper();
-            String portRange = Integer.toString(lower) + "-" + Integer.toString(upper);
+//            KubernetesManager kubernetesManager = KubernetesManager.getInstance();
+//            KubernetesMaster kubernetesMaster = kubernetesManager.getKubernetesMasterInGroup(kubernetesClusterId);
+//            String kubernetesMasterIP = kubernetesMaster.getHostIpAddress();
+//            KubernetesGroup kubernetesGroup = kubernetesManager.getKubernetesGroup(kubernetesClusterId);
+//            int lower = kubernetesGroup.getPortRange().getLower();
+//            int upper = kubernetesGroup.getPortRange().getUpper();
+//            String portRange = Integer.toString(lower) + "-" + Integer.toString(upper);
 
             ContainerClusterContext context = new ContainerClusterContext();
             context.setClusterId(clusterId);
-            Properties memberContextProps = new Properties();
-            Property kubernetesClusterMasterIPProps = new Property();
-            kubernetesClusterMasterIPProps.setName(StratosConstants.KUBERNETES_MASTER_IP);
-            kubernetesClusterMasterIPProps.setValue(kubernetesMasterIP);
-            memberContextProps.addProperty(kubernetesClusterMasterIPProps);
-            Property kubernetesClusterPortRangeProps = new Property();
-            kubernetesClusterPortRangeProps.setName(StratosConstants.KUBERNETES_PORT_RANGE);
-            kubernetesClusterPortRangeProps.setValue(portRange);
-            memberContextProps.addProperty(kubernetesClusterPortRangeProps);
-            context.setProperties(AutoscalerUtil.toStubProperties(memberContextProps));
+//            Properties memberContextProps = new Properties();
+//            Property kubernetesClusterMasterIPProps = new Property();
+//            kubernetesClusterMasterIPProps.setName(StratosConstants.KUBERNETES_MASTER_IP);
+//            kubernetesClusterMasterIPProps.setValue(kubernetesMasterIP);
+//            memberContextProps.addProperty(kubernetesClusterMasterIPProps);
+//            Property kubernetesClusterPortRangeProps = new Property();
+//            kubernetesClusterPortRangeProps.setName(StratosConstants.KUBERNETES_PORT_RANGE);
+//            kubernetesClusterPortRangeProps.setValue(portRange);
+//            memberContextProps.addProperty(kubernetesClusterPortRangeProps);
+//            context.setProperties(AutoscalerUtil.toStubProperties(memberContextProps));
             long startTime = System.currentTimeMillis();
             MemberContext[] memberContexts = stub.startContainers(context);
 
@@ -394,11 +394,12 @@ public class CloudControllerClient {
         	String msg = "Error while creating containers, couldn't communicate with cloud controller service";
         	log.error(msg, e);
         	throw new SpawningException(msg, e);
-        } catch (NonExistingKubernetesGroupException e) {
-        	String msg = String.format("Error while creating containers, invalid kubernetes group [%s] ", kubernetesClusterId);
-        	log.error(msg, e);
-        	throw new SpawningException(msg, e);
-        }
+        } 
+//        catch (NonExistingKubernetesGroupException e) {
+//        	String msg = String.format("Error while creating containers, invalid kubernetes group [%s] ", kubernetesClusterId);
+//        	log.error(msg, e);
+//        	throw new SpawningException(msg, e);
+//        }
     }
 
     public synchronized void terminateAllContainers(String clusterId) throws TerminationException {


[07/16] stratos git commit: Service wsdl changes related to partition validation

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/d3fcf9bc/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl b/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
index c8f122a..6e88f50 100644
--- a/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
+++ b/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
@@ -1,472 +1,424 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
-                  xmlns:ax29="http://kubernetes.common.stratos.apache.org/xsd"
-                  xmlns:ns="http://impl.services.controller.cloud.stratos.apache.org"
-                  xmlns:ax27="http://topology.domain.messaging.stratos.apache.org/xsd"
-                  xmlns:ax25="http://common.stratos.apache.org/xsd"
-                  xmlns:ax23="http://domain.controller.cloud.stratos.apache.org/xsd"
-                  xmlns:ax21="http://exception.controller.cloud.stratos.apache.org/xsd"
-                  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd"
-                  xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
-                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
-                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
-                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
-                  targetNamespace="http://impl.services.controller.cloud.stratos.apache.org">
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://impl.services.controller.cloud.stratos.apache.org" xmlns:ax27="http://kubernetes.common.stratos.apache.org/xsd" xmlns:ax23="http://domain.controller.cloud.stratos.apache.org/xsd" xmlns:ax24="http://common.stratos.apache.org/xsd" xmlns:ax21="http://exception.controller.cloud.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:ax210="http://topology.domain.messaging.stratos.apache.org/xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.controller.cloud.stratos.apache.org">
     <wsdl:types>
-        <xs:schema xmlns:ax28="http://topology.domain.messaging.stratos.apache.org/xsd"
-                   xmlns:ax211="http://kubernetes.common.stratos.apache.org/xsd"
-                   xmlns:ax24="http://domain.controller.cloud.stratos.apache.org/xsd"
-                   xmlns:ax22="http://exception.controller.cloud.stratos.apache.org/xsd"
-                   attributeFormDefault="qualified" elementFormDefault="qualified"
-                   targetNamespace="http://impl.services.controller.cloud.stratos.apache.org">
+        <xs:schema xmlns:ax29="http://kubernetes.common.stratos.apache.org/xsd" xmlns:ax26="http://domain.controller.cloud.stratos.apache.org/xsd" xmlns:ax211="http://topology.domain.messaging.stratos.apache.org/xsd" xmlns:ax22="http://exception.controller.cloud.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.controller.cloud.stratos.apache.org">
             <xs:import namespace="http://exception.controller.cloud.stratos.apache.org/xsd"/>
             <xs:import namespace="http://domain.controller.cloud.stratos.apache.org/xsd"/>
-            <xs:import namespace="http://topology.domain.messaging.stratos.apache.org/xsd"/>
             <xs:import namespace="http://kubernetes.common.stratos.apache.org/xsd"/>
-            <xs:element name="CloudControllerServiceInvalidServiceGroupException">
+            <xs:import namespace="http://topology.domain.messaging.stratos.apache.org/xsd"/>
+            <xs:element name="CloudControllerServiceInvalidPartitionException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidServiceGroupException" nillable="true"
-                                    type="ax21:InvalidServiceGroupException"/>
+                        <xs:element minOccurs="0" name="InvalidPartitionException" nillable="true" type="ax21:InvalidPartitionException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroup">
+            <xs:element name="validatePartition">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="partition" nillable="true" type="ax26:Partition"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupResponse">
+            <xs:element name="validatePartitionResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax23:ServiceGroup"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
             <xs:element name="CloudControllerServiceInvalidCartridgeTypeException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidCartridgeTypeException" nillable="true"
-                                    type="ax21:InvalidCartridgeTypeException"/>
+                        <xs:element minOccurs="0" name="InvalidCartridgeTypeException" nillable="true" type="ax21:InvalidCartridgeTypeException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="undeployCartridgeDefinition">
+            <xs:element name="validateDeploymentPolicy">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax26:Partition"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="deployServiceGroup">
+            <xs:element name="validateDeploymentPolicyResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax23:ServiceGroup"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="undeployServiceGroup">
+            <xs:element name="CloudControllerServiceInvalidKubernetesMasterException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="InvalidKubernetesMasterException" nillable="true" type="ax21:InvalidKubernetesMasterException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupSubGroups">
+            <xs:element name="CloudControllerServiceNonExistingKubernetesMasterException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="NonExistingKubernetesMasterException" nillable="true" type="ax21:NonExistingKubernetesMasterException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupSubGroupsResponse">
+            <xs:element name="updateKubernetesMaster">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="kubernetesMaster" nillable="true" type="ax29:KubernetesMaster"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupCartridges">
+            <xs:element name="updateKubernetesMasterResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupCartridgesResponse">
+            <xs:element name="CloudControllerServiceInvalidKubernetesHostException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="InvalidKubernetesHostException" nillable="true" type="ax21:InvalidKubernetesHostException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupDependencies">
+            <xs:element name="CloudControllerServiceNonExistingKubernetesHostException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="NonExistingKubernetesHostException" nillable="true" type="ax21:NonExistingKubernetesHostException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupDependenciesResponse">
+            <xs:element name="updateKubernetesHost">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax23:Dependencies"/>
+                        <xs:element minOccurs="0" name="kubernetesHost" nillable="true" type="ax29:KubernetesHost"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceUnregisteredCartridgeException">
+            <xs:element name="updateKubernetesHostResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="UnregisteredCartridgeException" nillable="true"
-                                    type="ax21:UnregisteredCartridgeException"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceInvalidIaasProviderException">
+            <xs:element name="CloudControllerServiceUnregisteredCartridgeException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidIaasProviderException" nillable="true"
-                                    type="ax21:InvalidIaasProviderException"/>
+                        <xs:element minOccurs="0" name="UnregisteredCartridgeException" nillable="true" type="ax21:UnregisteredCartridgeException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="startInstance">
+            <xs:element name="updateContainers">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="memberContext" nillable="true" type="ax23:MemberContext"/>
+                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="replicas" type="xs:int"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="startInstanceResponse">
+            <xs:element name="updateContainersResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax23:MemberContext"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:MemberContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceInvalidMemberException">
+            <xs:element name="updateClusterStatus">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidMemberException" nillable="true"
-                                    type="ax21:InvalidMemberException"/>
+                        <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="status" nillable="true" type="ax210:ClusterStatus"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="terminateInstance">
+            <xs:element name="CloudControllerServiceUnregisteredClusterException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="memberId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="UnregisteredClusterException" nillable="true" type="ax21:UnregisteredClusterException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceInvalidClusterException">
+            <xs:element name="unregisterService">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidClusterException" nillable="true"
-                                    type="ax21:InvalidClusterException"/>
+                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="terminateAllInstances">
+            <xs:element name="unregisterDockerService">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="registerService">
+            <xs:element name="CloudControllerServiceInvalidServiceGroupException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="registrant" nillable="true" type="ax23:Registrant"/>
+                        <xs:element minOccurs="0" name="InvalidServiceGroupException" nillable="true" type="ax21:InvalidServiceGroupException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="registerServiceResponse">
+            <xs:element name="undeployServiceGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getRegisteredCartridges">
-                <xs:complexType>
-                    <xs:sequence/>
-                </xs:complexType>
-            </xs:element>
-            <xs:element name="getRegisteredCartridgesResponse">
+            <xs:element name="undeployCartridgeDefinition">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getCartridgeInfo">
+            <xs:element name="CloudControllerServiceInvalidMemberException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="InvalidMemberException" nillable="true" type="ax21:InvalidMemberException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getCartridgeInfoResponse">
+            <xs:element name="terminateInstance">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax23:CartridgeInfo"/>
+                        <xs:element minOccurs="0" name="memberId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceUnregisteredClusterException">
+            <xs:element name="CloudControllerServiceMemberTerminationFailedException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="UnregisteredClusterException" nillable="true"
-                                    type="ax21:UnregisteredClusterException"/>
+                        <xs:element minOccurs="0" name="MemberTerminationFailedException" nillable="true" type="ax21:MemberTerminationFailedException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="unregisterService">
+            <xs:element name="terminateContainer">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="memberId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="unregisterDockerService">
+            <xs:element name="terminateContainerResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax26:MemberContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceInvalidPartitionException">
+            <xs:element name="CloudControllerServiceInvalidClusterException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidPartitionException" nillable="true"
-                                    type="ax21:InvalidPartitionException"/>
+                        <xs:element minOccurs="0" name="InvalidClusterException" nillable="true" type="ax21:InvalidClusterException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="validateDeploymentPolicy">
+            <xs:element name="terminateAllInstances">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true"
-                                    type="ax23:Partition"/>
+                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="validateDeploymentPolicyResponse">
+            <xs:element name="terminateAllContainers">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="validatePartition">
+            <xs:element name="terminateAllContainersResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="partition" nillable="true" type="ax23:Partition"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:MemberContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="validatePartitionResponse">
+            <xs:element name="CloudControllerServiceInvalidIaasProviderException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="InvalidIaasProviderException" nillable="true" type="ax21:InvalidIaasProviderException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getClusterContext">
+            <xs:element name="startInstance">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="memberContext" nillable="true" type="ax26:MemberContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getClusterContextResponse">
+            <xs:element name="startInstanceResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax23:ClusterContext"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax26:MemberContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
             <xs:element name="startContainers">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="containerClusterContext" nillable="true"
-                                    type="ax23:ContainerClusterContext"/>
+                        <xs:element minOccurs="0" name="containerClusterContext" nillable="true" type="ax26:ContainerClusterContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
             <xs:element name="startContainersResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true"
-                                    type="ax23:MemberContext"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:MemberContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceInvalidCartridgeDefinitionException">
+            <xs:element name="removeKubernetesHost">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidCartridgeDefinitionException" nillable="true"
-                                    type="ax21:InvalidCartridgeDefinitionException"/>
+                        <xs:element minOccurs="0" name="kubernetesHostId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="deployCartridgeDefinition">
+            <xs:element name="removeKubernetesHostResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="cartridgeConfig" nillable="true" type="ax23:CartridgeConfig"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="terminateAllContainers">
+            <xs:element name="CloudControllerServiceNonExistingKubernetesGroupException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="NonExistingKubernetesGroupException" nillable="true" type="ax21:NonExistingKubernetesGroupException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="terminateAllContainersResponse">
+            <xs:element name="removeKubernetesGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true"
-                                    type="ax23:MemberContext"/>
+                        <xs:element minOccurs="0" name="kubernetesGroupId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateContainers">
+            <xs:element name="removeKubernetesGroupResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="replicas" type="xs:int"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateContainersResponse">
+            <xs:element name="registerService">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true"
-                                    type="ax23:MemberContext"/>
+                        <xs:element minOccurs="0" name="registrant" nillable="true" type="ax26:Registrant"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateClusterStatus">
+            <xs:element name="registerServiceResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="status" nillable="true" type="ax27:ClusterStatus"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceMemberTerminationFailedException">
+            <xs:element name="getServiceGroupSubGroups">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="MemberTerminationFailedException" nillable="true"
-                                    type="ax21:MemberTerminationFailedException"/>
+                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="terminateContainer">
+            <xs:element name="getServiceGroupSubGroupsResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="memberId" nillable="true" type="xs:string"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="terminateContainerResponse">
+            <xs:element name="getServiceGroupDependencies">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax23:MemberContext"/>
+                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceApplicationClusterRegistrationException">
+            <xs:element name="getServiceGroupDependenciesResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="ApplicationClusterRegistrationException" nillable="true"
-                                    type="ax21:ApplicationClusterRegistrationException"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax26:Dependencies"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="createApplicationClusters">
+            <xs:element name="getServiceGroupCartridges">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="appId" nillable="true" type="xs:string"/>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="appClustersContexts" nillable="true"
-                                    type="ax23:ApplicationClusterContext"/>
+                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceClusterInstanceCreationException">
+            <xs:element name="getServiceGroupCartridgesResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="ClusterInstanceCreationException" nillable="true"
-                                    type="ax21:ClusterInstanceCreationException"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="createClusterInstance">
+            <xs:element name="getServiceGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="serviceType" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="partitionId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAllKubernetesGroups">
+            <xs:element name="getServiceGroupResponse">
                 <xs:complexType>
-                    <xs:sequence/>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax26:ServiceGroup"/>
+                    </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAllKubernetesGroupsResponse">
+            <xs:element name="getRegisteredCartridges">
                 <xs:complexType>
-                    <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true"
-                                    type="ax29:KubernetesGroup"/>
-                    </xs:sequence>
+                    <xs:sequence/>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceNonExistingKubernetesGroupException">
+            <xs:element name="getRegisteredCartridgesResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="NonExistingKubernetesGroupException" nillable="true"
-                                    type="ax21:NonExistingKubernetesGroupException"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getKubernetesGroup">
+            <xs:element name="getMasterForKubernetesGroup">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="kubernetesGroupId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getKubernetesGroupResponse">
+            <xs:element name="getMasterForKubernetesGroupResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax29:KubernetesGroup"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax29:KubernetesMaster"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getMasterForKubernetesGroup">
+            <xs:element name="getKubernetesGroup">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="kubernetesGroupId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getMasterForKubernetesGroupResponse">
+            <xs:element name="getKubernetesGroupResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax29:KubernetesMaster"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax29:KubernetesGroup"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -480,130 +432,135 @@
             <xs:element name="getHostsForKubernetesGroupResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true"
-                                    type="ax29:KubernetesHost"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:KubernetesHost"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceInvalidKubernetesGroupException">
+            <xs:element name="getClusterContext">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidKubernetesGroupException" nillable="true"
-                                    type="ax21:InvalidKubernetesGroupException"/>
+                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addKubernetesGroup">
+            <xs:element name="getClusterContextResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="kubernetesGroup" nillable="true" type="ax29:KubernetesGroup"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax26:ClusterContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addKubernetesGroupResponse">
+            <xs:element name="getCartridgeInfo">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceInvalidKubernetesHostException">
+            <xs:element name="getCartridgeInfoResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidKubernetesHostException" nillable="true"
-                                    type="ax21:InvalidKubernetesHostException"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax26:CartridgeInfo"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addKubernetesHost">
+            <xs:element name="getAllKubernetesGroups">
+                <xs:complexType>
+                    <xs:sequence/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="getAllKubernetesGroupsResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="kubernetesGroupId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="kubernetesHost" nillable="true" type="ax29:KubernetesHost"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:KubernetesGroup"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addKubernetesHostResponse">
+            <xs:element name="deployServiceGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax26:ServiceGroup"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="removeKubernetesGroup">
+            <xs:element name="CloudControllerServiceInvalidCartridgeDefinitionException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="kubernetesGroupId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="InvalidCartridgeDefinitionException" nillable="true" type="ax21:InvalidCartridgeDefinitionException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="removeKubernetesGroupResponse">
+            <xs:element name="deployCartridgeDefinition">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="cartridgeConfig" nillable="true" type="ax26:CartridgeConfig"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceNonExistingKubernetesHostException">
+            <xs:element name="CloudControllerServiceClusterInstanceCreationException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="NonExistingKubernetesHostException" nillable="true"
-                                    type="ax21:NonExistingKubernetesHostException"/>
+                        <xs:element minOccurs="0" name="ClusterInstanceCreationException" nillable="true" type="ax21:ClusterInstanceCreationException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="removeKubernetesHost">
+            <xs:element name="createClusterInstance">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="kubernetesHostId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="serviceType" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="partitionId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="removeKubernetesHostResponse">
+            <xs:element name="CloudControllerServiceApplicationClusterRegistrationException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="ApplicationClusterRegistrationException" nillable="true" type="ax21:ApplicationClusterRegistrationException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceInvalidKubernetesMasterException">
+            <xs:element name="createApplicationClusters">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidKubernetesMasterException" nillable="true"
-                                    type="ax21:InvalidKubernetesMasterException"/>
+                        <xs:element minOccurs="0" name="appId" nillable="true" type="xs:string"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="appClustersContexts" nillable="true" type="ax26:ApplicationClusterContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="CloudControllerServiceNonExistingKubernetesMasterException">
+            <xs:element name="addKubernetesHost">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="NonExistingKubernetesMasterException" nillable="true"
-                                    type="ax21:NonExistingKubernetesMasterException"/>
+                        <xs:element minOccurs="0" name="kubernetesGroupId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="kubernetesHost" nillable="true" type="ax29:KubernetesHost"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateKubernetesMaster">
+            <xs:element name="addKubernetesHostResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="kubernetesMaster" nillable="true" type="ax29:KubernetesMaster"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateKubernetesMasterResponse">
+            <xs:element name="CloudControllerServiceInvalidKubernetesGroupException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="InvalidKubernetesGroupException" nillable="true" type="ax21:InvalidKubernetesGroupException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateKubernetesHost">
+            <xs:element name="addKubernetesGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="kubernetesHost" nillable="true" type="ax29:KubernetesHost"/>
+                        <xs:element minOccurs="0" name="kubernetesGroup" nillable="true" type="ax29:KubernetesGroup"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateKubernetesHostResponse">
+            <xs:element name="addKubernetesGroupResponse">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="return" type="xs:boolean"/>
@@ -611,37 +568,35 @@
                 </xs:complexType>
             </xs:element>
         </xs:schema>
-        <xs:schema xmlns:ax210="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified"
-                   elementFormDefault="qualified" targetNamespace="http://kubernetes.common.stratos.apache.org/xsd">
+        <xs:schema xmlns:ax28="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://kubernetes.common.stratos.apache.org/xsd">
             <xs:import namespace="http://common.stratos.apache.org/xsd"/>
-            <xs:complexType name="KubernetesGroup">
-                <xs:sequence>
-                    <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="groupId" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="kubernetesHosts" nillable="true"
-                                type="ax29:KubernetesHost"/>
-                    <xs:element minOccurs="0" name="kubernetesMaster" nillable="true" type="ax29:KubernetesMaster"/>
-                    <xs:element minOccurs="0" name="portRange" nillable="true" type="ax29:PortRange"/>
-                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax210:Properties"/>
-                </xs:sequence>
-            </xs:complexType>
             <xs:complexType name="KubernetesHost">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="hostId" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="hostIpAddress" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="hostname" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax210:Properties"/>
+                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax28:Properties"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="KubernetesMaster">
                 <xs:complexContent>
-                    <xs:extension base="ax29:KubernetesHost">
+                    <xs:extension base="ax27:KubernetesHost">
                         <xs:sequence>
                             <xs:element minOccurs="0" name="endpoint" nillable="true" type="xs:string"/>
                         </xs:sequence>
                     </xs:extension>
                 </xs:complexContent>
             </xs:complexType>
+            <xs:complexType name="KubernetesGroup">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="groupId" nillable="true" type="xs:string"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="kubernetesHosts" nillable="true" type="ax27:KubernetesHost"/>
+                    <xs:element minOccurs="0" name="kubernetesMaster" nillable="true" type="ax27:KubernetesMaster"/>
+                    <xs:element minOccurs="0" name="portRange" nillable="true" type="ax27:PortRange"/>
+                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax28:Properties"/>
+                </xs:sequence>
+            </xs:complexType>
             <xs:complexType name="PortRange">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="lower" type="xs:int"/>
@@ -649,8 +604,7 @@
                 </xs:sequence>
             </xs:complexType>
         </xs:schema>
-        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
-                   targetNamespace="http://topology.domain.messaging.stratos.apache.org/xsd">
+        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://topology.domain.messaging.stratos.apache.org/xsd">
             <xs:complexType abstract="true" name="ClusterStatus">
                 <xs:complexContent>
                     <xs:extension base="xs:Enum">
@@ -661,12 +615,10 @@
                 </xs:complexContent>
             </xs:complexType>
         </xs:schema>
-        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
-                   targetNamespace="http://common.stratos.apache.org/xsd">
+        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://common.stratos.apache.org/xsd">
             <xs:complexType name="Properties">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true"
-                                type="ax25:Property"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax24:Property"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="Property">
@@ -676,9 +628,8 @@
                 </xs:sequence>
             </xs:complexType>
         </xs:schema>
-        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
-                   targetNamespace="http://exception.controller.cloud.stratos.apache.org/xsd">
-            <xs:complexType name="InvalidServiceGroupException">
+        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://exception.controller.cloud.stratos.apache.org/xsd">
+            <xs:complexType name="InvalidPartitionException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
@@ -688,104 +639,98 @@
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="UnregisteredCartridgeException">
+            <xs:complexType name="InvalidKubernetesMasterException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="InvalidIaasProviderException">
+            <xs:complexType name="NonExistingKubernetesMasterException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="InvalidMemberException">
+            <xs:complexType name="InvalidKubernetesHostException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="InvalidClusterException">
+            <xs:complexType name="NonExistingKubernetesHostException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="UnregisteredClusterException">
+            <xs:complexType name="UnregisteredCartridgeException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="InvalidPartitionException">
+            <xs:complexType name="UnregisteredClusterException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="InvalidCartridgeDefinitionException">
+            <xs:complexType name="InvalidServiceGroupException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="MemberTerminationFailedException">
+            <xs:complexType name="InvalidMemberException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="ApplicationClusterRegistrationException">
+            <xs:complexType name="MemberTerminationFailedException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="ClusterInstanceCreationException">
+            <xs:complexType name="InvalidClusterException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="NonExistingKubernetesGroupException">
+            <xs:complexType name="InvalidIaasProviderException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="InvalidKubernetesGroupException">
+            <xs:complexType name="NonExistingKubernetesGroupException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="InvalidKubernetesHostException">
+            <xs:complexType name="InvalidCartridgeDefinitionException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="NonExistingKubernetesHostException">
+            <xs:complexType name="ClusterInstanceCreationException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="InvalidKubernetesMasterException">
+            <xs:complexType name="ApplicationClusterRegistrationException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="NonExistingKubernetesMasterException">
+            <xs:complexType name="InvalidKubernetesGroupException">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
         </xs:schema>
-        <xs:schema xmlns:ax26="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified"
-                   elementFormDefault="qualified"
-                   targetNamespace="http://domain.controller.cloud.stratos.apache.org/xsd">
+        <xs:schema xmlns:ax25="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://domain.controller.cloud.stratos.apache.org/xsd">
             <xs:import namespace="http://common.stratos.apache.org/xsd"/>
-            <xs:complexType name="ServiceGroup">
-                <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridges" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="dependencies" nillable="true" type="ax23:Dependencies"/>
-                    <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="subGroups" nillable="true" type="xs:string"/>
-                </xs:sequence>
-            </xs:complexType>
-            <xs:complexType name="Dependencies">
+            <xs:complexType name="Partition">
                 <xs:sequence>
-                    <xs:element minOccurs="0" name="killBehaviour" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="startupOrders" nillable="true"
-                                type="xs:string"/>
+                    <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
+                    <xs:element minOccurs="0" name="partitionMax" type="xs:int"/>
+                    <xs:element minOccurs="0" name="partitionMin" type="xs:int"/>
+                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
+                    <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="MemberContext">
@@ -807,15 +752,13 @@
                     <xs:element minOccurs="0" name="publicIpAddress" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="Partition">
+            <xs:complexType name="ContainerClusterContext">
                 <xs:sequence>
-                    <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
-                    <xs:element minOccurs="0" name="partitionMax" type="xs:int"/>
-                    <xs:element minOccurs="0" name="partitionMin" type="xs:int"/>
+                    <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="partition" nillable="true" type="ax23:Partition"/>
                     <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
-                    <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="Registrant">
@@ -849,16 +792,41 @@
                     <xs:element minOccurs="0" name="volumeId" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
+            <xs:complexType name="Dependencies">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="killBehaviour" nillable="true" type="xs:string"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="startupOrders" nillable="true" type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
+            <xs:complexType name="ServiceGroup">
+                <xs:sequence>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridges" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="dependencies" nillable="true" type="ax23:Dependencies"/>
+                    <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="subGroups" nillable="true" type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
+            <xs:complexType name="ClusterContext">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="lbCluster" type="xs:boolean"/>
+                    <xs:element minOccurs="0" name="payload" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
+                    <xs:element minOccurs="0" name="timeoutInMillis" type="xs:long"/>
+                    <xs:element minOccurs="0" name="volumeRequired" type="xs:boolean"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax23:Volume"/>
+                </xs:sequence>
+            </xs:complexType>
             <xs:complexType name="CartridgeInfo">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="appTypes" nillable="true"
-                                type="ax23:AppType"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="appTypes" nillable="true" type="ax23:AppType"/>
                     <xs:element minOccurs="0" name="baseDir" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="category" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="defaultAutoscalingPolicy" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="defaultDeploymentPolicy" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="deploymentDirs" nillable="true"
-                                type="xs:string"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="deploymentDirs" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="displayName" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
@@ -866,10 +834,8 @@
                     <xs:element minOccurs="0" name="lbConfig" nillable="true" type="ax23:LoadbalancerConfig"/>
                     <xs:element minOccurs="0" name="multiTenant" type="xs:boolean"/>
                     <xs:element minOccurs="0" name="persistence" nillable="true" type="ax23:Persistence"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="portMappings" nillable="true"
-                                type="ax23:PortMapping"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true"
-                                type="ax25:Property"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="portMappings" nillable="true" type="ax23:PortMapping"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax25:Property"/>
                     <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="serviceGroup" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="type" nillable="true" type="xs:string"/>
@@ -895,25 +861,6 @@
                     <xs:element minOccurs="0" name="proxyPort" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="ClusterContext">
-                <xs:sequence>
-                    <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="lbCluster" type="xs:boolean"/>
-                    <xs:element minOccurs="0" name="payload" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
-                    <xs:element minOccurs="0" name="timeoutInMillis" type="xs:long"/>
-                    <xs:element minOccurs="0" name="volumeRequired" type="xs:boolean"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax23:Volume"/>
-                </xs:sequence>
-            </xs:complexType>
-            <xs:complexType name="ContainerClusterContext">
-                <xs:sequence>
-                    <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
-                </xs:sequence>
-            </xs:complexType>
             <xs:complexType name="CartridgeConfig">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="baseDir" nillable="true" type="xs:string"/>
@@ -921,21 +868,17 @@
                     <xs:element minOccurs="0" name="defaultAutoscalingPolicy" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="defaultDeploymentPolicy" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="deployerType" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="deploymentDirs" nillable="true"
-                                type="xs:string"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="deploymentDirs" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="displayName" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="exportingProperties" nillable="true"
-                                type="xs:string"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="exportingProperties" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="iaasConfigs" nillable="true"
-                                type="ax23:IaasConfig"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="iaasConfigs" nillable="true" type="ax23:IaasConfig"/>
                     <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
                     <xs:element minOccurs="0" name="lbConfig" nillable="true" type="ax23:LoadbalancerConfig"/>
                     <xs:element minOccurs="0" name="multiTenant" type="xs:boolean"/>
                     <xs:element minOccurs="0" name="persistence" nillable="true" type="ax23:Persistence"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="portMappings" nillable="true"
-                                type="ax23:PortMapping"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="portMappings" nillable="true" type="ax23:PortMapping"/>
                     <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
                     <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="serviceGroup" nillable="true" type="xs:string"/>
@@ -967,8 +910,7 @@
             </xs:complexType>
             <xs:complexType name="NetworkInterfaces">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="networkInterfaces" nillable="true"
-                                type="ax23:NetworkInterface"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="networkInterfaces" nillable="true" type="ax23:NetworkInterface"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="NetworkInterface">
@@ -981,8 +923,7 @@
             </xs:complexType>
             <xs:complexType name="FloatingNetworks">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="floatingNetworks" nillable="true"
-                                type="ax23:FloatingNetwork"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="floatingNetworks" nillable="true" type="ax23:FloatingNetwork"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="FloatingNetwork">
@@ -1007,6 +948,15 @@
             </xs:complexType>
         </xs:schema>
     </wsdl:types>
+    <wsdl:message name="addKubernetesGroupRequest">
+        <wsdl:part name="parameters" element="ns:addKubernetesGroup"/>
+    </wsdl:message>
+    <wsdl:message name="addKubernetesGroupResponse">
+        <wsdl:part name="parameters" element="ns:addKubernetesGroupResponse"/>
+    </wsdl:message>
+    <wsdl:message name="CloudControllerServiceInvalidKubernetesGroupException">
+        <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidKubernetesGroupException"/>
+    </wsdl:message>
     <wsdl:message name="updateKubernetesMasterRequest">
         <wsdl:part name="parameters" element="ns:updateKubernetesMaster"/>
     </wsdl:message>
@@ -1019,15 +969,6 @@
     <wsdl:message name="CloudControllerServiceNonExistingKubernetesMasterException">
         <wsdl:part name="parameters" element="ns:CloudControllerServiceNonExistingKubernetesMasterException"/>
     </wsdl:message>
-    <wsdl:message name="addKubernetesGroupRequest">
-        <wsdl:part name="parameters" element="ns:addKubernetesGroup"/>
-    </wsdl:message>
-    <wsdl:message name="addKubernetesGroupResponse">
-        <wsdl:part name="parameters" element="ns:addKubernetesGroupResponse"/>
-    </wsdl:message>
-    <wsdl:message name="CloudControllerServiceInvalidKubernetesGroupException">
-        <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidKubernetesGroupException"/>
-    </wsdl:message>
     <wsdl:message name="validatePartitionRequest">
         <wsdl:part name="parameters" element="ns:validatePartition"/>
     </wsdl:message>
@@ -1118,12 +1059,6 @@
     <wsdl:message name="getServiceGroupResponse">
         <wsdl:part name="parameters" element="ns:getServiceGroupResponse"/>
     </wsdl:message>
-    <wsdl:message name="removeKubernetesGroupRequest">
-        <wsdl:part name="parameters" element="ns:removeKubernetesGroup"/>
-    </wsdl:message>
-    <wsdl:message name="removeKubernetesGroupResponse">
-        <wsdl:part name="parameters" element="ns:removeKubernetesGroupResponse"/>
-    </wsdl:message>
     <wsdl:message name="deployCartridgeDefinitionRequest">
         <wsdl:part name="parameters" element="ns:deployCartridgeDefinition"/>
     </wsdl:message>
@@ -1133,6 +1068,12 @@
     <wsdl:message name="CloudControllerServiceInvalidIaasProviderException">
         <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidIaasProviderException"/>
     </wsdl:message>
+    <wsdl:message name="removeKubernetesGroupRequest">
+        <wsdl:part name="parameters" element="ns:removeKubernetesGroup"/>
+    </wsdl:message>
+    <wsdl:message name="removeKubernetesGroupResponse">
+        <wsdl:part name="parameters" element="ns:removeKubernetesGroupResponse"/>
+    </wsdl:message>
     <wsdl:message name="getCartridgeInfoRequest">
         <wsdl:part name="parameters" element="ns:getCartridgeInfo"/>
     </wsdl:message>
@@ -1193,15 +1134,15 @@
     <wsdl:message name="terminateAllInstancesRequest">
         <wsdl:part name="parameters" element="ns:terminateAllInstances"/>
     </wsdl:message>
-    <wsdl:message name="unregisterDockerServiceRequest">
-        <wsdl:part name="parameters" element="ns:unregisterDockerService"/>
-    </wsdl:message>
     <wsdl:message name="getRegisteredCartridgesRequest">
         <wsdl:part name="parameters" element="ns:getRegisteredCartridges"/>
     </wsdl:message>
     <wsdl:message name="getRegisteredCartridgesResponse">
         <wsdl:part name="parameters" element="ns:getRegisteredCartridgesResponse"/>
     </wsdl:message>
+    <wsdl:message name="unregisterDockerServiceRequest">
+        <wsdl:part name="parameters" element="ns:unregisterDockerService"/>
+    </wsdl:message>
     <wsdl:message name="startInstanceRequest">
         <wsdl:part name="parameters" element="ns:startInstance"/>
     </wsdl:message>
@@ -1220,15 +1161,15 @@
     <wsdl:message name="updateContainersResponse">
         <wsdl:part name="parameters" element="ns:updateContainersResponse"/>
     </wsdl:message>
-    <wsdl:message name="updateClusterStatusRequest">
-        <wsdl:part name="parameters" element="ns:updateClusterStatus"/>
-    </wsdl:message>
     <wsdl:message name="getClusterContextRequest">
         <wsdl:part name="parameters" element="ns:getClusterContext"/>
     </wsdl:message>
     <wsdl:message name="getClusterContextResponse">
         <wsdl:part name="parameters" element="ns:getClusterContextResponse"/>
     </wsdl:message>
+    <wsdl:message name="updateClusterStatusRequest">
+        <wsdl:part name="parameters" element="ns:updateClusterStatus"/>
+    </wsdl:message>
     <wsdl:message name="deployServiceGroupRequest">
         <wsdl:part name="parameters" element="ns:deployServiceGroup"/>
     </wsdl:message>
@@ -1245,220 +1186,146 @@
         <wsdl:part name="parameters" element="ns:getHostsForKubernetesGroupResponse"/>
     </wsdl:message>
     <wsdl:portType name="CloudControllerServicePortType">
-        <wsdl:operation name="updateKubernetesMaster">
-            <wsdl:input message="ns:updateKubernetesMasterRequest" wsaw:Action="urn:updateKubernetesMaster"/>
-            <wsdl:output message="ns:updateKubernetesMasterResponse" wsaw:Action="urn:updateKubernetesMasterResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceInvalidKubernetesMasterException"
-                        name="CloudControllerServiceInvalidKubernetesMasterException"
-                        wsaw:Action="urn:updateKubernetesMasterCloudControllerServiceInvalidKubernetesMasterException"/>
-            <wsdl:fault message="ns:CloudControllerServiceNonExistingKubernetesMasterException"
-                        name="CloudControllerServiceNonExistingKubernetesMasterException"
-                        wsaw:Action="urn:updateKubernetesMasterCloudControllerServiceNonExistingKubernetesMasterException"/>
-        </wsdl:operation>
         <wsdl:operation name="addKubernetesGroup">
             <wsdl:input message="ns:addKubernetesGroupRequest" wsaw:Action="urn:addKubernetesGroup"/>
             <wsdl:output message="ns:addKubernetesGroupResponse" wsaw:Action="urn:addKubernetesGroupResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceInvalidKubernetesGroupException"
-                        name="CloudControllerServiceInvalidKubernetesGroupException"
-                        wsaw:Action="urn:addKubernetesGroupCloudControllerServiceInvalidKubernetesGroupException"/>
+            <wsdl:fault message="ns:CloudControllerServiceInvalidKubernetesGroupException" name="CloudControllerServiceInvalidKubernetesGroupException" wsaw:Action="urn:addKubernetesGroupCloudControllerServiceInvalidKubernetesGroupException"/>
+        </wsdl:operation>
+        <wsdl:operation name="updateKubernetesMaster">
+            <wsdl:input message="ns:updateKubernetesMasterRequest" wsaw:Action="urn:updateKubernetesMaster"/>
+            <wsdl:output message="ns:updateKubernetesMasterResponse" wsaw:Action="urn:updateKubernetesMasterResponse"/>
+            <wsdl:fault message="ns:CloudControllerServiceInvalidKubernetesMasterException" name="CloudControllerServiceInvalidKubernetesMasterException" wsaw:Action="urn:updateKubernetesMasterCloudControllerServiceInvalidKubernetesMasterException"/>
+            <wsdl:fault message="ns:CloudControllerServiceNonExistingKubernetesMasterException" name="CloudControllerServiceNonExistingKubernetesMasterException" wsaw:Action="urn:updateKubernetesMasterCloudControllerServiceNonExistingKubernetesMasterException"/>
         </wsdl:operation>
         <wsdl:operation name="validatePartition">
             <wsdl:input message="ns:validatePartitionRequest" wsaw:Action="urn:validatePartition"/>
             <wsdl:output message="ns:validatePartitionResponse" wsaw:Action="urn:validatePartitionResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceInvalidPartitionException"
-                        name="CloudControllerServiceInvalidPartitionException"
-                        wsaw:Action="urn:validatePartitionCloudControllerServiceInvalidPartitionException"/>
+            <wsdl:fault message="ns:CloudControllerServiceInvalidPartitionException" name="CloudControllerServiceInvalidPartitionException" wsaw:Action="urn:validatePartitionCloudControllerServiceInvalidPartitionException"/>
         </wsdl:operation>
         <wsdl:operation name="createApplicationClusters">
             <wsdl:input message="ns:createApplicationClustersRequest" wsaw:Action="urn:createApplicationClusters"/>
-            <wsdl:fault message="ns:CloudControllerServiceApplicationClusterRegistrationException"
-                        name="CloudControllerServiceApplicationClusterRegistrationException"
-                        wsaw:Action="urn:createApplicationClustersCloudControllerServiceApplicationClusterRegistrationException"/>
+            <wsdl:fault message="ns:CloudControllerServiceApplicationClusterRegistrationException" name="CloudControllerServiceApplicationClusterRegistrationException" wsaw:Action="urn:createApplicationClustersCloudControllerServiceApplicationClusterRegistrationException"/>
         </wsdl:operation>
         <wsdl:operation name="terminateContainer">
             <wsdl:input message="ns:terminateContainerRequest" wsaw:Action="urn:terminateContainer"/>
             <wsdl:output message="ns:terminateContainerResponse" wsaw:Action="urn:terminateContainerResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceMemberTerminationFailedException"
-                        name="CloudControllerServiceMemberTerminationFailedException"
-                        wsaw:Action="urn:terminateContainerCloudControllerServiceMemberTerminationFailedException"/>
+            <wsdl:fault message="ns:CloudControllerServiceMemberTerminationFailedException" name="CloudControllerServiceMemberTerminationFailedException" wsaw:Action="urn:terminateContainerCloudControllerServiceMemberTerminationFailedException"/>
         </wsdl:operation>
         <wsdl:operation name="validateDeploymentPolicy">
             <wsdl:input message="ns:validateDeploymentPolicyRequest" wsaw:Action="urn:validateDeploymentPolicy"/>
-            <wsdl:output message="ns:validateDeploymentPolicyResponse"
-                         wsaw:Action="urn:validateDeploymentPolicyResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceInvalidPartitionException"
-                        name="CloudControllerServiceInvalidPartitionException"
-                        wsaw:Action="urn:validateDeploymentPolicyCloudControllerServiceInvalidPartitionException"/>
-            <wsdl:fault message="ns:CloudControllerServiceInvalidCartridgeTypeException"
-                        name="CloudControllerServiceInvalidCartridgeTypeException"
-                        wsaw:Action="urn:validateDeploymentPolicyCloudControllerServiceInvalidCartridgeTypeException"/>
+            <wsdl:output message="ns:validateDeploymentPolicyResponse" wsaw:Action="urn:validateDeploymentPolicyResponse"/>
+            <wsdl:fault message="ns:CloudControllerServiceInvalidPartitionException" name="CloudControllerServiceInvalidPartitionException" wsaw:Action="urn:validateDeploymentPolicyCloudControllerServiceInvalidPartitionException"/>
+            <wsdl:fault message="ns:CloudControllerServiceInvalidCartridgeTypeException" name="CloudControllerServiceInvalidCartridgeTypeException" wsaw:Action="urn:validateDeploymentPolicyCloudControllerServiceInvalidCartridgeTypeException"/>
         </wsdl:operation>
         <wsdl:operation name="getServiceGroupCartridges">
             <wsdl:input message="ns:getServiceGroupCartridgesRequest" wsaw:Action="urn:getServiceGroupCartridges"/>
-            <wsdl:output message="ns:getServiceGroupCartridgesResponse"
-                         wsaw:Action="urn:getServiceGroupCartridgesResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceInvalidServiceGroupException"
-                        name="CloudControllerServiceInvalidServiceGroupException"
-                        wsaw:Action="urn:getServiceGroupCartridgesCloudControllerServiceInvalidServiceGroupException"/>
+            <wsdl:output message="ns:getServiceGroupCartridgesResponse" wsaw:Action="urn:getServiceGroupCartridgesResponse"/>
+            <wsdl:fault message="ns:CloudControllerServiceInvalidServiceGroupException" name="CloudControllerServiceInvalidServiceGroupException" wsaw:Action="urn:getServiceGroupCartridgesCloudControllerServiceInvalidServiceGroupException"/>
         </wsdl:operation>
         <wsdl:operation name="getMasterForKubernetesGroup">
             <wsdl:input message="ns:getMasterForKubernetesGroupRequest" wsaw:Action="urn:getMasterForKubernetesGroup"/>
-            <wsdl:output message="ns:getMasterForKubernetesGroupResponse"
-                         wsaw:Action="urn:getMasterForKubernetesGroupResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceNonExistingKubernetesGroupException"
-                        name="CloudControllerServiceNonExistingKubernetesGroupException"
-                        wsaw:Action="urn:getMasterForKubernetesGroupCloudControllerServiceNonExistingKubernetesGroupException"/>
+            <wsdl:output message="ns:getMasterForKubernetesGroupResponse" wsaw:Action="urn:getMasterForKubernetesGroupResponse"/>
+            <wsdl:fault message="ns:CloudControllerServiceNonExistingKubernetesGroupException" name="CloudControllerServiceNonExistingKubernetesGroupException" wsaw:Action="urn:getMasterForKubernetesGroupCloudControllerServiceNonExistingKubernetesGroupException"/>
         </wsdl:operation>
         <wsdl:operation name="startContainers">
             <wsdl:input message="ns:startContainersRequest" wsaw:Action="urn:startContainers"/>
             <wsdl:output message="ns:startContainersResponse" wsaw:Action="urn:startContainersResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceUnregisteredCartridgeException"
-                        name="CloudControllerServiceUnregisteredCartridgeException"
-                        wsaw:Action="urn:startContainersCloudControllerServiceUnregisteredCartridgeException"/>
+            <wsdl:fault message="ns:CloudControllerServiceUnregisteredCartridgeException" name="CloudControllerServiceUnregisteredCartridgeException" wsaw:Action="urn:startContainersCloudControllerServiceUnregisteredCartridgeException"/>
         </wsdl:operation>
         <wsdl:operation name="registerService">
             <wsdl:input message="ns:registerServiceRequest" wsaw:Action="urn:registerService"/>
             <wsdl:output message="ns:registerServiceResponse" wsaw:Action="urn:registerServiceResponse"/>
-            <wsdl:fault message="ns:CloudControllerServiceUnregisteredCartridgeException"
-                        name="CloudControllerServiceUnregisteredCartridgeException"
-                        wsaw:Action="urn:registerServiceCloudControllerServiceUnregisteredCartridgeException"/>
+            <wsdl:fault message="ns:CloudControllerServiceUnregisteredCartridgeException" name="CloudControllerServiceUnregisteredCartridgeException" wsaw:Action="urn:registerServiceCloudControllerServiceUnregisteredCartridgeException"/>
         </wsdl:operation>
         <wsdl:operation name="terminateInstance">
             <wsdl:input message="ns:terminateInstanceRequest" wsaw:Action="urn:terminateInstance"/>
-            <wsdl:fault message="ns:CloudControllerServiceInvalidMemberException"
-                        name="CloudControllerServiceInvalidMemberException"
-                        wsaw:Action="urn:terminateInstanceCloudControllerServiceInvalidMemberException"/>
-            <wsdl:fault message="ns:CloudControllerServiceInvalidCartridgeTypeException"
-                        name="CloudControllerServiceInvalidCartridgeTypeException"
-                        wsaw:Action="urn:terminateInstanceCloudControllerServiceInvalidCartridgeTypeException"/>
+            <wsdl:fault message="ns:CloudControllerServiceInvalidMemberException" name="CloudControllerServiceInvalidMemberException" wsaw:Action="urn:terminateInstanceCloudControllerServiceInvalidMemberException"/>
+            <wsdl:fault me

<TRUNCATED>

[13/16] stratos git commit: introduces min_count constant

Posted by ni...@apache.org.
introduces min_count constant


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/64395809
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/64395809
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/64395809

Branch: refs/heads/master
Commit: 6439580956737dbfff25e5d52458d25040939132
Parents: 9affb35
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sat Dec 6 20:25:26 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:00:49 2014 +0530

----------------------------------------------------------------------
 .../org/apache/stratos/common/constants/StratosConstants.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/64395809/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 fd44b9f..df9dec2 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
@@ -163,7 +163,8 @@ public class StratosConstants {
     public static final String VM_MIN_CHECK_DROOL_FILE = "mincheck.drl";
     public static final String CONTAINER_OBSOLETE_CHECK_DROOL_FILE = "container-obsoletecheck.drl";
     public static final String VM_OBSOLETE_CHECK_DROOL_FILE = "obsoletecheck.drl";
-
+    public static final String MIN_COUNT = "MIN_COUNT";
+    
     // Policy and definition related constants
     public static final int PUBLIC_DEFINITION = 0;
     


[12/16] stratos git commit: Fixing deployment policy validation to cater docker partitions.

Posted by ni...@apache.org.
Fixing deployment policy validation to cater docker partitions.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/9affb35a
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/9affb35a
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/9affb35a

Branch: refs/heads/master
Commit: 9affb35a4808459b356dbb8f5d98d6d95d4a6344
Parents: 826bc65
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sat Dec 6 18:18:33 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:00:49 2014 +0530

----------------------------------------------------------------------
 .../concurrent/PartitionValidatorCallable.java  | 46 ++++------------
 .../impl/CloudControllerServiceImpl.java        | 45 +++-------------
 .../impl/CloudControllerServiceUtil.java        | 56 ++++++++++++++++++++
 3 files changed, 73 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/9affb35a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
index 7cb88f1..b13d6fe 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
@@ -27,6 +27,7 @@ import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderExceptio
 import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
 import org.apache.stratos.cloud.controller.domain.Cartridge;
 import org.apache.stratos.cloud.controller.domain.IaasProvider;
+import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
 import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
 import org.apache.stratos.cloud.controller.iaases.Iaas;
 import org.apache.stratos.cloud.controller.iaases.validators.IaasBasedPartitionValidator;
@@ -46,47 +47,20 @@ public class PartitionValidatorCallable implements Callable<IaasProvider> {
 	@Override
 	public IaasProvider call() throws Exception {
 		
-		if (log.isDebugEnabled()) {
-			log.debug("Partition validation started for "+partition+" of "+cartridge);
-		}
-		String provider = partition.getProvider();
-        IaasProvider iaasProvider = cartridge.getIaasProvider(provider);
-
-        if (iaasProvider == null) {
-            String msg =
-                         "Invalid Partition - " + partition.toString() +
-                                 ". Cause: Iaas Provider is null for Provider: " + provider;
-            log.error(msg);
-            throw new InvalidPartitionException(msg);
+        if (log.isDebugEnabled()) {
+            log.debug("Partition validation started for " + partition + " of " + cartridge);
         }
+        String provider = partition.getProvider();
+        IaasProvider iaasProvider = cartridge.getIaasProvider(provider);
 
-        Iaas iaas = iaasProvider.getIaas();
-        
-        if (iaas == null) {
-            
-            try {
-                iaas = CloudControllerUtil.getIaas(iaasProvider);
-            } catch (InvalidIaasProviderException e) {
-                String msg =
-                        "Invalid Partition - " + partition.toString() +
-                        ". Cause: Unable to build Iaas of this IaasProvider [Provider] : " + provider+". "+e.getMessage();
-                log.error(msg, e);
-                throw new InvalidPartitionException(msg, e);
-            }
-            
-        }
-        
-        IaasBasedPartitionValidator validator = (IaasBasedPartitionValidator) iaas.getPartitionValidator();
-        validator.setIaasProvider(iaasProvider);
         IaasProvider updatedIaasProvider =
-                                           validator.validate(partition.getId(),
-                                                              CloudControllerUtil.toJavaUtilProperties(partition.getProperties()));
-        
+                CloudControllerServiceUtil.validatePartitionAndGetIaasProvider(partition, iaasProvider);
+
         if (log.isDebugEnabled()) {
-        	log.debug("Partition "+partition.toString()+ " is validated successfully "
-        			+ "against the Cartridge: "+cartridge.getType());
+            log.debug("Partition " + partition.toString() + " is validated successfully " + "against the Cartridge: "
+                    + cartridge.getType());
         }
-        
+
         return updatedIaasProvider;
 	}
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/9affb35a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index 3049735..b8fd6c5 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -1003,8 +1003,13 @@ public class CloudControllerServiceImpl implements CloudControllerService {
                 String partitionId = entry.getKey();
                 Future<IaasProvider> job = entry.getValue();
                 try {
+                    
                     // add to a temporary Map
-                    partitionToIaasProviders.put(partitionId, job.get());
+                    IaasProvider iaasProvider = job.get();
+                    
+                    if(iaasProvider != null) {
+                        partitionToIaasProviders.put(partitionId, iaasProvider);
+                    }
 
                     // add to cache
                     CloudControllerContext.getInstance().addToCartridgeTypeToPartitionIdMap(cartridgeType, partitionId);
@@ -1050,47 +1055,11 @@ public class CloudControllerServiceImpl implements CloudControllerService {
 
         String provider = partition.getProvider();
         String partitionId = partition.getId();
-        Properties partitionProperties = CloudControllerUtil.toJavaUtilProperties(partition.getProperties());
 
         handleNullObject(provider, "Partition [" + partitionId + "] validation failed. Partition provider is null.");
         IaasProvider iaasProvider = CloudControllerConfig.getInstance().getIaasProvider(provider);
 
-        if (iaasProvider != null) {
-            // if this is a IaaS based partition
-            Iaas iaas = iaasProvider.getIaas();
-
-            if (iaas == null) {
-
-                try {
-                    iaas = CloudControllerUtil.getIaas(iaasProvider);
-                } catch (InvalidIaasProviderException e) {
-                    String msg =
-                            "Invalid Partition - " + partition.toString()
-                                    + ". Cause: Unable to build Iaas of this IaasProvider [Provider] : " + provider
-                                    + ". " + e.getMessage();
-                    log.error(msg, e);
-                    throw new InvalidPartitionException(msg, e);
-                }
-            }
-
-            IaasBasedPartitionValidator validator = (IaasBasedPartitionValidator) iaas.getPartitionValidator();
-            validator.setIaasProvider(iaasProvider);
-            validator.validate(partitionId, partitionProperties);
-            return true;
-
-        } else if (CloudControllerConstants.DOCKER_PARTITION_PROVIDER.equals(provider)) {
-            // if this is a docker based Partition
-            KubernetesBasedPartitionValidator validator = new KubernetesBasedPartitionValidator();
-            validator.validate(partitionId, partitionProperties);
-            return true;
-
-        } else {
-
-            String msg =
-                    "Invalid Partition - " + partition.toString() + ". Cause: Cannot identify as a valid partition.";
-            log.error(msg);
-            throw new InvalidPartitionException(msg);
-        }
+        return CloudControllerServiceUtil.validatePartition(partition, iaasProvider);
 
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/9affb35a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
index 056d991..4fbf294 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
@@ -19,19 +19,27 @@
 
 package org.apache.stratos.cloud.controller.services.impl;
 
+import java.util.Properties;
+
 import com.google.common.net.InetAddresses;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.context.CloudControllerContext;
 import org.apache.stratos.cloud.controller.domain.ClusterContext;
 import org.apache.stratos.cloud.controller.domain.IaasProvider;
 import org.apache.stratos.cloud.controller.domain.MemberContext;
+import org.apache.stratos.cloud.controller.domain.Partition;
 import org.apache.stratos.cloud.controller.domain.Volume;
 import org.apache.stratos.cloud.controller.exception.CloudControllerException;
 import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderException;
+import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
 import org.apache.stratos.cloud.controller.iaases.Iaas;
+import org.apache.stratos.cloud.controller.iaases.validators.IaasBasedPartitionValidator;
+import org.apache.stratos.cloud.controller.iaases.validators.KubernetesBasedPartitionValidator;
 import org.apache.stratos.cloud.controller.messaging.publisher.CartridgeInstanceDataPublisher;
 import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
+import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
 import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
 import org.apache.stratos.messaging.domain.topology.MemberStatus;
 import org.jclouds.rest.ResourceNotFoundException;
@@ -141,4 +149,52 @@ public class CloudControllerServiceUtil {
         boolean isValid = InetAddresses.isInetAddress(ip);
         return isValid;
     }
+    
+    public static IaasProvider validatePartitionAndGetIaasProvider(Partition partition, IaasProvider iaasProvider) throws InvalidPartitionException {
+        String provider = partition.getProvider();
+        String partitionId = partition.getId();
+        Properties partitionProperties = CloudControllerUtil.toJavaUtilProperties(partition.getProperties());
+
+        if (iaasProvider != null) {
+            // if this is a IaaS based partition
+            Iaas iaas = iaasProvider.getIaas();
+
+            if (iaas == null) {
+
+                try {
+                    iaas = CloudControllerUtil.getIaas(iaasProvider);
+                } catch (InvalidIaasProviderException e) {
+                    String msg =
+                            "Invalid Partition - " + partition.toString()
+                                    + ". Cause: Unable to build Iaas of this IaasProvider [Provider] : " + provider
+                                    + ". " + e.getMessage();
+                    log.error(msg, e);
+                    throw new InvalidPartitionException(msg, e);
+                }
+            }
+
+            IaasBasedPartitionValidator validator = (IaasBasedPartitionValidator) iaas.getPartitionValidator();
+            validator.setIaasProvider(iaasProvider);
+            iaasProvider = validator.validate(partitionId, partitionProperties);
+            return iaasProvider;
+
+        } else if (CloudControllerConstants.DOCKER_PARTITION_PROVIDER.equals(provider)) {
+            // if this is a docker based Partition
+            KubernetesBasedPartitionValidator validator = new KubernetesBasedPartitionValidator();
+            validator.validate(partitionId, partitionProperties);
+            return null;
+
+        } else {
+
+            String msg =
+                    "Invalid Partition - " + partition.toString() + ". Cause: Cannot identify as a valid partition.";
+            log.error(msg);
+            throw new InvalidPartitionException(msg);
+        }
+    }
+    
+    public static boolean validatePartition(Partition partition, IaasProvider iaasProvider) throws InvalidPartitionException {
+        validatePartitionAndGetIaasProvider(partition, iaasProvider);
+        return true;
+    }
 }


[16/16] stratos git commit: Resolving conflicts again!

Posted by ni...@apache.org.
Resolving conflicts again!


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/b098d8a3
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/b098d8a3
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/b098d8a3

Branch: refs/heads/master
Commit: b098d8a32d03a41ab8b1be3d5e9e78027adf4557
Parents: e31685c
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sun Dec 7 18:04:41 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:04:41 2014 +0530

----------------------------------------------------------------------
 .../autoscaler/monitor/MonitorFactory.java      | 45 ++++++++------------
 1 file changed, 18 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/b098d8a3/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java
index a981eec..278b247 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java
@@ -281,35 +281,26 @@ public class MonitorFactory {
                 if (parentMonitorInstance != null) {
                     ClusterInstance clusterInstance = cluster.getInstanceContexts(parentInstanceId);
                     if (clusterInstance != null) {
-                        if (cluster.isKubernetesCluster()) {
-                            clusterMonitor.setClusterContext(
-                                    ClusterContextFactory.getKubernetesClusterContext(
-                                            clusterInstance.getInstanceId(),
-                                            cluster));
-                        } else {
-                            //Cluster instance is already there. No need to create one.
-                            VMClusterContext clusterContext;
-                            clusterContext = ClusterContextFactory.
-                                    getVMClusterContext(clusterInstance.getInstanceId(),
-                                            cluster);
-                            clusterMonitor.setClusterContext(clusterContext);
-                            //create VMClusterContext and then add all the instanceContexts
-                            clusterContext.addInstanceContext(parentInstanceId, cluster);
-                            if (clusterMonitor.getInstance(clusterInstance.getInstanceId()) == null) {
-                                clusterMonitor.addInstance(clusterInstance);
-                            }
-                            //Checking the current status of the cluster instance
-                            boolean stateChanged = ServiceReferenceHolder.getInstance().getClusterStatusProcessorChain().
-                                    process("", clusterId, clusterInstance.getInstanceId());
-                            if(!stateChanged && clusterInstance.getStatus() != ClusterStatus.Created) {
-                                clusterMonitor.notifyParentMonitor(clusterInstance.getStatus(),
-                                        clusterInstance.getInstanceId());
-                            }
+                        // Cluster instance is already there. No need to create one.
+                        VMClusterContext clusterContext;
+                        clusterContext =
+                                ClusterContextFactory.getVMClusterContext(clusterInstance.getInstanceId(), cluster);
+                        clusterMonitor.setClusterContext(clusterContext);
+                        // create VMClusterContext and then add all the instanceContexts
+                        clusterContext.addInstanceContext(parentInstanceId, cluster);
+                        if (clusterMonitor.getInstance(clusterInstance.getInstanceId()) == null) {
+                            clusterMonitor.addInstance(clusterInstance);
+                        }
+                        // Checking the current status of the cluster instance
+                        boolean stateChanged =
+                                ServiceReferenceHolder.getInstance().getClusterStatusProcessorChain()
+                                        .process("", clusterId, clusterInstance.getInstanceId());
+                        if (!stateChanged && clusterInstance.getStatus() != ClusterStatus.Created) {
+                            clusterMonitor.notifyParentMonitor(clusterInstance.getStatus(),
+                                    clusterInstance.getInstanceId());
                         }
                     } else {
-                        createClusterInstance(cluster.getServiceName(),
-                                clusterId, null,
-                                parentInstanceId, partitionId,
+                        createClusterInstance(cluster.getServiceName(), clusterId, null, parentInstanceId, partitionId,
                                 parentMonitorInstance.getNetworkPartitionId());
                     }
 


[08/16] stratos git commit: Service wsdl changes related to partition validation

Posted by ni...@apache.org.
Service wsdl changes related to partition validation


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d3fcf9bc
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d3fcf9bc
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d3fcf9bc

Branch: refs/heads/master
Commit: d3fcf9bcbd143aeb3cd9d79d85681d04ad8dc958
Parents: c2fc25f
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Fri Dec 5 08:08:39 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 17:59:31 2014 +0530

----------------------------------------------------------------------
 .../main/resources/CloudControllerService.wsdl  | 1064 ++++++++----------
 1 file changed, 460 insertions(+), 604 deletions(-)
----------------------------------------------------------------------



[15/16] stratos git commit: Fixing constructor arguments order.

Posted by ni...@apache.org.
Fixing constructor arguments order.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/e31685c5
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/e31685c5
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/e31685c5

Branch: refs/heads/master
Commit: e31685c5098d8d5ba335db309db4bee3377d6286
Parents: 2e9edf4
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sun Dec 7 17:53:21 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:00:49 2014 +0530

----------------------------------------------------------------------
 .../stratos/cloud/controller/domain/KubernetesClusterContext.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/e31685c5/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java
index a92db26..aecd614 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/KubernetesClusterContext.java
@@ -48,7 +48,7 @@ public class KubernetesClusterContext implements Serializable {
     // kubernetes client API instance
     private transient KubernetesApiClient kubApi;
     
-    public KubernetesClusterContext(String id, String masterIp, String masterPort, int upperPort, int lowerPort) {
+    public KubernetesClusterContext(String id, String masterIp, String masterPort, int lowerPort, int upperPort) {
     	availableHostPorts = new ArrayList<Integer>();
     	this.upperPort = upperPort;
     	this.lowerPort = lowerPort;


[04/16] stratos git commit: Removing unnecessary argument.

Posted by ni...@apache.org.
Removing unnecessary argument.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/1ac296f7
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/1ac296f7
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/1ac296f7

Branch: refs/heads/master
Commit: 1ac296f78f69d47d864ec8a2c3b4031c768960f5
Parents: 283d21d
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Thu Dec 4 11:54:31 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 17:59:31 2014 +0530

----------------------------------------------------------------------
 .../org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/1ac296f7/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
index bbe499c..6a4766c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java
@@ -460,7 +460,7 @@ public class RuleTasksDelegator {
         }
     }
 
-    public void delegateTerminateContainer(KubernetesClusterContext kubernetesClusterContext, String memberId) {
+    public void delegateTerminateContainer(String memberId) {
         try {
             CloudControllerClient ccClient = CloudControllerClient.getInstance();
             ccClient.terminateContainer(memberId);


[05/16] stratos git commit: Introducing Iaas based and Kubernetes based partition validators.

Posted by ni...@apache.org.
Introducing Iaas based and Kubernetes based partition validators.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/4d2dcdd5
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/4d2dcdd5
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/4d2dcdd5

Branch: refs/heads/master
Commit: 4d2dcdd58aa9b4e123846ac6c4c1e14a6dfd0ebd
Parents: f0f5590
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Fri Dec 5 08:05:40 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 17:59:31 2014 +0530

----------------------------------------------------------------------
 .../validators/IaasBasedPartitionValidator.java | 47 ++++++++++++++
 .../KubernetesBasedPartitionValidator.java      | 67 ++++++++++++++++++++
 2 files changed, 114 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/4d2dcdd5/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/IaasBasedPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/IaasBasedPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/IaasBasedPartitionValidator.java
new file mode 100644
index 0000000..d9a77cf
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/IaasBasedPartitionValidator.java
@@ -0,0 +1,47 @@
+/*
+ * 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.cloud.controller.iaases.validators;
+
+import java.util.Properties;
+
+import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
+import org.apache.stratos.cloud.controller.domain.IaasProvider;
+
+/**
+ * All the IaaSes should write a partition validator which extends this class.
+ */
+public abstract class IaasBasedPartitionValidator implements PartitionValidator {
+
+    /**
+     * set the IaasProvider reference.
+     * 
+     * @param iaas {@link IaasProvider}
+     */
+    public abstract void setIaasProvider(IaasProvider iaas);
+
+    /**
+     * Validate the given properties for its existent in this partition.
+     * 
+     * @param partitionId partition id.
+     * @param properties set of properties to be validated.
+     * @return cloned and modified {@link IaasProvider} which maps to the given partition.
+     * @throws InvalidPartitionException if at least one property is evaluated to be invalid.
+     */
+    public abstract IaasProvider validate(String partitionId, Properties properties) throws InvalidPartitionException;
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4d2dcdd5/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesBasedPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesBasedPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesBasedPartitionValidator.java
new file mode 100644
index 0000000..e6225f1
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/KubernetesBasedPartitionValidator.java
@@ -0,0 +1,67 @@
+/*
+ * 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.cloud.controller.iaases.validators;
+
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.context.CloudControllerContext;
+import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
+import org.apache.stratos.cloud.controller.exception.NonExistingKubernetesGroupException;
+import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.common.kubernetes.KubernetesGroup;
+
+/**
+ * Kubernetes Partition Validator
+ */
+public class KubernetesBasedPartitionValidator implements PartitionValidator {
+    
+    private static final Log log = LogFactory.getLog(KubernetesBasedPartitionValidator.class);
+
+    /**
+     * Validate the given properties for its existent in this partition.
+     * 
+     * @param partitionId partition id.
+     * @param properties set of properties to be validated.
+     * @return cloned and modified {@link IaasProvider} which maps to the given partition.
+     * @throws InvalidPartitionException if at least one property is evaluated to be invalid.
+     */
+    public KubernetesGroup validate(String partitionId, Properties properties) throws InvalidPartitionException {
+
+        if (properties.containsKey(StratosConstants.KUBERNETES_CLUSTER_ID)) {
+            String kubernetesClusterId = properties.getProperty(StratosConstants.KUBERNETES_CLUSTER_ID);
+            try {
+                KubernetesGroup kubGroup = CloudControllerContext.getInstance().getKubernetesGroup(kubernetesClusterId);
+                return kubGroup;
+            } catch (NonExistingKubernetesGroupException e) {
+                String msg = "Invalid Partition Detected : " + partitionId + ". Cause: " + e.getMessage();
+                log.error(msg, e);
+                throw new InvalidPartitionException(msg, e);
+            }
+        }
+
+        String msg =
+                "Invalid Partition Detected : " + partitionId + ". Cause: Essential "
+                        + StratosConstants.KUBERNETES_CLUSTER_ID + " property not found.";
+        log.error(msg);
+        throw new InvalidPartitionException(msg);
+
+    }
+}