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/08/08 08:24:27 UTC
[1/2] git commit: fixing
https://issues.apache.org/jira/browse/STRATOS-42
Updated Branches:
refs/heads/master c2059beb0 -> 10b96f183
fixing https://issues.apache.org/jira/browse/STRATOS-42
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/de031caa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/de031caa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/de031caa
Branch: refs/heads/master
Commit: de031caaae474dbb93d08d621d7ea87404db6b5e
Parents: 5c97f5a
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Aug 8 11:53:33 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Aug 8 11:53:33 2013 +0530
----------------------------------------------------------------------
.../impl/CloudControllerServiceImpl.java | 40 ++++++++++----------
.../runtime/FasterLookUpDataHolder.java | 21 ++++++++++
.../cloud/controller/util/IaasContext.java | 13 -------
3 files changed, 41 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/de031caa/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 87e2533..c55e1b3 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
@@ -173,7 +173,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
if (!tm.isTaskScheduled(CloudControllerConstants.DATA_PUB_TASK_NAME)) {
TriggerInfo triggerInfo = new TriggerInfo(
- FasterLookUpDataHolder.getInstance()
+ dataHolder
.getDataPublisherCron());
taskInfo = new TaskInfo(
CloudControllerConstants.DATA_PUB_TASK_NAME,
@@ -295,7 +295,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
+ " and sub domain : " + subDomainName);
// get the subjected ServiceContext
- ServiceContext serviceCtxt = FasterLookUpDataHolder.getInstance()
+ ServiceContext serviceCtxt = dataHolder
.getServiceContext(domainName, subDomainName);
if (serviceCtxt == null) {
@@ -307,7 +307,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
// load Cartridge
serviceCtxt.setCartridge(loadCartridge(serviceCtxt.getCartridgeType(),
- serviceCtxt.getPayload(), FasterLookUpDataHolder.getInstance()
+ serviceCtxt.getPayload(), dataHolder
.getCartridges()));
if (serviceCtxt.getCartridge() == null) {
@@ -336,7 +336,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
ctxt = serviceCtxt.addIaasContext(iaas.getType());
}
- if (iaas.getMaxInstanceLimit() > ctxt.getCurrentInstanceCount()) {
+ if (iaas.getMaxInstanceLimit() > dataHolder.getActiveInstanceCount(iaas.getType())) {
try {
iaas.getIaas().setDynamicPayload(iaas);
@@ -423,7 +423,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
ctxt.addNodeToPublicIp(node.getId(), ip);
// to faster look up
- FasterLookUpDataHolder.getInstance().addNodeId(
+ dataHolder.addNodeId(
node.getId(), serviceCtxt);
serviceCtxt.getCartridge().setLastlyUsedIaas(iaas);
@@ -431,7 +431,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
// add this ip to the topology
appendToPublicIpProperty(ip, serviceCtxt);
- ctxt.incrementCurrentInstanceCountByOne();
+ dataHolder.updateActiveInstanceCount(iaas.getType(), 1);
// persist in registry
persist();
@@ -513,7 +513,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
private void persist() {
try {
RegistryManager.getInstance().persist(
- FasterLookUpDataHolder.getInstance());
+ dataHolder);
} catch (RegistryException e) {
String msg = "Failed to persist the Cloud Controller data in registry. Further, transaction roll back also failed.";
@@ -545,7 +545,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
log.info("Starting to terminate an instance of domain : " + domainName
+ " and sub domain : " + subDomainName);
- ServiceContext serviceCtxt = FasterLookUpDataHolder.getInstance()
+ ServiceContext serviceCtxt = dataHolder
.getServiceContext(domainName, subDomainName);
if (serviceCtxt == null) {
@@ -559,7 +559,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
if (serviceCtxt.getCartridge() == null) {
serviceCtxt.setCartridge(loadCartridge(
serviceCtxt.getCartridgeType(), serviceCtxt.getPayload(),
- FasterLookUpDataHolder.getInstance().getCartridges()));
+ dataHolder.getCartridges()));
}
// if still, Cartridge is null
@@ -633,7 +633,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
log.info("Starting to terminate the last instance spawned, of domain : "
+ domainName + " and sub domain : " + subDomainName);
- ServiceContext serviceCtxt = FasterLookUpDataHolder.getInstance()
+ ServiceContext serviceCtxt = dataHolder
.getServiceContext(domainName, subDomainName);
if (serviceCtxt == null) {
@@ -647,7 +647,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
if (serviceCtxt.getCartridge() == null) {
serviceCtxt.setCartridge(loadCartridge(
serviceCtxt.getCartridgeType(), serviceCtxt.getPayload(),
- FasterLookUpDataHolder.getInstance().getCartridges()));
+ dataHolder.getCartridges()));
}
if (serviceCtxt.getCartridge() == null) {
@@ -709,7 +709,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
log.info("Starting to terminate all instances of domain : "
+ domainName + " and sub domain : " + subDomainName);
- ServiceContext serviceCtxt = FasterLookUpDataHolder.getInstance()
+ ServiceContext serviceCtxt = dataHolder
.getServiceContext(domainName, subDomainName);
if (serviceCtxt == null) {
@@ -723,7 +723,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
if (serviceCtxt.getCartridge() == null) {
serviceCtxt.setCartridge(loadCartridge(
serviceCtxt.getCartridgeType(), serviceCtxt.getPayload(),
- FasterLookUpDataHolder.getInstance().getCartridges()));
+ dataHolder.getCartridges()));
}
if (serviceCtxt.getCartridge() == null) {
@@ -783,7 +783,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
int pendingInstanceCount = 0;
- ServiceContext subjectedSerCtxt = FasterLookUpDataHolder.getInstance()
+ ServiceContext subjectedSerCtxt = dataHolder
.getServiceContext(domainName, subDomainName);
if (subjectedSerCtxt != null
@@ -792,7 +792,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
// load cartridge
subjectedSerCtxt.setCartridge(loadCartridge(subjectedSerCtxt
.getCartridgeType(), subjectedSerCtxt.getPayload(),
- FasterLookUpDataHolder.getInstance().getCartridges()));
+ dataHolder.getCartridges()));
if (subjectedSerCtxt.getCartridge() == null) {
return pendingInstanceCount;
@@ -886,7 +886,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
// remove the node id
ctxt.removeNodeId(nodeId);
- ctxt.decrementCurrentInstanceCountByOne();
+ dataHolder.updateActiveInstanceCount(iaasTemp.getType(), -1);
// publish data to BAM
CartridgeInstanceDataPublisherTask.publish();
@@ -997,7 +997,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
newServiceCtxt.setCartridgeType(cartridgeType);
- for (Cartridge cartridge : FasterLookUpDataHolder.getInstance()
+ for (Cartridge cartridge : dataHolder
.getCartridges()) {
if (cartridge.getType().equals(cartridgeType)) {
newServiceCtxt.setCartridge(cartridge);
@@ -1066,7 +1066,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
@Override
public String[] getRegisteredCartridges() {
// get the list of cartridges registered
- List<Cartridge> cartridges = FasterLookUpDataHolder.getInstance()
+ List<Cartridge> cartridges = dataHolder
.getCartridges();
if (cartridges == null) {
@@ -1098,7 +1098,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
@Override
public CartridgeInfo getCartridgeInfo(String cartridgeType)
throws UnregisteredCartridgeException {
- Cartridge cartridge = FasterLookUpDataHolder.getInstance()
+ Cartridge cartridge = dataHolder
.getCartridge(cartridgeType);
if (cartridge != null) {
@@ -1120,7 +1120,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
subDomain = checkSubDomain(subDomain);
// find the service context
- ServiceContext subjectedSerCtxt = FasterLookUpDataHolder.getInstance()
+ ServiceContext subjectedSerCtxt = dataHolder
.getServiceContext(domain, subDomain);
if (subjectedSerCtxt == null) {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/de031caa/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
index 9836207..c6e1496 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
@@ -100,6 +100,14 @@ public class FasterLookUpDataHolder implements Serializable{
* This map is only used by BAM data publisher in CC.
*/
private Map<String, String> nodeIdToStatusMap = new HashMap<String, String>();
+
+ /**
+ * Key - iaas type
+ * Value - # of running instance count
+ * This map will be used to track the running instances count in each IaaS
+ */
+ private Map<String, Integer> iaasToActiveInstanceCountMap = new HashMap<String, Integer>();
+
private transient DataPublisher dataPublisher;
private String streamId;
private boolean isPublisherRunning;
@@ -247,6 +255,19 @@ public class FasterLookUpDataHolder implements Serializable{
return null;
}
+
+ public void updateActiveInstanceCount(String iaasType, int count) {
+ int currentCount = 0;
+ if(iaasToActiveInstanceCountMap.containsKey(iaasType)){
+ currentCount = iaasToActiveInstanceCountMap.get(iaasType);
+ }
+ iaasToActiveInstanceCountMap.put(iaasType, currentCount+count);
+ }
+
+ public int getActiveInstanceCount(String iaasType) {
+ Integer count = iaasToActiveInstanceCountMap.get(iaasType);
+ return count == null ? 0 : count;
+ }
// public void addCartridges(List<Cartridge> newCartridges) {
// if (this.cartridges == null) {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/de031caa/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
index ddbc5e5..2e6df1d 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
@@ -44,8 +44,6 @@ public class IaasContext implements Serializable{
private List<String> toBeRemovedNodeIds;
- private int currentInstanceCount = 0;
-
public IaasContext(String iaasType) {
this.type = iaasType;
nodeToPublicIp = new HashMap<String, String>();
@@ -153,15 +151,4 @@ public class IaasContext implements Serializable{
this.type = type;
}
- public int getCurrentInstanceCount() {
- return currentInstanceCount;
- }
-
- public void incrementCurrentInstanceCountByOne() {
- this.currentInstanceCount += 1;
- }
-
- public void decrementCurrentInstanceCountByOne() {
- this.currentInstanceCount -= 1;
- }
}
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by ni...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/10b96f18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/10b96f18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/10b96f18
Branch: refs/heads/master
Commit: 10b96f1839b0e3d05fc46f637fd9babd609bdace
Parents: de031ca c2059be
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Aug 8 11:54:05 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Aug 8 11:54:05 2013 +0530
----------------------------------------------------------------------
.../src/conf/cartridge-config.properties | 12 ++--
.../resources/conf/cartridge-config.properties | 12 ++--
products/elb/modules/distribution/pom.xml | 15 ----
.../distribution/src/main/assembly/bin.xml | 16 ++++-
.../distribution/src/main/assembly/dist.xml | 39 -----------
.../distribution/src/main/assembly/src.xml | 74 --------------------
products/elb/modules/p2-profile/pom.xml | 6 +-
.../ec2-demo-setup/tempconfigs/agent.properties | 6 +-
tools/ec2-demo-setup/tempconfigs/hosts.erb | 19 -----
9 files changed, 31 insertions(+), 168 deletions(-)
----------------------------------------------------------------------