Update cluster with serviceName
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/1f5df1c1 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/1f5df1c1 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/1f5df1c1 Branch: refs/heads/master Commit: 1f5df1c154760cb70d670d074617d11871375a20 Parents: 599e543 Author: gayangunarathne <[email protected]> Authored: Fri Aug 28 21:00:01 2015 +0530 Committer: gayangunarathne <[email protected]> Committed: Fri Aug 28 21:00:01 2015 +0530 ---------------------------------------------------------------------- .../autoscaler/context/cluster/ClusterContext.java | 2 +- .../context/cluster/ClusterContextFactory.java | 2 +- .../autoscaler/monitor/cluster/ClusterMonitor.java | 6 +++--- .../autoscaler/services/impl/AutoscalerServiceImpl.java | 2 +- .../controller/messaging/topology/TopologyBuilder.java | 6 +++--- .../LoadBalancerCommonTopologyEventReceiver.java | 2 +- .../stratos/messaging/domain/topology/Cluster.java | 12 ++++++------ .../messaging/event/topology/ClusterCreatedEvent.java | 2 +- .../ApplicationClustersCreatedMessageProcessor.java | 2 +- .../topology/ClusterCreatedMessageProcessor.java | 4 ++-- .../rest/endpoint/util/converter/ObjectConverter.java | 4 ++-- samples/kubernetes-clusters/kubernetes-cluster-1.json | 2 +- samples/kubernetes-clusters/kubernetes-cluster-2.json | 2 +- 13 files changed, 24 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java index 9e35f4e..8055cb0 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java @@ -312,7 +312,7 @@ public class ClusterContext extends AbstractClusterContext { ClusterLevelPartitionContext clusterLevelPartitionContext = new ClusterLevelPartitionContext( partition3, clusterInstance.getNetworkPartitionUuid(), this.deploymentPolicyId); - clusterLevelPartitionContext.setServiceName(cluster.getServiceUuid()); + clusterLevelPartitionContext.setServiceName(cluster.getServiceName()); clusterLevelPartitionContext.setProperties(cluster.getProperties()); //add members to partition Context http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java index b0d960a..92a6b0a 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java @@ -43,7 +43,7 @@ public class ClusterContextFactory { log.debug("Autoscaler policy name: " + autoscalePolicyName); } - return new ClusterContext(cluster.getClusterId(), cluster.getServiceUuid(), + return new ClusterContext(cluster.getClusterId(), cluster.getServiceName(), autoscalePolicyName, hasScalingDependents, deploymentPolicyId); } http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java index f4c3d0c..f700dbc 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java @@ -116,7 +116,7 @@ public class ClusterMonitor extends Monitor { readConfigurations(); this.groupScalingEnabledSubtree = groupScalingEnabledSubtree; this.setCluster(new Cluster(cluster)); - this.serviceUuid = cluster.getServiceUuid(); + this.serviceUuid = cluster.getServiceName(); this.monitoringStarted = new AtomicBoolean(false); this.hasScalingDependents = hasScalingDependents; this.deploymentPolicyId = deploymentPolicyId; @@ -1450,11 +1450,11 @@ public class ClusterMonitor extends Monitor { cluster.getClusterId())); } } else { - createClusterInstance(cluster.getServiceUuid(), cluster.getClusterId(), null, parentInstanceId, partitionId, + createClusterInstance(cluster.getServiceName(), cluster.getClusterId(), null, parentInstanceId, partitionId, parentMonitorInstance.getNetworkPartitionUuid()); if (log.isDebugEnabled()) { log.debug(String.format("Cluster instance created: [application-id] %s [service-name] %s " + - "[cluster-id] %s", appId, cluster.getServiceUuid(), cluster.getClusterId())); + "[cluster-id] %s", appId, cluster.getServiceName(), cluster.getClusterId())); } } return true; http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java index 3b42d29..76d527b 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java @@ -1238,7 +1238,7 @@ public class AutoscalerServiceImpl implements AutoscalerService { if(cluster != null) { Collection<ClusterInstance> allClusterInstances = cluster.getClusterInstances(); for (ClusterInstance clusterInstance : allClusterInstances) { - ClusterStatusEventPublisher.sendClusterTerminatedEvent(applicationId, cluster.getServiceUuid(), + ClusterStatusEventPublisher.sendClusterTerminatedEvent(applicationId, cluster.getServiceName(), clusterId, clusterInstance.getInstanceId()); } http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/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 f76c928..60fd806 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 @@ -188,9 +188,9 @@ public class TopologyBuilder { try { Topology topology = TopologyManager.getTopology(); for (Cluster cluster : appClusters) { - Service service = topology.getService(cluster.getServiceUuid()); + Service service = topology.getService(cluster.getServiceName()); if (service == null) { - log.error("Service " + cluster.getServiceUuid() + log.error("Service " + cluster.getServiceName() + " not found in Topology, unable to create Application cluster"); } else { service.addCluster(cluster); @@ -204,7 +204,7 @@ public class TopologyBuilder { log.debug("Creating cluster port mappings: [application-id] " + appUuid); for (Cluster cluster : appClusters) { - String cartridgeUuid = cluster.getServiceUuid(); + String cartridgeUuid = cluster.getServiceName(); Cartridge cartridge = CloudControllerContext.getInstance().getCartridge(cartridgeUuid); if (cartridge == null) { throw new CloudControllerException("Cartridge not found: [cartridge-uuid] " + cartridgeUuid); http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/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 0e08bf2..c42bfc6 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 @@ -405,7 +405,7 @@ public class LoadBalancerCommonTopologyEventReceiver extends TopologyEventReceiv private org.apache.stratos.load.balancer.common.domain.Cluster transformCluster(Cluster messagingCluster) { org.apache.stratos.load.balancer.common.domain.Cluster cluster = - new org.apache.stratos.load.balancer.common.domain.Cluster(messagingCluster.getServiceUuid(), + new org.apache.stratos.load.balancer.common.domain.Cluster(messagingCluster.getServiceName(), messagingCluster.getClusterId()); cluster.setTenantRange(messagingCluster.getTenantRange()); if (messagingCluster.getHostNames() != null) { http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/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 647fa89..2437730 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 @@ -38,7 +38,7 @@ public class Cluster implements Serializable { private static final long serialVersionUID = -361960242360176077L; - private final String serviceUuid; + private final String serviceName; private final String clusterId; private final String autoscalePolicyUuid; private final String deploymentPolicyUuid; @@ -64,7 +64,7 @@ public class Cluster implements Serializable { private List<KubernetesService> kubernetesServices; public Cluster(Cluster cluster) { - this.serviceUuid = cluster.getServiceUuid(); + this.serviceName = cluster.getServiceName(); this.clusterId = cluster.getClusterId(); this.deploymentPolicyUuid = cluster.getDeploymentPolicyUuid(); this.autoscalePolicyUuid = cluster.getAutoscalePolicyUuid(); @@ -84,7 +84,7 @@ public class Cluster implements Serializable { public Cluster(String serviceName, String clusterId, String deploymentPolicyName, String autoscalePolicyName, String appId) { - this.serviceUuid = serviceName; + this.serviceName = serviceName; this.clusterId = clusterId; this.deploymentPolicyUuid = deploymentPolicyName; this.autoscalePolicyUuid = autoscalePolicyName; @@ -96,8 +96,8 @@ public class Cluster implements Serializable { this.kubernetesServices = new ArrayList<KubernetesService>(); } - public String getServiceUuid() { - return serviceUuid; + public String getServiceName() { + return serviceName; } public String getClusterId() { @@ -363,7 +363,7 @@ public class Cluster implements Serializable { public String toString() { return String.format("[serviceName=%s, clusterId=%s, autoscalePolicyName=%s, deploymentPolicyName=%s, " + "hostNames=%s, tenantRange=%s, loadBalanceAlgorithmName=%s, appId=%s, parentId=%s, " + - "accessUrls=%s, kubernetesServices=%s]", serviceUuid, clusterId, autoscalePolicyUuid, + "accessUrls=%s, kubernetesServices=%s]", serviceName, clusterId, autoscalePolicyUuid, deploymentPolicyUuid, hostNames, tenantRange, loadBalanceAlgorithmName, appId, parentId, accessUrls, kubernetesServices); } http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java index 2c4139b..2befa89 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java @@ -37,7 +37,7 @@ public class ClusterCreatedEvent extends TopologyEvent implements Serializable { @Override public String toString() { - return "ClusterCreatedEvent [serviceName=" + cluster.getServiceUuid() + ", " + + return "ClusterCreatedEvent [serviceName=" + cluster.getServiceName() + ", " + "application=" + cluster.getAppId() + " , cluster= " + cluster.getClusterId() + " ]"; } http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersCreatedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersCreatedMessageProcessor.java index 2ae7e29..8c3644c 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersCreatedMessageProcessor.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersCreatedMessageProcessor.java @@ -73,7 +73,7 @@ public class ApplicationClustersCreatedMessageProcessor extends MessageProcessor List<Cluster> clusters = event.getClusterList(); for (Cluster cluster : clusters) { - String serviceUuid = cluster.getServiceUuid(); + String serviceUuid = cluster.getServiceName(); String clusterId = cluster.getClusterId(); TopologyUpdater.acquireWriteLockForService(serviceUuid); try { http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedMessageProcessor.java index 8c415db..036fe19 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedMessageProcessor.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedMessageProcessor.java @@ -52,7 +52,7 @@ public class ClusterCreatedMessageProcessor extends MessageProcessor { // Parse complete message and build event ClusterCreatedEvent event = (ClusterCreatedEvent) MessagingUtil.jsonToObject(message, ClusterCreatedEvent.class); - String serviceName = event.getCluster().getServiceUuid(); + String serviceName = event.getCluster().getServiceName(); TopologyUpdater.acquireWriteLockForService(serviceName); try { return doProcess(event, topology); @@ -73,7 +73,7 @@ public class ClusterCreatedMessageProcessor extends MessageProcessor { private boolean doProcess(ClusterCreatedEvent event, Topology topology) { Cluster cluster = event.getCluster(); - String serviceName = cluster.getServiceUuid(); + String serviceName = cluster.getServiceName(); String clusterId = cluster.getClusterId(); // Apply service filter http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java index 0301b2b..e414954 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java @@ -644,7 +644,7 @@ public class ObjectConverter { ClusterBean clusterBean = new ClusterBean(); clusterBean.setAlias(alias); - clusterBean.setServiceName(cluster.getServiceUuid()); + clusterBean.setServiceName(cluster.getServiceName()); clusterBean.setClusterId(cluster.getClusterId()); clusterBean.setLbCluster(cluster.isLbCluster()); clusterBean.setTenantRange(cluster.getTenantRange()); @@ -702,7 +702,7 @@ public class ObjectConverter { Cluster cluster, String alias) { ClusterInstanceBean clusterInstanceBean = new ClusterInstanceBean(); clusterInstanceBean.setAlias(alias); - clusterInstanceBean.setServiceName(cluster.getServiceUuid()); + clusterInstanceBean.setServiceName(cluster.getServiceName()); clusterInstanceBean.setClusterId(cluster.getClusterId()); clusterInstanceBean.setInstanceId(instanceId); clusterInstanceBean.setParentInstanceId(instanceId); http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/samples/kubernetes-clusters/kubernetes-cluster-1.json ---------------------------------------------------------------------- diff --git a/samples/kubernetes-clusters/kubernetes-cluster-1.json b/samples/kubernetes-clusters/kubernetes-cluster-1.json index 399ba83..ce72f2b 100644 --- a/samples/kubernetes-clusters/kubernetes-cluster-1.json +++ b/samples/kubernetes-clusters/kubernetes-cluster-1.json @@ -38,7 +38,7 @@ }, { "name": "payload_parameter.MB_PORT", - "value": "1883" + "value": "1884" }, { "name": "payload_parameter.CEP_IP", http://git-wip-us.apache.org/repos/asf/stratos/blob/1f5df1c1/samples/kubernetes-clusters/kubernetes-cluster-2.json ---------------------------------------------------------------------- diff --git a/samples/kubernetes-clusters/kubernetes-cluster-2.json b/samples/kubernetes-clusters/kubernetes-cluster-2.json index 0bd2260..2472793 100644 --- a/samples/kubernetes-clusters/kubernetes-cluster-2.json +++ b/samples/kubernetes-clusters/kubernetes-cluster-2.json @@ -38,7 +38,7 @@ }, { "name": "payload_parameter.MB_PORT", - "value": "1883" + "value": "1884" }, { "name": "payload_parameter.CEP_IP",
