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 2014/12/10 05:18:18 UTC

stratos git commit: Fixing property conversion and updating debug logs in VMClusterContext

Repository: stratos
Updated Branches:
  refs/heads/4.1.0-test 73957017a -> 3606da285


Fixing property conversion and updating debug logs in VMClusterContext


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

Branch: refs/heads/4.1.0-test
Commit: 3606da285abe67859250349d699a7865502e9bab
Parents: 7395701
Author: Imesh Gunaratne <im...@apache.org>
Authored: Wed Dec 10 09:47:58 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Wed Dec 10 09:48:11 2014 +0530

----------------------------------------------------------------------
 .../context/cluster/VMClusterContext.java       | 20 ++++++--------------
 .../partition/ClusterLevelPartitionContext.java |  1 -
 .../stratos/autoscaler/util/AutoscalerUtil.java | 17 +++++++++++++++--
 3 files changed, 21 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/3606da28/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java
index b6258a4..0c1931e 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java
@@ -317,34 +317,26 @@ public class VMClusterContext extends AbstractClusterContext {
                 memberContext.setMemberId(memberId);
                 memberContext.setInitTime(member.getInitTime());
                 memberContext.setPartition(partition);
-                //FIXME********memberContext.setProperties(convertMemberPropsToMemberContextProps(member.getProperties()));
+                memberContext.setProperties(AutoscalerUtil.toStubProperties(member.getProperties()));
 
                 if (MemberStatus.Activated.equals(member.getStatus())) {
+                    clusterLevelPartitionContext.addActiveMember(memberContext);
                     if (log.isDebugEnabled()) {
-                        String msg = String.format("Active member loaded from topology and added to active member list, %s", member.toString());
+                        String msg = String.format("Active member read from topology and added to active member list: %s", member.toString());
                         log.debug(msg);
                     }
-                    clusterLevelPartitionContext.addActiveMember(memberContext);
-//                            networkPartitionContext.increaseMemberCountOfPartition(partition.getNetworkPartitionId(), 1);
-//                            partitionContext.incrementCurrentActiveMemberCount(1);
-
                 } else if (MemberStatus.Created.equals(member.getStatus()) || MemberStatus.Starting.equals(member.getStatus())) {
+                    clusterLevelPartitionContext.addPendingMember(memberContext);
                     if (log.isDebugEnabled()) {
-                        String msg = String.format("Pending member loaded from topology and added to pending member list, %s", member.toString());
+                        String msg = String.format("Pending member read from topology and added to pending member list: %s", member.toString());
                         log.debug(msg);
                     }
-                    clusterLevelPartitionContext.addPendingMember(memberContext);
-
-//                            networkPartitionContext.increaseMemberCountOfPartition(partition.getNetworkPartitionId(), 1);
-                } else if (MemberStatus.Suspended.equals(member.getStatus())) {
-//                            partitionContext.addFaultyMember(memberId);
                 }
                 clusterLevelPartitionContext.addMemberStatsContext(new MemberStatsContext(memberId));
                 if (log.isInfoEnabled()) {
-                    log.info(String.format("Member stat context has been added: [member] %s", memberId));
+                    log.info(String.format("Member stat context has been added: [member-id] %s", memberId));
                 }
             }
-
         }
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/3606da28/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java
index 5c1e16d..663f301 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java
@@ -151,7 +151,6 @@ public class ClusterLevelPartitionContext extends PartitionContext implements Se
 
             }
         }
-
         return false;
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/3606da28/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
index 8bea86e..b0b8ebc 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
@@ -21,6 +21,7 @@ package org.apache.stratos.autoscaler.util;
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 
@@ -306,7 +307,6 @@ public class AutoscalerUtil {
         org.apache.stratos.cloud.controller.stub.Properties stubProps = new org.apache.stratos.cloud.controller.stub.Properties();
 
         if (properties != null && properties.getProperties() != null) {
-
             for (Property property : properties.getProperties()) {
                 if ((property != null) && (property.getValue() != null)) {
                     org.apache.stratos.cloud.controller.stub.Property newProperty = new org.apache.stratos.cloud.controller.stub.Property();
@@ -317,10 +317,23 @@ public class AutoscalerUtil {
             }
 
         }
-
         return stubProps;
     }
 
+    public static org.apache.stratos.cloud.controller.stub.Properties toStubProperties(
+            java.util.Properties properties) {
+        org.apache.stratos.cloud.controller.stub.Properties stubProperties = new org.apache.stratos.cloud.controller.stub.Properties();
+        if(properties != null) {
+            for(Map.Entry<Object, Object> entry : properties.entrySet()) {
+                org.apache.stratos.cloud.controller.stub.Property newProperty = new org.apache.stratos.cloud.controller.stub.Property();
+                newProperty.setName(entry.getKey().toString());
+                newProperty.setValue(entry.getValue().toString());
+                stubProperties.addProperties(newProperty);
+            }
+        }
+        return stubProperties;
+    }
+
     public static org.apache.stratos.common.Properties toCommonProperties(
             org.apache.stratos.cloud.controller.stub.Properties properties) {
         org.apache.stratos.common.Properties commonProps = new org.apache.stratos.common.Properties();