You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2014/04/09 15:37:35 UTC
[1/4] git commit: Service aware LB changes in SM and puppet
Repository: incubator-stratos
Updated Branches:
refs/heads/master 52d9b232c -> 28df667d1
Service aware LB changes in SM and puppet
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/9c794ca2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/9c794ca2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/9c794ca2
Branch: refs/heads/master
Commit: 9c794ca27e87d42c61fc84dde9c5ac5b9965836e
Parents: e89b1a6
Author: Isuru <is...@wso2.com>
Authored: Wed Apr 9 16:58:21 2014 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Apr 9 16:58:21 2014 +0530
----------------------------------------------------------------------
.../category/DefaultLoadBalancerCategory.java | 4 +-
.../ServiceLevelLoadBalancerCategory.java | 81 ++++++++++++++++++--
.../lb/templates/conf/loadbalancer.conf.erb | 3 +
3 files changed, 81 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9c794ca2/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/DefaultLoadBalancerCategory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/DefaultLoadBalancerCategory.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/DefaultLoadBalancerCategory.java
index 7952de0..e49dbde 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/DefaultLoadBalancerCategory.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/DefaultLoadBalancerCategory.java
@@ -60,7 +60,7 @@ public class DefaultLoadBalancerCategory extends LoadBalancerCategory {
//set the cluster id to Cluster object
cluster.setClusterDomain(clusterId);
if (log.isDebugEnabled()) {
- log.debug("Set existing default LB cluster id " + clusterId + " to the LB Subscription with alias: " + alias);
+ log.debug("Set existing default LB cluster id " + clusterId);
}
defaultLBExists = true;
@@ -77,7 +77,7 @@ public class DefaultLoadBalancerCategory extends LoadBalancerCategory {
if (clusterContext != null) {
cluster.setHostName(clusterContext.getHostName());
if (log.isDebugEnabled()) {
- log.debug("Set existing default LB hostname " + clusterContext.getHostName() + " to the LB Subscription with alias: " + alias);
+ log.debug("Set existing default LB hostname " + clusterContext.getHostName());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9c794ca2/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
index e1f888d..f9563af 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
@@ -19,27 +19,98 @@
package org.apache.stratos.manager.lb.category;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.stub.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.stub.pojo.ClusterContext;
+import org.apache.stratos.cloud.controller.stub.pojo.Properties;
+import org.apache.stratos.manager.client.AutoscalerServiceClient;
+import org.apache.stratos.manager.client.CloudControllerServiceClient;
import org.apache.stratos.manager.dao.Cluster;
import org.apache.stratos.manager.exception.ADCException;
import org.apache.stratos.manager.exception.AlreadySubscribedException;
+import org.apache.stratos.manager.exception.UnregisteredCartridgeException;
import org.apache.stratos.manager.payload.PayloadData;
import org.apache.stratos.manager.repository.Repository;
import org.apache.stratos.manager.subscriber.Subscriber;
import org.apache.stratos.manager.utils.CartridgeConstants;
+import java.rmi.RemoteException;
import java.util.Map;
public class ServiceLevelLoadBalancerCategory extends LoadBalancerCategory {
+ private static Log log = LogFactory.getLog(ServiceLevelLoadBalancerCategory.class);
+
+ private boolean serviceLbExists;
+
public PayloadData create (String alias, Cluster cluster, Subscriber subscriber, Repository repository, CartridgeInfo cartridgeInfo,
String subscriptionKey, Map<String, String> customPayloadEntries) throws ADCException, AlreadySubscribedException {
+ // call the relevant method to get the cluster id, using deployment policy and type
+ String clusterId = null;
+
+ try {
+ clusterId = AutoscalerServiceClient.getServiceClient().getServiceLBClusterId(cartridgeInfo.getType(), getDeploymentPolicyName());
+
+ } catch (Exception e) {
+ log.error("Error occurred in retrieving Service LB cluster id" + e.getMessage());
+ throw new ADCException(e);
+ }
+
+ if (clusterId != null) {
+ //set the cluster id to Cluster object
+ cluster.setClusterDomain(clusterId);
+ if (log.isDebugEnabled()) {
+ log.debug("Set existing Service LB cluster id " + clusterId);
+ }
+ serviceLbExists = true;
+
+ //get the hostname for this cluster and set it
+ ClusterContext clusterContext;
+ try {
+ clusterContext = CloudControllerServiceClient.getServiceClient().getClusterContext(clusterId);
+
+ } catch (RemoteException e) {
+ log.error("Error occurred in retrieving Cluster Context for Service LB ", e);
+ throw new ADCException(e);
+ }
+
+ if (clusterContext != null) {
+ cluster.setHostName(clusterContext.getHostName());
+ if (log.isDebugEnabled()) {
+ log.debug("Set existing Service LB hostname " + clusterContext.getHostName());
+ }
+ }
+
+ return null;
+
+ } else {
+ // set cluster domain
+ cluster.setClusterDomain(generateClusterId(alias, cartridgeInfo.getType()));
+ // set hostname
+ cluster.setHostName(generateHostName(alias, cartridgeInfo.getHostName()));
+
+ PayloadData serviceLevelLbPayloadData = createPayload(cartridgeInfo, subscriptionKey, subscriber, cluster,
+ repository, alias, customPayloadEntries);
+
+ // add payload entry for load balanced service type
+ serviceLevelLbPayloadData.add(CartridgeConstants.LOAD_BALANCED_SERVICE_TYPE, getLoadBalancedServiceType());
+ return serviceLevelLbPayloadData;
+ }
+ }
+
+ public void register(CartridgeInfo cartridgeInfo, Cluster cluster, PayloadData payloadData, String autoscalePolicyName, String deploymentPolicyName, Properties properties) throws ADCException, UnregisteredCartridgeException {
+
+ if (!serviceLbExists) {
+
+ if(payloadData != null) {
+ log.info("Payload: " + payloadData.getCompletePayloadData().toString());
+ }
- // add payload entry for load balanced service type
- PayloadData serviceLevelLbPayloadData = super.create(alias, cluster, subscriber, repository, cartridgeInfo, subscriptionKey,
- customPayloadEntries);
- serviceLevelLbPayloadData.add(CartridgeConstants.LOAD_BALANCED_SERVICE_TYPE, getLoadBalancedServiceType());
- return serviceLevelLbPayloadData;
+ super.register(cartridgeInfo, cluster, payloadData, autoscalePolicyName, deploymentPolicyName, properties);
+ }else {
+ log.info("Service LB already exists for cartridge type: " + cartridgeInfo.getType() + ", deployment policy: " + getDeploymentPolicyName());
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9c794ca2/tools/puppet3/modules/lb/templates/conf/loadbalancer.conf.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/lb/templates/conf/loadbalancer.conf.erb b/tools/puppet3/modules/lb/templates/conf/loadbalancer.conf.erb
index 867a490..64413de 100755
--- a/tools/puppet3/modules/lb/templates/conf/loadbalancer.conf.erb
+++ b/tools/puppet3/modules/lb/templates/conf/loadbalancer.conf.erb
@@ -50,6 +50,9 @@ loadbalancer {
# topology_event_listener_enabled is set to true. This functionality could be used for hosting
# dedicated load balancers for services.
# topology-service-filter: service-name=service-name1,service-name2;
+ <% if @stratos_lb_category == 'service.aware.load.balancer' %>
+ topology-service-filter: service-name=<%=@stratos_load_balanced_service_type%>;
+ <% end %>
# Topology cluster filter
# Provide cluster ids in a comma separated list to filter incoming topology events if
[2/4] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos into
service_aware_lb
Posted by is...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos into service_aware_lb
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/37bc6370
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/37bc6370
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/37bc6370
Branch: refs/heads/master
Commit: 37bc63703220b816dca4248efec4d23a74410a92
Parents: 9c794ca e046af8
Author: Isuru <is...@wso2.com>
Authored: Wed Apr 9 17:05:55 2014 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Apr 9 17:05:55 2014 +0530
----------------------------------------------------------------------
.../stratos/manager/manager/CartridgeSubscriptionManager.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[4/4] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos into
service_aware_lb
Posted by is...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos into service_aware_lb
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/28df667d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/28df667d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/28df667d
Branch: refs/heads/master
Commit: 28df667d1d6f441c0157976700825a968378dfe5
Parents: f2e441c 52d9b23
Author: Isuru <is...@wso2.com>
Authored: Wed Apr 9 19:06:30 2014 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Apr 9 19:06:30 2014 +0530
----------------------------------------------------------------------
.../console/controllers/wizardSubmit.jag | 94 +++++++++++---------
.../console/themes/theme1/pages/index.hbs | 2 -
.../partials/configure_stratos_wizard.hbs | 76 ++++++++--------
.../theme1/partials/subscribe_cartridge.hbs | 26 ++++--
.../themes/theme1/partials/tenant_new.hbs | 2 +-
.../console/themes/theme1/ui/js/wizard.js | 37 ++++++--
.../console/util/utility.jag | 3 +
.../broker/subscribe/TopicSubscriber.java | 15 +++-
8 files changed, 158 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
[3/4] git commit: fixing service aware LB spawning
Posted by is...@apache.org.
fixing service aware LB spawning
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/f2e441cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/f2e441cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/f2e441cd
Branch: refs/heads/master
Commit: f2e441cdb77bbb4520fbcf220eb39ec74d7617c7
Parents: 37bc637
Author: Isuru <is...@wso2.com>
Authored: Wed Apr 9 19:06:15 2014 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Apr 9 19:06:15 2014 +0530
----------------------------------------------------------------------
.../manager/lb/category/ServiceLevelLoadBalancerCategory.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f2e441cd/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
index f9563af..fc47261 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
@@ -51,7 +51,7 @@ public class ServiceLevelLoadBalancerCategory extends LoadBalancerCategory {
String clusterId = null;
try {
- clusterId = AutoscalerServiceClient.getServiceClient().getServiceLBClusterId(cartridgeInfo.getType(), getDeploymentPolicyName());
+ clusterId = AutoscalerServiceClient.getServiceClient().getServiceLBClusterId(getLoadBalancedServiceType(), getDeploymentPolicyName());
} catch (Exception e) {
log.error("Error occurred in retrieving Service LB cluster id" + e.getMessage());
@@ -59,6 +59,7 @@ public class ServiceLevelLoadBalancerCategory extends LoadBalancerCategory {
}
if (clusterId != null) {
+
//set the cluster id to Cluster object
cluster.setClusterDomain(clusterId);
if (log.isDebugEnabled()) {
@@ -86,6 +87,7 @@ public class ServiceLevelLoadBalancerCategory extends LoadBalancerCategory {
return null;
} else {
+
// set cluster domain
cluster.setClusterDomain(generateClusterId(alias, cartridgeInfo.getType()));
// set hostname
@@ -110,7 +112,7 @@ public class ServiceLevelLoadBalancerCategory extends LoadBalancerCategory {
super.register(cartridgeInfo, cluster, payloadData, autoscalePolicyName, deploymentPolicyName, properties);
}else {
- log.info("Service LB already exists for cartridge type: " + cartridgeInfo.getType() + ", deployment policy: " + getDeploymentPolicyName());
+ log.info("Service LB already exists for cartridge type: " + getLoadBalancedServiceType() + ", deployment policy: " + getDeploymentPolicyName());
}
}
}