andreaturli commented on this pull request.


> +      this.instanceSuspendedPredicate = instanceSuspendedPredicate;
+      this.regionIds = regionIds;
+      this.cleanupResources = cleanupResources;
+   }
+
+   @Override
+   public NodeAndInitialCredentials<Instance> 
createNodeWithGroupEncodedIntoName(String group, String name, Template 
template) {
+      String instanceType = template.getHardware().getId();
+      String regionId = template.getLocation().getId();
+      String imageId = template.getImage().getId();
+
+      ECSServiceTemplateOptions templateOptions = 
template.getOptions().as(ECSServiceTemplateOptions.class);
+
+      String keyPairName = templateOptions.getKeyPairName();
+      String securityGroupId = 
Iterables.getOnlyElement(templateOptions.getGroups());
+      String vSwitchId = templateOptions.getVSwitchId();

@nacx that's a fair point, but I think the best we can do is to `checkNotNull` 
vSwitchId.
In fact, the automatic creation of a vSwitch requires the creation of a VPC as 
well, which could be handled as VPC api and vSwitch api are quite 
straightforward *but* which require a number of details: ZoneId, CidrBlock, 
VpcId and RegionId of course.

Those details are *not* related to the `Template` IMHO but are related to the 
environment where you want to deploy the VM, so passing the vswitch details in 
the templateOptions doesn't seem right to me.
Conversely, making a lot of assumptions on behalf of the user to create a 
reasonably sensible `vSwitch` sounds unreliable and potentially not satisfying 
for the end-user anyway.

Notice also that a fresh aliyun account comes with no VPC or vSwitch at all so 
there's no default value to be used here, unfortunately.

wdyt?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/443#discussion_r207111616

Reply via email to