You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2013/11/12 14:52:25 UTC

git commit: Fixed cloud controller instance spawn logic to fetch partition information from topology

Updated Branches:
  refs/heads/master 48340ed87 -> cfb06d1fb


Fixed cloud controller instance spawn logic to fetch partition information from topology


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

Branch: refs/heads/master
Commit: cfb06d1fb2290609034925ca23039ac83072ff5f
Parents: 48340ed
Author: Imesh Gunaratne <im...@apache.org>
Authored: Tue Nov 12 19:22:17 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue Nov 12 19:22:17 2013 +0530

----------------------------------------------------------------------
 .../client/cloud/controller/CloudControllerClient.java   |  4 ++--
 .../src/main/resources/autoscaler.drl                    |  2 +-
 .../controller/impl/CloudControllerServiceImpl.java      | 11 ++++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cfb06d1f/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java
index a6de3df..7237af2 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java
@@ -56,11 +56,11 @@ public class CloudControllerClient {
         //call CC spawnInstances method
 
         log.info("Calling CC for spawning instances in cluster " + clusterId);
+        log.info("Member count to be increased: " + memberCountToBeIncreased);
+
         org.apache.stratos.messaging.domain.topology.xsd.Partition partitionTopology = new
                 org.apache.stratos.messaging.domain.topology.xsd.Partition();
         partitionTopology.setId(partition.getId());
-        /*locationScope.setCloud(partition.getIaas());
-        locationScope.setRegion(partition.getZone());*/
 
         try {
             for(int i =0; i< memberCountToBeIncreased; i++){

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cfb06d1f/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl b/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl
index 138dfc6..3ff8f9a 100644
--- a/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl
+++ b/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl
@@ -55,7 +55,7 @@ dialect "mvel"
         $clusterContext : ClusterContext() from $context.getClusterContext($cluster.getClusterId())
         eval($clusterContext.getPartitionCount($partition.getId()) < $partition.getPartitionMembersMin() )
 	then
-        int memberCountToBeIncreased =  $partition.getPartitionMembersMin() - $clusterContext.getPartitionCount($partition.getId());
+        int memberCountToBeIncreased =  1;
         if($evaluator.delegateSpawn($partition,$cluster.getClusterId(), memberCountToBeIncreased)){
             $clusterContext.increaseMemberCountInPartition($partition.getId(), memberCountToBeIncreased);
         }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cfb06d1f/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
index d6df4a8..f5db4f7 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
@@ -33,6 +33,7 @@ import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
 import org.apache.stratos.cloud.controller.topic.TopologySynchronizerTask;
 import org.apache.stratos.cloud.controller.topology.TopologyBuilder;
 import org.apache.stratos.cloud.controller.topology.TopologyEventMessageDelegator;
+import org.apache.stratos.cloud.controller.topology.TopologyManager;
 import org.apache.stratos.cloud.controller.util.*;
 import org.apache.stratos.cloud.controller.util.Properties;
 import org.apache.stratos.messaging.domain.topology.Partition;
@@ -270,17 +271,17 @@ public class CloudControllerServiceImpl implements CloudControllerService {
     @Override()
 	public String startInstance(String clusterId, Partition partition) {
 
+        log.info("Starting new instance of domain : " + clusterId);
+
 		ComputeService computeService = null;
 		Template template = null;
 		String ip;
         String partitionId = partition.getId();
-        Scope scope = partition.getScope();
-        String provider = partition.getProperty("provider");
+        Partition partition_ = TopologyManager.getInstance().getTopology().getPartition(partitionId);
+        Scope scope = partition_.getScope();
+        String provider = partition_.getProperty("provider");
 		final Lock lock = new ReentrantLock();
 
-
-		log.info("Starting new instance of domain : " + clusterId);
-
 		// get the subjected ServiceContext
 		ServiceContext serviceCtxt = dataHolder
 				.getServiceContextFromDomain(clusterId);