You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/08/20 11:36:36 UTC
[50/51] [abbrv] [partial] stratos git commit: Revert "Upgrading to
jclouds 1.9.1"
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/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 ccd6d58..0ef92f4 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
@@ -97,7 +97,7 @@ public class EC2Iaas extends JcloudsIaas {
if (location.getScope().toString().equalsIgnoreCase(CloudControllerConstants.ZONE_ELEMENT) &&
location.getId().equals(iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE))) {
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.AVAILABILITY_ZONE)
+ " with id: " + location.getId());
break;
}
@@ -114,7 +114,7 @@ public class EC2Iaas extends JcloudsIaas {
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 :" +
+ log.warn("couldn't find assignable ZONE of id :" +
iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE) + " in the IaaS. " +
"Hence using the default location as " + template.getLocation().getScope().toString() +
" with the id " + template.getLocation().getId());
@@ -374,7 +374,7 @@ public class EC2Iaas extends JcloudsIaas {
if (region == null || iaasInfo == null) {
String msg =
- "Region or IaaSProvider is null. [region] " + region + ", [IaaSProvider] " +
+ "Region or IaaSProvider is null: region: " + region + " - IaaSProvider: " +
iaasInfo;
log.error(msg);
throw new InvalidRegionException(msg);
@@ -402,7 +402,7 @@ public class EC2Iaas extends JcloudsIaas {
if (zone == null || iaasInfo == null) {
String msg =
- "Zone or IaaSProvider is null. [zone] " + zone + ", [IaaSProvider] " +
+ "Zone or IaaSProvider is null: zone: " + zone + " - IaaSProvider: " +
iaasInfo;
log.error(msg);
throw new InvalidZoneException(msg);
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2PartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2PartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2PartitionValidator.java
index 8fbeabc..03f57df 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2PartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/ec2/EC2PartitionValidator.java
@@ -28,7 +28,7 @@ import org.apache.stratos.cloud.controller.iaases.Iaas;
import org.apache.stratos.cloud.controller.iaases.PartitionValidator;
import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.Scope;
+import org.apache.stratos.messaging.domain.topology.Scope;
import java.util.Properties;
@@ -46,13 +46,13 @@ public class EC2PartitionValidator implements PartitionValidator {
public IaasProvider validate(Partition partition, Properties properties) throws InvalidPartitionException {
// validate the existence of the region and zone properties.
try {
- if (properties.containsKey(Scope.REGION.toString())) {
- String region = properties.getProperty(Scope.REGION.toString());
+ if (properties.containsKey(Scope.region.toString())) {
+ String region = properties.getProperty(Scope.region.toString());
if (iaasProvider.getImage() != null && !iaasProvider.getImage().contains(region)) {
- String message = "Invalid partition detected, invalid region. [partition-id] " + partition.getId() +
- ", [region] " + region;
+ String message = "Invalid partition detected, invalid region: [partition-id] " + partition.getId() +
+ " [region] " + region;
log.error(message);
throw new InvalidPartitionException(message);
}
@@ -63,8 +63,8 @@ public class EC2PartitionValidator implements PartitionValidator {
Iaas updatedIaas = CloudControllerServiceUtil.buildIaas(updatedIaasProvider);
updatedIaas.setIaasProvider(updatedIaasProvider);
- if (properties.containsKey(Scope.ZONE.toString())) {
- String zone = properties.getProperty(Scope.ZONE.toString());
+ if (properties.containsKey(Scope.zone.toString())) {
+ String zone = properties.getProperty(Scope.zone.toString());
iaas.isValidZone(region, zone);
updatedIaasProvider.setProperty(CloudControllerConstants.AVAILABILITY_ZONE, zone);
updatedIaas = CloudControllerServiceUtil.buildIaas(updatedIaasProvider);
@@ -80,6 +80,7 @@ public class EC2PartitionValidator implements PartitionValidator {
}
} catch (Exception ex) {
String message = "Invalid partition detected: [partition-id] " + partition.getId();
+ log.error(message, ex);
throw new InvalidPartitionException(message, ex);
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEIaas.java
index 141e266..975fe0c 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEIaas.java
@@ -37,23 +37,23 @@ import org.apache.stratos.cloud.controller.iaases.PartitionValidator;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
import org.apache.stratos.cloud.controller.util.ComputeServiceBuilderUtil;
import org.jclouds.ContextBuilder;
+import org.jclouds.collect.IterableWithMarker;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.domain.Location;
import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
-import org.jclouds.googlecomputeengine.domain.AttachDisk;
-import org.jclouds.googlecomputeengine.domain.Disk;
-import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.*;
import org.jclouds.googlecomputeengine.features.DiskApi;
import org.jclouds.googlecomputeengine.features.InstanceApi;
-import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
+import org.jclouds.googlecomputeengine.features.RegionApi;
+import org.jclouds.googlecomputeengine.features.ZoneApi;
+import org.jclouds.googlecomputeengine.options.AttachDiskOptions;
+import org.jclouds.googlecomputeengine.options.AttachDiskOptions.DiskType;
-import java.net.URI;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
@@ -61,8 +61,11 @@ import static java.util.concurrent.TimeUnit.SECONDS;
import static org.jclouds.util.Predicates2.retry;
public class GCEIaas extends JcloudsIaas {
+
+
private static final Log log = LogFactory.getLog(GCEIaas.class);
- public static final int MAX_WAIT_TIME = 60; // seconds
+
+ private static final String PROJECTNAME = "projectName";
public GCEIaas(IaasProvider iaasProvider) {
super(iaasProvider);
@@ -88,10 +91,10 @@ public class GCEIaas extends JcloudsIaas {
throw new CloudControllerException(msg);
}
- if (log.isDebugEnabled()) {
- log.debug("Building template for Google Compute Engine IaaS");
- }
- TemplateBuilder templateBuilder = iaasInfo.getComputeService().templateBuilder();
+ log.info("gce buildTemplate");
+
+ TemplateBuilder templateBuilder = iaasInfo.getComputeService()
+ .templateBuilder();
// set image id specified
templateBuilder.imageId(iaasInfo.getImage());
@@ -103,7 +106,7 @@ public class GCEIaas extends JcloudsIaas {
if (location.getScope().toString().equalsIgnoreCase(CloudControllerConstants.ZONE_ELEMENT) &&
location.getId().equals(zone)) {
templateBuilder.locationId(location.getId());
- log.info("zone has been set as " + zone
+ log.info("ZONE has been set as " + zone
+ " with id: " + location.getId());
break;
}
@@ -114,14 +117,14 @@ public class GCEIaas extends JcloudsIaas {
// set instance type eg: m1.large
templateBuilder.hardwareId(iaasInfo.getProperty(CloudControllerConstants.INSTANCE_TYPE));
}
+
// build the Template
Template template = templateBuilder.build();
if (zone != null) {
if (!template.getLocation().getId().equals(zone)) {
- log.warn("couldn't find assignable zone of id :" + zone +
- " in the IaaS. Hence using the default location as " +
- template.getLocation().getScope().toString() +
+ log.warn("couldn't find assignable ZONE of id :" + zone +
+ " in the IaaS. Hence using the default location as " + template.getLocation().getScope().toString() +
" with the id " + template.getLocation().getId());
}
}
@@ -131,11 +134,15 @@ public class GCEIaas extends JcloudsIaas {
// wish to assign IPs manually, it can be non-blocking.
// is auto-assign-ip mode or manual-assign-ip mode? - default mode is
// non-blocking
- boolean blockUntilRunning = Boolean.parseBoolean(iaasInfo.getProperty("autoAssignIp"));
- template.getOptions().as(GoogleComputeEngineTemplateOptions.class).blockUntilRunning(blockUntilRunning);
+ boolean blockUntilRunning = Boolean.parseBoolean(iaasInfo
+ .getProperty("autoAssignIp"));
+ template.getOptions().as(TemplateOptions.class)
+ .blockUntilRunning(blockUntilRunning);
- // this is required in order to avoid creation of additional security groups by Jclouds.
- template.getOptions().as(GoogleComputeEngineTemplateOptions.class).inboundPorts(22, 80, 8080, 443, 8243);
+ // this is required in order to avoid creation of additional security
+ // groups by Jclouds.
+ template.getOptions().as(TemplateOptions.class)
+ .inboundPorts(22, 80, 8080, 443, 8243);
if (zone != null) {
templateBuilder.locationId(zone);
@@ -147,9 +154,8 @@ public class GCEIaas extends JcloudsIaas {
for (String propertyKey : iaasInfo.getProperties().keySet()) {
if (propertyKey.startsWith(CloudControllerConstants.TAGS_AS_KEY_VALUE_PAIRS_PREFIX)) {
- keyValuePairTagsMap
- .put(propertyKey.substring(CloudControllerConstants.TAGS_AS_KEY_VALUE_PAIRS_PREFIX.length()),
- iaasInfo.getProperties().get(propertyKey));
+ keyValuePairTagsMap.put(propertyKey.substring(CloudControllerConstants.TAGS_AS_KEY_VALUE_PAIRS_PREFIX.length()),
+ iaasInfo.getProperties().get(propertyKey));
template.getOptions()
.userMetadata(keyValuePairTagsMap);
}
@@ -162,7 +168,7 @@ public class GCEIaas extends JcloudsIaas {
networks.add(ni.getNetworkUuid());
log.info("using network interface " + ni.getNetworkUuid());
}
- template.getOptions().as(GoogleComputeEngineTemplateOptions.class).networks(networks);
+ template.getOptions().as(TemplateOptions.class).networks(networks);
log.info("using network interface " + networks);
}
@@ -220,15 +226,25 @@ public class GCEIaas extends JcloudsIaas {
@Override
public boolean isValidRegion(String region) throws InvalidRegionException {
IaasProvider iaasInfo = getIaasProvider();
+
if (region == null || iaasInfo == null) {
String msg = "Region or IaaSProvider is null: region: " + region + " - IaaSProvider: " + iaasInfo;
log.error(msg);
throw new InvalidRegionException(msg);
}
+
GoogleComputeEngineApi api = getGCEApi();
- if (api.regions().get(region) != null) {
- return true;
+ RegionApi regionApi = api.getRegionApiForProject(iaasInfo.getProperty(PROJECTNAME));
+
+ for (IterableWithMarker<Region> page : regionApi.list()) {
+ for (Region r : page) {
+ if (region.equalsIgnoreCase(r.getName())) {
+ log.debug("Found a matching region: " + region);
+ return true;
+ }
+ }
}
+
String msg = "Invalid region: " + region + " in the iaas: " + iaasInfo.getType();
log.error(msg);
throw new InvalidRegionException(msg);
@@ -239,16 +255,24 @@ public class GCEIaas extends JcloudsIaas {
IaasProvider iaasInfo = getIaasProvider();
if (zone == null || iaasInfo == null) {
- String msg = "Zone or IaaSProvider is null. [region] " + region + ", [zone] " + zone + ", [IaaSProvider] "
- + iaasInfo;
+ String msg = "Zone or IaaSProvider is null: region: " + region +
+ " zone: " + zone + " - IaaSProvider: " + iaasInfo;
log.error(msg);
throw new InvalidZoneException(msg);
}
GoogleComputeEngineApi api = getGCEApi();
- if (api.zones().get(zone) != null) {
- return true;
+ ZoneApi zoneApi = api.getZoneApiForProject(iaasInfo.getProperty(PROJECTNAME));
+
+ for (IterableWithMarker<Zone> page : zoneApi.list()) {
+ for (Zone z : page) {
+ if (zone.equalsIgnoreCase(z.getName())) {
+ log.debug("Found a matching zone: " + zone);
+ return true;
+ }
+ }
}
+
String msg = "Invalid zone: " + zone + " in the region: " + region + " and of the iaas: " + iaasInfo.getType();
log.error(msg);
throw new InvalidZoneException(msg);
@@ -278,23 +302,19 @@ public class GCEIaas extends JcloudsIaas {
String diskName = "stratos-disk-" + rand.nextInt(100000);
DiskApi diskApi = getGCEDiskApi();
String zone = getZone();
- log.info("Creating volume: " + diskName + " in zone: " + zone + " of size: " + sizeGB);
- try {
- DiskCreationOptions diskCreationOptions = new DiskCreationOptions.Builder().sizeGb(sizeGB).sourceSnapshot
- (new URI(snapshotId)).build();
- Operation oper = diskApi.create(diskName, diskCreationOptions);
- oper = waitGCEOperationDone(oper);
- if (!oper.status().equals(Operation.Status.DONE)) {
- log.error("Failed to create volume: " + diskName + " of size: " + sizeGB +
- " in zone: " + zone + " operation: " + oper);
- return null;
- }
- return diskName;
- }
- catch (Exception e) {
- log.error("Error creating volume", e);
+
+ log.debug("Creating volume: " + diskName + " in zone: " + zone + " of size: " + sizeGB);
+
+ Operation oper = diskApi.createInZone(diskName, sizeGB, zone);
+
+ oper = waitGCEOperationDone(oper);
+ if (oper.getStatus() != Operation.Status.DONE) {
+ log.error("Failed to create volume: " + diskName + " of size: " + sizeGB +
+ " in zone: " + zone + " operation: " + oper);
+ return null;
}
- return null;
+
+ return diskName;
}
@Override
@@ -303,55 +323,64 @@ public class GCEIaas extends JcloudsIaas {
InstanceApi instApi = getGCEInstanceApi();
String zone = getZone();
- log.info("Trying to attach volume: " + volumeId + " to instance: " + instanceId +
+ log.debug("Trying to attach volume: " + volumeId + " to instance: " + instanceId +
" in zone: " + zone + " at devicename: " + deviceName);
- Disk disk = diskApi.get(volumeId);
+ Disk disk = diskApi.getInZone(zone, volumeId);
if (disk == null) {
log.error("Failed to get volume: " + volumeId + " in zone: " + zone);
return null;
}
+
log.debug("Found volumeId: " + volumeId + " volume: " + disk);
- try {
- Operation oper =
- instApi.attachDisk(instanceId, AttachDisk.create(AttachDisk.Type.PERSISTENT, AttachDisk.Mode
- .READ_WRITE, disk.selfLink(), deviceName, true, null, false, null, null));
- oper = waitGCEOperationDone(oper);
- if (!oper.status().equals(Operation.Status.DONE)) {
- log.error("Failed to attach volume: " + volumeId + " to instance: " + instanceId +
- " in zone: " + zone + " at device: " + deviceName + " operation: " + oper);
- return null;
- }
- return volumeId;
- }
- catch (Exception e) {
- log.error("Error attaching volume", e);
+
+ Operation oper = instApi.attachDiskInZone(zone, instanceId,
+ new AttachDiskOptions().type(DiskType.PERSISTENT)
+ .source(disk.getSelfLink())
+ .mode(AttachDiskOptions.DiskMode.READ_WRITE)
+ .deviceName(deviceName));
+ oper = waitGCEOperationDone(oper);
+ if (oper.getStatus() != Operation.Status.DONE) {
+ log.error("Failed to attach volume: " + volumeId + " to instance: " + instanceId +
+ " in zone: " + zone + " at device: " + deviceName + " operation: " + oper);
+ return null;
}
- return null;
+
+ return volumeId;
}
@Override
public void detachVolume(String instanceId, String volumeId) {
InstanceApi instApi = getGCEInstanceApi();
String zone = getZone();
- Instance inst = instApi.get(instanceId);
- log.info("Trying to detach volume: " + volumeId + " from instance: " + instanceId + " in zone: " + zone);
+ Instance inst = instApi.getInZone(zone, instanceId);
+
+ log.debug("Trying to detach volume: " + volumeId + " from instance: " + instanceId +
+ " " + inst + " in zone: " + zone);
+
if (inst == null) {
log.error("Failed to find instance: " + instanceId + " in zone: " + zone);
return;
}
- for (Instance.AttachedDisk disk : inst.disks()) {
- if (disk.deviceName().equals(volumeId)) {
- log.info("Found disk to be detached. Source: " + disk.source() + " devicename: " + disk.deviceName());
- Operation oper = instApi.detachDisk(instanceId, disk.deviceName());
+
+ for (Instance.AttachedDisk disk : inst.getDisks()) {
+ Instance.PersistentAttachedDisk persistentDisk = (Instance.PersistentAttachedDisk) disk;
+
+ log.debug("Found disk - src: " + persistentDisk.getSourceDiskName() +
+ " devicename: " + persistentDisk.getDeviceName());
+
+ if (persistentDisk.getSourceDiskName().equals(volumeId)) {
+ Operation oper = instApi.detachDiskInZone(zone, instanceId, persistentDisk.getDeviceName().get());
oper = waitGCEOperationDone(oper);
- if (!oper.status().equals(Operation.Status.DONE)) {
+ if (oper.getStatus() != Operation.Status.DONE) {
log.error("Failed to detach volume: " + volumeId + " to instance: " + instanceId +
- " in zone: " + zone + " at device: " + disk.deviceName() + " result operation: " + oper);
+ " in zone: " + zone + " at device: " + persistentDisk.getDeviceName() +
+ " result operation: " + oper);
}
return;
}
}
+
log.error("Cannot find volume: " + volumeId + " in instance: " + instanceId);
}
@@ -359,11 +388,13 @@ public class GCEIaas extends JcloudsIaas {
public void deleteVolume(String volumeId) {
DiskApi diskApi = getGCEDiskApi();
String zone = getZone();
- log.info("Deleting volume: " + volumeId + " in zone: " + zone);
- Operation oper = diskApi.delete(volumeId);
+
+ log.debug("Deleting volume: " + volumeId + " in zone: " + zone);
+
+ Operation oper = diskApi.deleteInZone(zone, volumeId);
oper = waitGCEOperationDone(oper);
- if (!oper.status().equals(Operation.Status.DONE)) {
+ if (oper.getStatus() != Operation.Status.DONE) {
log.error("Failed to delete volume: " + volumeId + " in zone: " + zone +
" operation: " + oper);
}
@@ -388,14 +419,19 @@ public class GCEIaas extends JcloudsIaas {
}
private DiskApi getGCEDiskApi() {
- return getGCEApi().disksInZone(getZone());
+ IaasProvider iaasInfo = getIaasProvider();
+ String projectName = iaasInfo.getProperty(PROJECTNAME);
+ return getGCEApi().getDiskApiForProject(projectName);
}
private InstanceApi getGCEInstanceApi() {
- return getGCEApi().instancesInZone(getZone());
+ IaasProvider iaasInfo = getIaasProvider();
+ String projectName = iaasInfo.getProperty(PROJECTNAME);
+ return getGCEApi().getInstanceApiForProject(projectName);
}
private Operation waitGCEOperationDone(Operation operation) {
+ int maxWaitTime = 15; // 15 seconds
IaasProvider iaasInfo = getIaasProvider();
Injector injector = ContextBuilder.newBuilder(iaasInfo.getProvider())
.credentials(iaasInfo.getIdentity(), iaasInfo.getCredential())
@@ -404,8 +440,9 @@ public class GCEIaas extends JcloudsIaas {
injector.getInstance(Key.get(new TypeLiteral<Predicate<AtomicReference<Operation>>>() {
}, Names.named("zone")));
AtomicReference<Operation> operationReference = Atomics.newReference(operation);
- retry(zoneOperationDonePredicate, MAX_WAIT_TIME, 1, SECONDS).apply(operationReference);
+ retry(zoneOperationDonePredicate, maxWaitTime, 1, SECONDS).apply(operationReference);
return operationReference.get();
}
-}
\ No newline at end of file
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEPartitionValidator.java
index 2b0db62..71d7aa3 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/gce/GCEPartitionValidator.java
@@ -22,13 +22,9 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.domain.IaasProvider;
import org.apache.stratos.cloud.controller.domain.Partition;
-import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderException;
import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
-import org.apache.stratos.cloud.controller.iaases.Iaas;
import org.apache.stratos.cloud.controller.iaases.PartitionValidator;
-import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
-import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.Scope;
+import org.apache.stratos.cloud.controller.iaases.vcloud.VCloudPartitionValidator;
import java.util.Properties;
@@ -38,75 +34,17 @@ import java.util.Properties;
*/
public class GCEPartitionValidator implements PartitionValidator {
- private static final Log log = LogFactory.getLog(GCEPartitionValidator.class);
+ private static final Log log = LogFactory.getLog(VCloudPartitionValidator.class);
+
private IaasProvider iaasProvider;
- private Iaas iaas;
@Override
public IaasProvider validate(Partition partition, Properties properties) throws InvalidPartitionException {
- try {
- if (properties.containsKey(Scope.REGION.toString())) {
- String region = properties.getProperty(Scope.REGION.toString());
-
- if (iaasProvider.getImage() != null && !iaasProvider.getImage().contains(region)) {
-
- String message = "Invalid partition detected, invalid region. [partition-id] " + partition.getId() +
- ", [region] " + region;
- log.error(message);
- throw new InvalidPartitionException(message);
- }
-
- iaas.isValidRegion(region);
-
- IaasProvider updatedIaasProvider = new IaasProvider(iaasProvider);
- Iaas updatedIaas = CloudControllerServiceUtil.buildIaas(updatedIaasProvider);
- updatedIaas.setIaasProvider(updatedIaasProvider);
-
- if (properties.containsKey(Scope.ZONE.toString())) {
- String zone = properties.getProperty(Scope.ZONE.toString());
- iaas.isValidZone(region, zone);
- updatedIaasProvider.setProperty(CloudControllerConstants.AVAILABILITY_ZONE, zone);
- updatedIaas = CloudControllerServiceUtil.buildIaas(updatedIaasProvider);
- updatedIaas.setIaasProvider(updatedIaasProvider);
- }
-
- updateOtherProperties(updatedIaasProvider, properties);
- return updatedIaasProvider;
- } else {
- return iaasProvider;
- }
- }
- catch (Exception ex) {
- String message = "Invalid partition detected: [partition-id] " + partition.getId();
- throw new InvalidPartitionException(message, ex);
- }
- }
-
- private void updateOtherProperties(IaasProvider updatedIaasProvider, Properties properties) {
- Iaas updatedIaas;
- try {
- updatedIaas = CloudControllerServiceUtil.buildIaas(updatedIaasProvider);
-
- for (Object property : properties.keySet()) {
- if (property instanceof String) {
- String key = (String) property;
- updatedIaasProvider.setProperty(key, properties.getProperty(key));
- if (log.isDebugEnabled()) {
- log.debug("Added property " + key + " to the IaasProvider.");
- }
- }
- }
- updatedIaas = CloudControllerServiceUtil.buildIaas(updatedIaasProvider);
- updatedIaas.setIaasProvider(updatedIaasProvider);
- }
- catch (InvalidIaasProviderException ignore) {
- }
-
+ return iaasProvider;
}
@Override
public void setIaasProvider(IaasProvider iaasProvider) {
this.iaasProvider = iaasProvider;
- this.iaas = iaasProvider.getIaas();
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackIaas.java
index 9b0e21f..bcd10b1 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackIaas.java
@@ -266,8 +266,8 @@ public class OpenstackIaas extends JcloudsIaas {
// jclouds availability zone = stratos zone
if (region == null || zone == null || iaasInfo == null) {
- String msg = "Host or Zone or IaaSProvider is null. [region] " + region + ", [zone] " +
- zone + ", [IaaSProvider] " + iaasInfo;
+ String msg = "Host or Zone or IaaSProvider is null: region: " + region + " - zone: " +
+ zone + " - IaaSProvider: " + iaasInfo;
log.error(msg);
throw new InvalidZoneException(msg);
}
@@ -295,8 +295,7 @@ public class OpenstackIaas extends JcloudsIaas {
IaasProvider iaasInfo = getIaasProvider();
if (host == null || zone == null || iaasInfo == null) {
- String msg = String.format("Host or Zone or IaaSProvider is null. [host] %s, [zone] %s, [IaaSProvider] %s",
- host, zone, iaasInfo);
+ String msg = String.format("Host or Zone or IaaSProvider is null: host: %s - zone: %s - IaaSProvider: %s", host, zone, iaasInfo);
log.error(msg);
throw new InvalidHostException(msg);
}
@@ -314,8 +313,7 @@ public class OpenstackIaas extends JcloudsIaas {
}
}
- String msg = String.format("Invalid host: %s in the zone: %s and of the iaas: %s", host, zone, iaasInfo.getType
- ());
+ String msg = String.format("Invalid host: %s in the zone: %s and of the iaas: %s", host, zone, iaasInfo.getType());
log.error(msg);
throw new InvalidHostException(msg);
}
@@ -359,8 +357,7 @@ public class OpenstackIaas extends JcloudsIaas {
}
if (volume == null) {
- log.fatal(String.format("Volume creation was unsuccessful. [region] %s, [zone] %s, [Iaas] %s", region,
- zone, iaasInfo));
+ log.fatal(String.format("Volume creation was unsuccessful. [region] : %s [zone] : %s of Iaas : %s", region, zone, iaasInfo));
return null;
}
@@ -381,8 +378,7 @@ public class OpenstackIaas extends JcloudsIaas {
return volumeId;
}
*/
- log.info(String.format("Successfully created a new volume [id]: %s in [region] : %s [zone] : %s of Iaas : %s " +
- "[Volume ID]%s", volume.getId(), region, zone, iaasInfo, volume.getId()));
+ log.info(String.format("Successfully created a new volume [id]: %s in [region] : %s [zone] : %s of Iaas : %s [Volume ID]%s", volume.getId(), region, zone, iaasInfo, volume.getId()));
return volumeId;
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackPartitionValidator.java
index 6a77421..24f8e01 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/OpenstackPartitionValidator.java
@@ -28,7 +28,7 @@ import org.apache.stratos.cloud.controller.iaases.Iaas;
import org.apache.stratos.cloud.controller.iaases.PartitionValidator;
import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.Scope;
+import org.apache.stratos.messaging.domain.topology.Scope;
import java.util.Properties;
@@ -47,13 +47,13 @@ public class OpenstackPartitionValidator implements PartitionValidator {
public IaasProvider validate(Partition partition, Properties properties) throws InvalidPartitionException {
try {
// validate the existence of the zone and hosts properties.
- if (properties.containsKey(Scope.REGION.toString())) {
- String region = properties.getProperty(Scope.REGION.toString());
+ if (properties.containsKey(Scope.region.toString())) {
+ String region = properties.getProperty(Scope.region.toString());
if (iaasProvider.getImage() != null && !iaasProvider.getImage().contains(region)) {
- String msg = "Invalid partition detected, invalid region. [partition-id] " + partition.getId() +
- ", [region] " + region;
+ String msg = "Invalid partition detected, invalid region: [partition-id] " + partition.getId() +
+ " [region] " + region;
log.error(msg);
throw new InvalidPartitionException(msg);
}
@@ -64,8 +64,8 @@ public class OpenstackPartitionValidator implements PartitionValidator {
Iaas updatedIaas = CloudControllerServiceUtil.buildIaas(updatedIaasProvider);
updatedIaas.setIaasProvider(updatedIaasProvider);
- if (properties.containsKey(Scope.ZONE.toString())) {
- String zone = properties.getProperty(Scope.ZONE.toString());
+ if (properties.containsKey(Scope.zone.toString())) {
+ String zone = properties.getProperty(Scope.zone.toString());
iaas.isValidZone(region, zone);
updatedIaasProvider.setProperty(CloudControllerConstants.AVAILABILITY_ZONE, zone);
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/networking/NeutronNetworkingApi.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/networking/NeutronNetworkingApi.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/networking/NeutronNetworkingApi.java
index 2bf9130..1a90386 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/networking/NeutronNetworkingApi.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/openstack/networking/NeutronNetworkingApi.java
@@ -526,13 +526,11 @@ public class NeutronNetworkingApi implements OpenstackNetworkingApi {
}
this.portApi = neutronApi.getPortApi(region);
- String portApiNullOrEmptyErrorMessage = String.format("Unable to get port Api from neutron Api for region: %s",
- region);
+ String portApiNullOrEmptyErrorMessage = String.format("Unable to get port Api from neutron Api for region ", region);
assertNotNull(portApi, portApiNullOrEmptyErrorMessage);
this.floatingIPApi = neutronApi.getFloatingIPApi(region).get();
- String floatingIPApiNullOrEmptyErrorMessage = String.format("Unable to get floatingIP Api from neutron Api " +
- "for region: %s", region);
+ String floatingIPApiNullOrEmptyErrorMessage = String.format("Unable to get floatingIP Api from neutron Api for region ", region);
assertNotNull(floatingIPApi, floatingIPApiNullOrEmptyErrorMessage);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/vcloud/VCloudIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/vcloud/VCloudIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/vcloud/VCloudIaas.java
new file mode 100644
index 0000000..d87e04d
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/vcloud/VCloudIaas.java
@@ -0,0 +1,392 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.cloud.controller.iaases.vcloud;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.domain.IaasProvider;
+import org.apache.stratos.cloud.controller.domain.NetworkInterface;
+import org.apache.stratos.cloud.controller.exception.CloudControllerException;
+import org.apache.stratos.cloud.controller.iaases.JcloudsIaas;
+import org.apache.stratos.cloud.controller.iaases.PartitionValidator;
+import org.apache.stratos.cloud.controller.util.ComputeServiceBuilderUtil;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.DiskAttachOrDetachParams;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+import org.jclouds.vcloud.features.VAppApi;
+import org.jclouds.vcloud.features.VmApi;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Hashtable;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+
+public class VCloudIaas extends JcloudsIaas {
+
+
+ private static final Log log = LogFactory.getLog(VCloudIaas.class);
+
+ private static final String SHELL_TYPE = "shellType";
+ private static final String SCRIPTS_PATH = "scripts";
+ private static final String CUSTOMIZATION_SCRIPT = "customization";
+ private static final String PAYLOAD = "PAYLOAD";
+
+ public VCloudIaas(IaasProvider iaasProvider) {
+ super(iaasProvider);
+ }
+
+ @Override
+ public void buildComputeServiceAndTemplate() {
+ // builds and sets Compute Service
+ ComputeService computeService = ComputeServiceBuilderUtil.buildDefaultComputeService(getIaasProvider());
+ getIaasProvider().setComputeService(computeService);
+
+ // builds and sets Template
+ buildTemplate();
+
+ }
+
+ public void buildTemplate() {
+ IaasProvider iaasInfo = getIaasProvider();
+
+ if (iaasInfo.getComputeService() == null) {
+ String msg = "Compute service is null for IaaS provider: "
+ + iaasInfo.getName();
+ log.fatal(msg);
+ throw new CloudControllerException(msg);
+ }
+
+ //get 'native' version of jclouds' vCloud API.
+ ComputeServiceContext context = iaasInfo.getComputeService().getContext();
+ VCloudApi api = context.unwrapApi(VCloudApi.class);
+
+
+ TemplateBuilder templateBuilder = iaasInfo.getComputeService()
+ .templateBuilder();
+
+ // set image id specified
+ templateBuilder.imageId(iaasInfo.getImage());
+
+ // build the Template
+ Template template = templateBuilder.build();
+
+ // if you wish to auto assign IPs, instance spawning call should be
+ // blocking, but if you
+ // wish to assign IPs manually, it can be non-blocking.
+ // is auto-assign-ip mode or manual-assign-ip mode? - default mode is
+ // non-blocking
+ boolean blockUntilRunning = Boolean.parseBoolean(iaasInfo
+ .getProperty("autoAssignIp"));
+ template.getOptions().as(TemplateOptions.class)
+ .blockUntilRunning(blockUntilRunning);
+
+ // this is required in order to avoid creation of additional security
+ // groups by Jclouds.
+ template.getOptions().as(TemplateOptions.class)
+ .inboundPorts(22, 80, 8080, 443, 8243);
+
+ if (iaasInfo.getNetworkInterfaces() != null) {
+ Set<String> networksSet = new LinkedHashSet<String>(iaasInfo.getNetworkInterfaces().length);
+ Hashtable<String, NetworkConnection> vcloudNetworkOptions = new Hashtable<String, NetworkConnection>(iaasInfo.getNetworkInterfaces().length);
+
+ int i = 0;
+ for (NetworkInterface ni : iaasInfo.getNetworkInterfaces()) {
+
+ String networkUuid = ni.getNetworkUuid();
+ String networkName = null;
+ IpAddressAllocationMode ipAllocMode = IpAddressAllocationMode.NONE;
+ if (ni.getFixedIp() != null && !ni.getFixedIp().equals("")) {
+ ipAllocMode = IpAddressAllocationMode.MANUAL;
+ } else {
+ ipAllocMode = IpAddressAllocationMode.POOL;
+ }
+
+ //fetch network name.
+ try {
+ OrgNetwork orgNet = api.getNetworkApi().getNetwork(new URI(networkUuid));
+ networkName = orgNet.getName();
+ } catch (URISyntaxException e) {
+ log.error("Network UUID '" + networkUuid + "' is not a URI/href.");
+ }
+ NetworkConnection nc = new NetworkConnection(networkName, i, ni.getFixedIp(), null, true,
+ null, //TODO: support fixed Mac addrs.
+ ipAllocMode);
+ networksSet.add(networkUuid);
+ vcloudNetworkOptions.put(networkUuid, nc);
+
+ i++;
+ }
+ //new NetworkConnectionSection()
+
+ //VmApi vmApi = api.getVmApi();
+ //vmApi.updateNetworkConnectionOfVm();
+
+ template.getOptions().networks(networksSet);
+ template.getOptions().as(VCloudTemplateOptions.class).networkConnections(vcloudNetworkOptions);
+ }
+
+ //template.getOptions().as(VCloudTemplateOptions.class)
+ // .ipAddressAllocationMode(IpAddressAllocationMode.POOL);
+
+ // set Template
+ iaasInfo.setTemplate(template);
+ }
+
+ @Override
+ public void setDynamicPayload(byte[] payload) {
+ // in vCloud case we need to run a script
+ IaasProvider iaasProvider = getIaasProvider();
+
+ if (iaasProvider.getTemplate() == null || payload == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Payload for vCloud not found");
+ }
+ return;
+ }
+
+ String shellType = iaasProvider.getProperty(SHELL_TYPE);
+
+ if (shellType == null || shellType.isEmpty()) {
+ if (log.isDebugEnabled()) {
+ log.debug("Shell Type for vCloud Customization script not found from properties");
+ }
+ return;
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Shell Type '%s' will be used for vCloud Customization script", shellType));
+ }
+
+ // Payload is a String value
+ String payloadStr = new String(payload);
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Payload '%s' will be used for vCloud Customization script", payload));
+ }
+
+ Template template = iaasProvider.getTemplate();
+
+ File scriptPath = new File(CarbonUtils.getCarbonConfigDirPath(), SCRIPTS_PATH);
+
+ File customizationScriptFile = new File(new File(scriptPath, shellType), CUSTOMIZATION_SCRIPT);
+
+ if (!customizationScriptFile.exists()) {
+ if (log.isWarnEnabled()) {
+ log.warn(String.format("The vCloud Customization script '%s' does not exist",
+ customizationScriptFile.getAbsolutePath()));
+ }
+ return;
+ }
+
+ String customizationScript = null;
+
+ try {
+ customizationScript = FileUtils.readFileToString(customizationScriptFile);
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error(
+ String.format("Error reading the vCloud Customization script '%s'",
+ customizationScriptFile.getAbsolutePath()), e);
+ }
+ }
+
+ if (StringUtils.isEmpty(customizationScript)) {
+ if (log.isDebugEnabled()) {
+ log.debug("No content vCloud Customization script not found from properties");
+ }
+ return;
+ }
+
+ // Set payload
+ customizationScript = customizationScript.replaceAll(PAYLOAD, payloadStr);
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("The vCloud Customization script\n%s", customizationScript));
+ }
+
+ // Ensure the script is run.
+ if (customizationScript.length() >= 49000) {
+ log.warn("The vCloud customization script is >=49000 bytes in size; uploading dummy script and running real script via ssh.");
+ String dummyCustomizationScript = "#!/bin/sh\n"
+ + "#STRATOS: the real customization script will be invoked via ssh, since it exceeds the 49000 byte limit "
+ + "imposed by vCloud;\n"
+ + "#see "
+ + "http://pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.doc_55/GUID-1BA3B7C5-B46C-48F7-8704-945BC47A940D.html\n";
+ template.getOptions().as(VCloudTemplateOptions.class).customizationScript(dummyCustomizationScript);
+ template.getOptions().runScript(customizationScript);
+ } else {
+ template.getOptions().as(VCloudTemplateOptions.class).customizationScript(customizationScript);
+ }
+
+ // Run the script
+ //template.getOptions().runScript(customizationScript);
+ }
+
+ @Override
+ public boolean createKeyPairFromPublicKey(String region, String keyPairName, String publicKey) {
+
+ // TODO
+ return false;
+ }
+
+ @Override
+ public List<String> associateAddresses(NodeMetadata node) {
+
+ // TODO
+ return null;
+
+ }
+
+ @Override
+ public String associatePredefinedAddress(NodeMetadata node, String ip) {
+ return "";
+ }
+
+ @Override
+ public void releaseAddress(String ip) {
+ // TODO
+ }
+
+ @Override
+ public boolean isValidRegion(String region) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isValidZone(String region, String zone) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ @Override
+ public boolean isValidHost(String zone, String host) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ @Override
+ public PartitionValidator getPartitionValidator() {
+ return new VCloudPartitionValidator();
+ }
+
+ @Override
+ public String createVolume(int sizeGB, String snapshotId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String attachVolume(String instanceId, String volumeId, String deviceName) {
+ IaasProvider iaasInfo = getIaasProvider();
+
+ if (StringUtils.isEmpty(volumeId)) {
+ log.error("Volume provided to attach can not be null");
+ }
+
+ if (StringUtils.isEmpty(instanceId)) {
+ log.error("Instance provided to attach can not be null");
+ }
+
+ URI instanceIdHref = null;
+ URI volumeIdHref = null;
+ try {
+ //the instanceId format is a bit silly for vCloud.
+ instanceIdHref = new URI("https:/" + instanceId);
+ } catch (URISyntaxException e) {
+ log.error("Failed to attach volume, because the instance id cannot be converted into a url by concatenating "
+ + "'https:/' with " + instanceId + ". Full stacktrace: " + e.toString());
+ return null;
+ }
+ try {
+ volumeIdHref = new URI(volumeId);
+ } catch (URISyntaxException e) {
+ log.error("Failed to attach voluume, because the volume id '" + volumeId + "' is not a valid href (URI))"
+ + e.toString());
+ }
+
+ //get 'native' version of jclouds' vCloud API.
+ ComputeServiceContext context = iaasInfo.getComputeService()
+ .getContext();
+
+ VCloudApi api = context.unwrapApi(VCloudApi.class);
+
+ //Disks need to be attached to individual VMs, not vApps. The instanceId is the VApp.
+ VAppApi vAppApi = api.getVAppApi();
+ Set<Vm> vmsInVapp = vAppApi.getVApp(instanceIdHref).getChildren();
+ //Each vApp today has just 1 VM in it. Validate assumption.
+ assert (vmsInVapp.size() == 1);
+ Vm vm = vmsInVapp.iterator().next();
+ URI vmHref = vm.getHref();
+ VmApi vmApi = api.getVmApi();
+
+ // invest
+ /*
+ VCloudHardDisk.Builder hardDiskBuilder = new VCloudHardDisk.Builder();
+ VCloudHardDisk hardDisk = hardDiskBuilder.instanceID(volumeId).build();
+ VCloudVirtualHardwareSection vvhs = vm.getVirtualHardwareSection();
+ VCloudHardDisk.Builder Vchd = new VCloudHardDisk.Builder();
+ vvhs.toBuilder().item(Vchd.capacity(3).instanceID("hgfhgf").build()).build();
+ VApp va = vAppApi.getVApp(instanceIdHref);
+
+ */ //EO invest
+ DiskAttachOrDetachParams params = new DiskAttachOrDetachParams(volumeIdHref);
+ Task t = vmApi.attachDisk(vmHref, params);
+
+ log.info(String.format("Volume [id]: %s attachment for instance [id]: %s was successful [status]: Attaching. Iaas : %s, Task: %s", volumeId, instanceId, iaasInfo, t));
+ return "Attaching";
+ }
+
+ @Override
+ public void detachVolume(String instanceId, String volumeId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteVolume(String volumeId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getIaasDevice(String device) {
+ return device;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/vcloud/VCloudPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/vcloud/VCloudPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/vcloud/VCloudPartitionValidator.java
new file mode 100644
index 0000000..5a19741
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/vcloud/VCloudPartitionValidator.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.cloud.controller.iaases.vcloud;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.domain.IaasProvider;
+import org.apache.stratos.cloud.controller.domain.Partition;
+import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
+import org.apache.stratos.cloud.controller.iaases.Iaas;
+import org.apache.stratos.cloud.controller.iaases.PartitionValidator;
+
+import java.util.Properties;
+
+
+/**
+ * The VCloud {@link org.apache.stratos.cloud.controller.iaases.PartitionValidator} implementation.
+ */
+public class VCloudPartitionValidator implements PartitionValidator {
+
+ @SuppressWarnings("unused")
+ private static final Log log = LogFactory.getLog(VCloudPartitionValidator.class);
+ private IaasProvider iaasProvider;
+ @SuppressWarnings("unused")
+ private Iaas iaas;
+
+ @Override
+ public IaasProvider validate(Partition partition, Properties properties) throws InvalidPartitionException {
+ //TODO: implement real validation logic
+ return iaasProvider;
+
+ }
+
+ @Override
+ public void setIaasProvider(IaasProvider iaas) {
+ this.iaasProvider = iaas;
+ this.iaas = iaas.getIaas();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ComputeServiceBuilderUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ComputeServiceBuilderUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ComputeServiceBuilderUtil.java
index 19098cf..ee9d57b 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ComputeServiceBuilderUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ComputeServiceBuilderUtil.java
@@ -92,7 +92,7 @@ public class ComputeServiceBuilderUtil {
// try to find region
if ((region = iaas.getProperty(CloudControllerConstants.REGION_PROPERTY)) == null) {
// if the property, isn't specified, try to obtain from the image id
- // image id can be in following format - {REGION}/{UUID}
+ // image id can be in following format - {region}/{UUID}
region = (iaas.getImage() != null) && (iaas.getImage().contains("/"))
? iaas.getImage().split("/")[0] : null;
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Scope.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Scope.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Scope.java
deleted file mode 100644
index 984494e..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Scope.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.stratos.cloud.controller.util;
-
-/**
- * represents the scope of each partition which can be configured in stratos.
- */
-public enum Scope {
- PROVIDER, REGION, ZONE, HOST
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-1.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-1.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-1.xml
index 24445d8..2d31871 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-1.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-1.xml
@@ -33,7 +33,7 @@
<deployment baseDir="xyz">
<dir>abc</dir>
</deployment>
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-2.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-2.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-2.xml
index 2d7386f..ac89e87 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-2.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-2.xml
@@ -26,7 +26,7 @@
specified under iaasProvider child elements of cartridge element. -->
<property name="ss" value="slsls"/>
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-4.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-4.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-4.xml
index bc78906..496e373 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-4.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-4.xml
@@ -28,7 +28,7 @@
<!-- cartridge element can have 0..n properties, and they'll be overwritten by the properties
specified under iaasProvider child elements of cartridge element. -->
<property name="ss" value="slsls"/>
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-5.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-5.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-5.xml
index b4a3ee7..65dadaa 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-5.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-5.xml
@@ -26,7 +26,7 @@
<!-- You can have 1..n cartridge elements. -->
<cartridge type="php">
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-6.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-6.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-6.xml
index 37c9b9d..6f42c4e 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-6.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-6.xml
@@ -26,7 +26,7 @@
<!-- You can have 1..n cartridge elements. -->
<cartridge type="php">
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-7.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-7.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-7.xml
index 214e68f..993e3cd 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-7.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-7.xml
@@ -27,7 +27,7 @@
<cartridge type="php" version="5.1">
<!-- Display name of this cartridge -->
<displayName>PHP</displayName>
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
@@ -47,7 +47,7 @@
<cartridge type="php" version="5.1">
<!-- Display name of this cartridge -->
<displayName>PHP</displayName>
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-8.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-8.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-8.xml
index e0aa4d9..1bc3cd4 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-8.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-8.xml
@@ -28,7 +28,7 @@
specified under iaasProvider child elements of cartridge element. -->
<property name="ss" value="slsls"/>
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
@@ -85,7 +85,7 @@
specified under iaasProvider child elements of cartridge element. -->
<property name="ss" value="slsls"/>
-<!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+<!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-9.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-9.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-9.xml
index 5f42a36..9d2070d 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-9.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cartridges-9.xml
@@ -33,7 +33,7 @@
<deployment baseDir="xyz">
<dir>abc</dir>
</deployment>
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
@@ -66,7 +66,7 @@
<deployment baseDir="xyz">
<dir>abc</dir>
</deployment>
- <!-- A cartridge element should add a reference to an existing IaaS PROVIDER (specified
+ <!-- A cartridge element should add a reference to an existing IaaS provider (specified
in the above <iaasProviders> section) or it can create a completely new IaaS
Provider (which should have a unique "type" attribute. -->
<iaasProvider type="openstack">
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml
index 8305ad9..677b020 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml
@@ -49,7 +49,7 @@
is not necessary [0..1]. But you can use this section to avoid specifying
same property over and over again. -->
<iaasProviders>
- <!--<iaasProvider type="ec2" name="EC2 specific details"> <PROVIDER>aws-ec2</PROVIDER>
+ <!--<iaasProvider type="ec2" name="EC2 specific details"> <provider>aws-ec2</provider>
<identity svns:secretAlias="elastic.scaler.ec2.identity">cdcd</identity>
<credential svns:secretAlias="elastic.scaler.ec2.credential">cdccdc</credential>
<scaleUpOrder>2</scaleUpOrder> <scaleDownOrder>1</scaleDownOrder> <property
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer1.conf
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer1.conf b/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer1.conf
index 11c2a92..8bdced5 100755
--- a/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer1.conf
+++ b/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer1.conf
@@ -106,7 +106,7 @@ loadbalancer {
# Rewrite location header
# If this property is set to true, load balancer will rewrite HTTP Location header values found in response
- # messages if the HOST is set to an ip address of a known member. The resulting Location header HOST will be
+ # messages if the host is set to an ip address of a known member. The resulting Location header host will be
# set to corresponding cluster hostname and the port will be set to corresponding transport proxy port.
rewrite-location-header: true;
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer2.conf
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer2.conf b/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer2.conf
index 5680eca..5d4e950 100755
--- a/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer2.conf
+++ b/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer2.conf
@@ -106,7 +106,7 @@ loadbalancer {
# Rewrite location header
# If this property is set to true, load balancer will rewrite HTTP Location header values found in response
- # messages if the HOST is set to an ip address of a known member. The resulting Location header HOST will be
+ # messages if the host is set to an ip address of a known member. The resulting Location header host will be
# set to corresponding cluster hostname and the port will be set to corresponding transport proxy port.
rewrite-location-header: false;
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer3.conf
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer3.conf b/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer3.conf
index a82397d..2f723e8 100755
--- a/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer3.conf
+++ b/components/org.apache.stratos.load.balancer/src/test/resources/sample/configuration/loadbalancer3.conf
@@ -106,7 +106,7 @@ loadbalancer {
# Rewrite location header
# If this property is set to true, load balancer will rewrite HTTP Location header values found in response
- # messages if the HOST is set to an ip address of a known member. The resulting Location header HOST will be
+ # messages if the host is set to an ip address of a known member. The resulting Location header host will be
# set to corresponding cluster hostname and the port will be set to corresponding transport proxy port.
rewrite-location-header: true;
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.manager/src/scripts/append_zone_file.sh
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/scripts/append_zone_file.sh b/components/org.apache.stratos.manager/src/scripts/append_zone_file.sh
index aff5ee1..007cc58 100644
--- a/components/org.apache.stratos.manager/src/scripts/append_zone_file.sh
+++ b/components/org.apache.stratos.manager/src/scripts/append_zone_file.sh
@@ -24,7 +24,7 @@ appending_file=$3
subdomain=$1
ip=$2
-#appending the ZONE file
+#appending the zone file
echo $subdomain'\t'IN'\t'A'\t'$ip>> $appending_file
#increasing the count
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Scope.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Scope.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Scope.java
new file mode 100644
index 0000000..4c228b3
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Scope.java
@@ -0,0 +1,26 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.apache.stratos.messaging.domain.topology;
+
+/**
+ * represents the scope of each partition which can be configured in stratos.
+ */
+public enum Scope {
+ provider, region, zone, host
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml b/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml
index 707e241..b9f2eb6 100644
--- a/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml
+++ b/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml
@@ -73,7 +73,7 @@
<!--POJO deployer , this will alow users to drop .class file and make that into a service-->
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
- <!-- Following parameter will set the HOST name for the epr-->
+ <!-- Following parameter will set the host name for the epr-->
<!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
<!-- ================================================= -->
@@ -159,7 +159,7 @@
<transportReceiver name="http"
class="org.apache.axis2.transport.http.SimpleHTTPServer">
<parameter name="port">6071</parameter>
- <!--If you want to give your own HOST address for EPR generation-->
+ <!--If you want to give your own host address for EPR generation-->
<!--uncomment following parameter , and set as you required.-->
<!--<parameter name="hostname">http://myApp.com/ws</parameter>-->
</transportReceiver>
@@ -168,7 +168,7 @@
<!--<transportReceiver name="tcp"
class="org.apache.axis2.transport.tcp.TCPServer">
<parameter name="port">6061</parameter>-->
- <!--If you want to give your own HOST address for EPR generation-->
+ <!--If you want to give your own host address for EPR generation-->
<!--uncomment following parameter , and set as you required.-->
<!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
<!--</transportReceiver>-->
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/THttpClient.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/THttpClient.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/THttpClient.py
index 5288bf7..9ef9535 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/THttpClient.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/THttpClient.py
@@ -34,14 +34,14 @@ class THttpClient(TTransportBase):
def __init__(self, uri_or_host, port=None, path=None):
"""THttpClient supports two different types constructor parameters.
- THttpClient(HOST, port, path) - deprecated
+ THttpClient(host, port, path) - deprecated
THttpClient(uri)
Only the second supports https.
"""
if port is not None:
warnings.warn(
- "Please use the THttpClient('http://HOST:port/path') syntax",
+ "Please use the THttpClient('http://host:port/path') syntax",
DeprecationWarning,
stacklevel=2)
self.host = uri_or_host
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py
index 9166a0a..df35be4 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSSLSocket.py
@@ -152,7 +152,7 @@ class TSSLSocket(TSocket.TSocket):
raise TTransportException(
type=TTransportException.UNKNOWN,
message='Could not validate SSL certificate from '
- 'HOST "%s". Cert=%s' % (self.host, cert))
+ 'host "%s". Cert=%s' % (self.host, cert))
class TSSLServerSocket(TSocket.TServerSocket):
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSocket.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSocket.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSocket.py
index 1a7d2af..9e2b384 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSocket.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/thrift/transport/TSocket.py
@@ -50,10 +50,10 @@ class TSocket(TSocketBase):
def __init__(self, host='localhost', port=9090, unix_socket=None):
"""Initialize a TSocket
- @param host(str) The HOST to connect to.
+ @param host(str) The host to connect to.
@param port(int) The (TCP) port to connect to.
@param unix_socket(str) The filename of a unix socket to connect to.
- (HOST and port will be ignored.)
+ (host and port will be ignored.)
"""
self.host = host
self.port = port
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index afd40d6..148a3e6 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -418,8 +418,8 @@ public class StratosApiV41Utils {
throw new RestAPIException(errorMsg, axisFault);
} catch (RemoteException e) {
String errorMsg =
- String.format("Error while getting cartridge information for [provider] %s, [cause] %s ",
- provider, e.getMessage());
+ String.format("Error while getting cartridge information for provider %s Cause: %s ", provider,
+ e.getMessage());
log.error(errorMsg, e);
throw new RestAPIException(errorMsg, e);
}