Repository: stratos
Updated Branches:
  refs/heads/stratos-4.1.x c5b3f1375 -> 65f8002f0


overriding availabilityZone in cc.xml with zone in partitions in spawning 
instances


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

Branch: refs/heads/stratos-4.1.x
Commit: caa3ab27229cd042730ed24709de09195e0b9008
Parents: c9115e4
Author: Isuru Haththotuwa <[email protected]>
Authored: Wed Nov 18 09:15:10 2015 +0530
Committer: Isuru Haththotuwa <[email protected]>
Committed: Wed Nov 18 09:18:32 2015 +0530

----------------------------------------------------------------------
 .../context/CloudControllerContext.java         |  4 +++-
 .../cloud/controller/iaases/ec2/EC2Iaas.java    | 24 +++++++++++++-------
 2 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/caa3ab27/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
index 2c87707..0d2e8bc 100644
--- 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
+++ 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
@@ -829,7 +829,9 @@ public class CloudControllerContext implements Serializable 
{
 
         // if the two objects are equal, no need to build again
         if (cachedIaasProvider.equals(newIaasProvider)) {
-            log.info("New IaaSProvider object is equal to the cached one, no 
need to re-build");
+            if (log.isDebugEnabled()) {
+                log.debug("New IaaSProvider object is equal to the cached one, 
no need to re-build");
+            }
             return cachedIaasProvider;
         }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/caa3ab27/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2Iaas.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2Iaas.java
 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2Iaas.java
index 62fe0db..948c0cb 100644
--- 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2Iaas.java
+++ 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2Iaas.java
@@ -86,25 +86,25 @@ public class EC2Iaas extends JcloudsIaas {
         // set image id specified
         templateBuilder.imageId(iaasInfo.getImage());
 
-        if (iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE) 
!= null) {
+        if (iaasInfo.getProperty(CloudControllerConstants.ZONE_ELEMENT) != 
null) {
             Set<? extends Location> locations = 
iaasInfo.getComputeService().listAssignableLocations();
             for (Location location : locations) {
                 if 
(location.getScope().toString().equalsIgnoreCase(CloudControllerConstants.ZONE_ELEMENT)
 && location
-                        
.getId().equals(iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE)))
 {
+                        
.getId().equals(iaasInfo.getProperty(CloudControllerConstants.ZONE_ELEMENT))) {
                     templateBuilder.locationId(location.getId());
-                    log.info("ZONE has been set as " + 
iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE)
+                    log.info("ZONE has been set as " + iaasInfo.getProperty
+                            (CloudControllerConstants.ZONE_ELEMENT)
                             + " with id: " + location.getId());
                     break;
                 }
             }
-        } else if (iaasInfo.getProperty(CloudControllerConstants.ZONE_ELEMENT) 
!= null) {
+        } else if 
(iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE) != null) {
             Set<? extends Location> locations = 
iaasInfo.getComputeService().listAssignableLocations();
             for (Location location : locations) {
                 if 
(location.getScope().toString().equalsIgnoreCase(CloudControllerConstants.ZONE_ELEMENT)
 && location
-                        
.getId().equals(iaasInfo.getProperty(CloudControllerConstants.ZONE_ELEMENT))) {
+                        
.getId().equals(iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE)))
 {
                     templateBuilder.locationId(location.getId());
-                    log.info("ZONE has been set as " + iaasInfo.getProperty
-                            (CloudControllerConstants.ZONE_ELEMENT)
+                    log.info("ZONE has been set as " + 
iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE)
                             + " with id: " + location.getId());
                     break;
                 }
@@ -119,7 +119,15 @@ public class EC2Iaas extends JcloudsIaas {
         // build the Template
         Template template = templateBuilder.build();
 
-        if (iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE) 
!= null) {
+        if (iaasInfo.getProperty(CloudControllerConstants.ZONE_ELEMENT) != 
null) {
+            if (!template.getLocation().getId()
+                    
.equals(iaasInfo.getProperty(CloudControllerConstants.ZONE_ELEMENT))) {
+                log.warn("couldn't find assignable ZONE of id :" +
+                        
iaasInfo.getProperty(CloudControllerConstants.ZONE_ELEMENT) + " in the IaaS. " +
+                        "Hence using the default location as " + 
template.getLocation().getScope().toString() +
+                        " with the id " + template.getLocation().getId());
+            }
+        } else if 
(iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE) != null) {
             if (!template.getLocation().getId()
                     
.equals(iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE))) {
                 log.warn("couldn't find assignable ZONE of id :" +

Reply via email to