When provisioning a VMWare Template via “Create host” function I add a additional disk specifying the datastore etc; the template clone fails with the below message:
2018-06-21T11:35:47 e773dee3 [app] [W] Failed to create a compute #### instance dewey-scatton: InvalidDeviceSpec: Invalid configuration for device '3'.
I work with Luka and we have tracked the issue down to the change to the create_disk method in requests/compute/create_vm.rb. The change removes the ability to set the unit_number in the call to create_disk and instead relies upon a method in models/compute/volume.rb to automagically set the id based on the server object. This ends up with the new disk getting the unit_number of 0 as all the disks that are in the template at the time the code does this have the unit_number set as nil. This then ends up with the new disk conflicting with the templates disks.
We’ve worked around it with a one liner that adds a unit_number based on the index (as it was previously in fog-vsphere < 1.7.0) before calling create_disk.
Basically by adding: new_volumes.map { |volume| volume.unit_number = volumes.index(volume) }
Just before: specs.concat(new_volumes.map { |volume| create_disk(volume) })
in the function: modify_template_volumes_specs
in the file: fog-vsphere-2.2.0/lib/fog/vsphere/requests/compute/create_vm.rb
I can work on getting this patched into fog-vsphere if you like or if you wanted to submit a PR I can test and merge, whatever works for you, I would want you to take credit for the find