mirror of https://github.com/apache/jclouds.git
added VPC support to EC2 ComputeService
This commit is contained in:
parent
4bc6434234
commit
23179f03c1
|
@ -73,13 +73,19 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions {
|
||||||
"unexpected image type. should be EC2Size, was: " + template.getSize().getClass());
|
"unexpected image type. should be EC2Size, was: " + template.getSize().getClass());
|
||||||
EC2Size ec2Size = EC2Size.class.cast(template.getSize());
|
EC2Size ec2Size = EC2Size.class.cast(template.getSize());
|
||||||
|
|
||||||
|
RunInstancesOptions instanceOptions = asType(ec2Size.getInstanceType()).withAdditionalInfo(tag);
|
||||||
|
|
||||||
String keyPairName = createNewKeyPairUnlessUserSpecifiedOtherwise(region, tag, template
|
String keyPairName = createNewKeyPairUnlessUserSpecifiedOtherwise(region, tag, template
|
||||||
.getOptions());
|
.getOptions());
|
||||||
Set<String> groups = getSecurityGroupsForTagAndOptions(region, tag, template.getOptions());
|
|
||||||
|
|
||||||
RunInstancesOptions instanceOptions = asType(ec2Size.getInstanceType())//
|
String subnetId = template.getOptions().as(EC2TemplateOptions.class).getSubnetId();
|
||||||
.withSecurityGroups(groups)//
|
if(subnetId != null)
|
||||||
.withAdditionalInfo(tag);
|
instanceOptions.withSubnetId(subnetId);
|
||||||
|
|
||||||
|
else {
|
||||||
|
Set<String> groups = getSecurityGroupsForTagAndOptions(region, tag, template.getOptions());
|
||||||
|
instanceOptions.withSecurityGroups(groups);
|
||||||
|
}
|
||||||
|
|
||||||
if (keyPairName != null)
|
if (keyPairName != null)
|
||||||
instanceOptions.withKeyName(keyPairName);
|
instanceOptions.withKeyName(keyPairName);
|
||||||
|
|
Loading…
Reference in New Issue