[
https://issues.apache.org/jira/browse/STRATOS-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13849089#comment-13849089
]
Nirmal Fernando commented on STRATOS-290:
-----------------------------------------
Here's the EC2 validation implementation.
public class AWSEC2PartitionValidator implements PartitionValidator {
private static final Log log =
LogFactory.getLog(AWSEC2PartitionValidator.class);
private IaasProvider iaasProvider;
private Iaas iaas;
@Override
public IaasProvider validate(String partitionId, 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 (iaasProvider.getImage() != null &&
!iaasProvider.getImage().contains(region)) {
String msg =
"Invalid Partition Detected : " + partitionId +
" - Cause: Invalid Region: " + region;
log.error(msg);
throw new InvalidPartitionException(msg);
}
iaas.isValidRegion(iaasProvider, region);
IaasProvider updatedIaasProvider = new
IaasProvider(iaasProvider);
Iaas updatedIaas = updatedIaasProvider.getIaas();
if (properties.containsKey(Scope.zone.toString())) {
String zone = properties.getProperty(Scope.zone.toString());
iaas.isValidZone(iaasProvider, region, zone);
updatedIaasProvider.setProperty(CloudControllerConstants.AVAILABILITY_ZONE,
zone);
updatedIaas.buildTemplate(updatedIaasProvider);
}
return updatedIaasProvider;
} else {
return iaasProvider;
}
} catch (Exception ex) {
String msg = "Invalid Partition Detected : "+partitionId;
log.error(msg, ex);
throw new InvalidPartitionException(msg, ex);
}
}
@Override
public void setIaasProvider(IaasProvider iaas) {
this.iaasProvider = iaas;
this.iaas = iaas.getIaas();
}
}
> Implement IaaS based Partition Validation
> -------------------------------------------
>
> Key: STRATOS-290
> URL: https://issues.apache.org/jira/browse/STRATOS-290
> Project: Stratos
> Issue Type: New Feature
> Components: Cloud Controller
> Affects Versions: 4.0.0 M4
> Reporter: Nirmal Fernando
> Assignee: Nirmal Fernando
> Priority: Critical
> Fix For: 4.0.0 M5
>
>
> Idea is to hand over to the respective IaaS the validation of a Partition.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)