> +     @Override public NodeAndInitialCredentials<Instance> 
> createNodeWithGroupEncodedIntoName(String group, String name, Template 
> template) {
> +             GoogleComputeEngineTemplateOptions options = 
> GoogleComputeEngineTemplateOptions.class.cast(template.getOptions());
> +             checkNotNull(options.network(), "template options must specify 
> a network");
> +             checkNotNull(template.getHardware().getUri(), "hardware must 
> have a URI");
> +             checkNotNull(template.getImage().getUri(), "image URI is null");
> +
> +             List<AttachDisk> disks = Lists.newArrayList();
> +             disks.add(AttachDisk.newBootDisk(template.getImage().getUri()));
> +
> +             disks.addAll(options.getDisks());
> +             if (null != options.getAutoCreateDiskOptions()) {
> +                     AutoCreateDiskOptions diskOptions = 
> options.getAutoCreateDiskOptions();
> +                     checkArgument(template.getLocation().getScope() == 
> LocationScope.ZONE);
> +                     DiskApi diskApi = 
> api.disksInZone(template.getLocation().getId());
> +                     Operation op = 
> diskApi.create(diskOptions.getDiskName(name), new 
> DiskCreationOptions.Builder().sizeGb(diskOptions.diskSizeGb).build());
> +                     // TODO: Is there a way to avoid the op, and just 
> AttachDisk.create? where do we get the URI from? does it have to pre-exist?

I don't think there is a way to avoid the operation. You have to create the 
disk before attaching it.

https://cloud.google.com/compute/docs/instances#startinstanceapi

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/135/files#r28214283

Reply via email to