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 2013/11/27 19:55:23 UTC
[26/26] git commit: merging changes
merging changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/640d8748
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/640d8748
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/640d8748
Branch: refs/heads/master
Commit: 640d8748dd296ba3ac644f54afd368aad43c892c
Parents: b9365d9
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Nov 28 00:17:00 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Nov 28 00:17:00 2013 +0530
----------------------------------------------------------------------
.../controller/impl/CloudControllerServiceImpl.java | 14 +++++++-------
.../cloud/controller/pojo/ClusterContext.java | 16 ++++++++++++++++
.../controller/topology/TopologyEventSender.java | 11 +++++------
3 files changed, 28 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/640d8748/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 3ee7fae..c259f73 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
@@ -19,6 +19,7 @@
package org.apache.stratos.cloud.controller.impl;
import com.google.common.collect.Lists;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -466,7 +467,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
log.info("Private ip address: " + ip);
}
- if (node.getId() == null) {
+ String nodeId = node.getId();
+ if (nodeId == null) {
String msg = "Node id of the starting instance is null.\n" + node.toString();
log.fatal(msg);
throw new CloudControllerException(msg);
@@ -497,7 +499,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
// trigger topology
TopologyBuilder.handleMemberSpawned(memberID, cartridgeType, clusterId,
- nodeId, partition, privateIp);
+ nodeId, partition, ip);
//update the topology with the newly spawned member
// publish data
@@ -527,13 +529,10 @@ public class CloudControllerServiceImpl implements CloudControllerService {
+ ". Hence, will try to start in another IaaS if available.",
e);
}
+
+ return null;
}
-// }
- return null;
-
- }
-
// @Override
// public String startInstances(String clusterId, Partition partition, int noOfInstancesToBeSpawned) {
// //TODO
@@ -1147,6 +1146,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
String cartridgeType = registrant.getCartridgeType();
String clusterId = registrant.getClusterId();
String payload = registrant.getPayload();
+ String hostName = registrant.getHostName();
if(cartridgeType == null || clusterId == null || payload == null) {
String msg = "Null Argument/s detected: Cartridge type: "+cartridgeType+", Cluster Id: "+clusterId+", Payload: "+payload;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/640d8748/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ClusterContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ClusterContext.java
index c462728..5f2805f 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ClusterContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ClusterContext.java
@@ -31,6 +31,7 @@ public class ClusterContext {
private String cartridgeType;
// payload as a String
private String payload;
+ private String hostName;
public ClusterContext(String clusterId, String cartridgeType, String payload) {
this.clusterId = clusterId;
@@ -38,6 +39,13 @@ public class ClusterContext {
this.payload = payload;
}
+ public ClusterContext(String clusterId, String cartridgeType, String payload, String hostName) {
+ this.clusterId = clusterId;
+ this.cartridgeType = cartridgeType;
+ this.payload = payload;
+ this.setHostName(hostName);
+ }
+
public String getClusterId() {
return clusterId;
}
@@ -56,5 +64,13 @@ public class ClusterContext {
public void setPayload(String payload) {
this.payload = payload;
}
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/640d8748/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
index 0048076..1ccb4a7 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
@@ -112,8 +112,8 @@ public class TopologyEventSender {
public static void sendClusterCreatedEvent(Registrant registrant) {
Properties props = CloudControllerUtil.toJavaUtilProperties(registrant.getProperties());
ClusterCreatedEvent clusterCreatedEvent = new ClusterCreatedEvent(registrant.getCartridgeType(),
- registrant.getClusterId());
- clusterCreatedEvent.setHostName(registrant.getHostName());
+ registrant.getClusterId(),
+ registrant.getHostName());
clusterCreatedEvent.setTenantRange(registrant.getTenantRange());
clusterCreatedEvent.setAutoscalingPolicyName(registrant.getAutoScalerPolicyName());
clusterCreatedEvent.setProperties(props);
@@ -129,9 +129,7 @@ public class TopologyEventSender {
}
public static void sendClusterRemovedEvent(ClusterContext ctxt) {
- ClusterRemovedEvent clusterRemovedEvent = new ClusterRemovedEvent();
- clusterRemovedEvent.setClusterId(ctxt.getClusterId());
- clusterRemovedEvent.setServiceName(ctxt.getCartridgeType());
+ ClusterRemovedEvent clusterRemovedEvent = new ClusterRemovedEvent(ctxt.getCartridgeType(), ctxt.getClusterId(), ctxt.getHostName());
if(log.isInfoEnabled()) {
log.info(String.format("Publishing cluster removed event: [service] %s [cluster] %s", ctxt.getCartridgeType(), ctxt.getClusterId()));
@@ -140,7 +138,8 @@ public class TopologyEventSender {
}
- public static void sendInstanceSpawnedEvent(String serviceName, String clusterId, String memberId, String nodeId) {
+ public static void sendInstanceSpawnedEvent(String serviceName, String clusterId, String memberId, String nodeId,
+ Partition partition) {
InstanceSpawnedEvent instanceSpawnedEvent = new InstanceSpawnedEvent(serviceName,
clusterId,
memberId,