Add thin provisioned disks during VM Customization


#1

Hello,

I’m using automate with a service dialog to allow users to provision new VMs. One of the dialog options lets users add additional disks, however I can’t figure out how to force these to be thin provisioned (vmware) within automate.

I’m adding the disks in the ‘VM / Provisioning / StateMachines / Methods / vmware_CustomizeRequest’ method by passing an array:

data_disks << {
  :bus      => scsi_bus,
  :pos      => i+1,
  :sizeInMB => disk_size,
}

into the provisioning object:

prov.set_option(:disk_scsi, data_disks) unless data_disks.blank?

I’ve tried setting the default on the dialog to thin, and I’ve verified this is set by debugging with object_walker:

 |    $evm.root['miq_provision'] => #<MiqAeMethodService::MiqAeServiceManageIQ_Providers_Vmware_InfraManager_Provision:0x0000000015509b40>
...
 |    |    $evm.root['miq_provision'].options[:disk_format] = ["thin", "Thin"]   (type: Array)
 |    |    $evm.root['miq_provision'].options[:disk_scsi] = [{:bus=>0, :pos=>2, :sizeInMB=>10240}]   (type: Array)
...

But the additional disks are always provisioned thick.

Does anybody know a way to set the provisioning type of disks added in this way? Or is there another way to add disks during the provisioning workflow? Ideally, I’d like quotas and approval to still work.


#2

we do this in a post method

vm.add_disk("[#{dsname}]", tmpsize * 1024, dependent: true , thin_provisioned: true , sync: true)

I think just adding :thinProvisioned=> true to your hash is all you need


#3

I tried adding :thinProvisioned=> true, however it doesn’t look like whatever consumes the hash uses it because disks were still thick provisioned.

Do you take quotas / approvals into account when you use the vm.add_disk method?