> + this.diskMode = diskMode;
> + this.isBootDisk = isBootDisk;
> + this.diskSizeGb = diskSizeGb;
> + }
> +
> + public AutoCreateDiskOptions(final AttachDisk.Type diskType, final
> AttachDisk.Mode diskMode, final boolean isBootDisk, final int diskSizeGb,
> final String diskName) {
> + this(diskType, diskMode, isBootDisk, diskSizeGb);
> + // TODO: Validate against regex according to GCE spec.
> + this.diskName = diskName;
> + }
> +
> + public String getDiskName(final String nodeName) {
> + if (null != diskName)
> + return diskName;
> + else
> + return "jclouds-" + UUID.randomUUID().toString();
I think the right approach there, if the name needs to match a given GCE
convention is to use the same approach than used with the firewalls. Let's
create a naming convention [like the one used for
firewalls](https://github.com/jclouds/jclouds-labs-google/blob/master/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java)
and [inject it in the compute service
adapter](https://github.com/jclouds/jclouds-labs-google/blob/master/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java#L91).
Then, change the disk name option to be an `Optional`, and let the compute
service adapter generate the name using the convention. The created convention
class itself can get the optional as a parameter and generate an appropriate
name.
Note that the firewall naming convention already delegates to the jclouds
default GroupNamingConvention to generate the prefix. That will already take
into account the properties that rule the naming of the resources jclouds
creates.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/135/files#r28309276