stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject [10/32] stratos git commit: Added instanceId field to Member class and exposed it through topology.
Date Fri, 09 Oct 2015 14:35:23 GMT
Added instanceId field to Member class and exposed it through topology.


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

Branch: refs/heads/gsoc-projects-2015
Commit: 5770646efe7faa50b8ea2c36391a03e0e404a632
Parents: 313db96
Author: swapnilpatilRajaram <swapnil.patil@students.iiit.ac.in>
Authored: Sun Jun 21 19:59:03 2015 +0000
Committer: swapnilpatilRajaram <swapnil.patil@students.iiit.ac.in>
Committed: Sun Jun 21 19:59:03 2015 +0000

----------------------------------------------------------------------
 .../controller/messaging/topology/TopologyBuilder.java   |  1 +
 .../stratos/load/balancer/common/domain/Member.java      | 11 ++++++++++-
 .../LoadBalancerCommonTopologyEventReceiver.java         |  4 ++++
 .../apache/stratos/messaging/domain/topology/Member.java | 10 ++++++++++
 .../apache/stratos/aws/extension/AWSLoadBalancer.java    |  6 ++++++
 5 files changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/5770646e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
index 8940ed0..9f75582 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
@@ -388,6 +388,7 @@ public class TopologyBuilder {
             member.setStatus(MemberStatus.Created);
             member.setLbClusterId(lbClusterId);
             member.setProperties(CloudControllerUtil.toJavaUtilProperties(memberContext.getProperties()));
+            member.setInstanceId(memberContext.getInstanceId());
             cluster.addMember(member);
             TopologyManager.updateTopology(topology);
         } finally {

http://git-wip-us.apache.org/repos/asf/stratos/blob/5770646e/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/domain/Member.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/domain/Member.java
b/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/domain/Member.java
index 953dabd..1bb93c2 100644
--- a/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/domain/Member.java
+++ b/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/domain/Member.java
@@ -33,8 +33,9 @@ public class Member {
     private String memberId;
     private String hostName;
     private Map<Integer, Port> portMap;
+    private String instanceId;
 
-    public Member(String serviceName, String clusterId, String memberId, String hostName)
{
+	public Member(String serviceName, String clusterId, String memberId, String hostName) {
         this.serviceName = serviceName;
         this.clusterId = clusterId;
         this.memberId = memberId;
@@ -86,4 +87,12 @@ public class Member {
     public String getServiceName() {
         return serviceName;
     }
+    
+    public String getInstanceId() {
+		return instanceId;
+	}
+
+	public void setInstanceId(String instanceId) {
+		this.instanceId = instanceId;
+	}
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/5770646e/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
b/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
index faac524..f0e9d99 100644
--- a/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
+++ b/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
@@ -420,6 +420,10 @@ public class LoadBalancerCommonTopologyEventReceiver extends TopologyEventReceiv
                 member.addPort(transformPort(port));
             }
         }
+        
+        if (messagingMember.getInstanceId() != null) {
+            member.setInstanceId(messagingMember.getInstanceId());
+        }
         return member;
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/5770646e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
index 2242075..12c34c8 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
@@ -43,6 +43,8 @@ public class Member implements Serializable, LifeCycleStateTransitionBehavior<Me
     private final String clusterInstanceId;
     private final String networkPartitionId;
     private final String partitionId;
+    // Instance id on IaaS side, which is available in MemberContext
+    private String instanceId;
 
     // member initiated time
     private final long initTime;
@@ -208,6 +210,14 @@ public class Member implements Serializable, LifeCycleStateTransitionBehavior<Me
     public LoadBalancingIPType getLoadBalancingIPType() {
         return loadBalancingIPType;
     }
+    
+    public String getInstanceId() {
+        return instanceId;
+    }
+
+    public void setInstanceId(String instanceId) {
+        this.instanceId = instanceId;
+    }
 
     @Override
     public String toString() {

http://git-wip-us.apache.org/repos/asf/stratos/blob/5770646e/extensions/load-balancer/aws-extension/src/main/java/org/apache/stratos/aws/extension/AWSLoadBalancer.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/aws-extension/src/main/java/org/apache/stratos/aws/extension/AWSLoadBalancer.java
b/extensions/load-balancer/aws-extension/src/main/java/org/apache/stratos/aws/extension/AWSLoadBalancer.java
index c2e9e45..530da8e 100644
--- a/extensions/load-balancer/aws-extension/src/main/java/org/apache/stratos/aws/extension/AWSLoadBalancer.java
+++ b/extensions/load-balancer/aws-extension/src/main/java/org/apache/stratos/aws/extension/AWSLoadBalancer.java
@@ -85,6 +85,12 @@ public class AWSLoadBalancer implements LoadBalancer {
 						// if instance id of member is not in attachedInstances
 						// add this to instancesToAddToLoadBalancer
 
+						Instance instance = new Instance(member.getInstanceId());
+
+						if (!attachedInstances.contains(instance)) {
+							instancesToAddToLoadBalancer.add(instance);
+						}
+						
 					}
 
 					List<Instance> instancesToRemoveFromLoadBalancer = new ArrayList<Instance>();


Mime
View raw message