lib/fog/vsphere/requests/compute/create_vm.rb in fog-1.17.0 vs lib/fog/vsphere/requests/compute/create_vm.rb in fog-1.18.0
- old
+ new
@@ -90,24 +90,30 @@
)
}
end
def create_disk disk, index = 0, operation = :add, controller_key = 1000
- {
+ payload = {
:operation => operation,
- :fileOperation => :create,
+ :fileOperation => operation == :add ? :create : :destroy,
:device => RbVmomi::VIM.VirtualDisk(
- :key => index,
+ :key => disk.key || index,
:backing => RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo(
:fileName => "[#{disk.datastore}]",
:diskMode => disk.mode.to_sym,
:thinProvisioned => disk.thin
),
:controllerKey => controller_key,
:unitNumber => index,
:capacityInKB => disk.size
)
}
+
+ if operation == :add && disk.thin == false && disk.eager_zero
+ payload[:device][:backing][:eagerlyScrub] = disk.eager_zero
+ end
+
+ payload
end
def extra_config attributes
[
{