1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Fix issue when creating virtual machines with more than 7 disks

This commit is contained in:
Francois Herbert 2015-10-23 10:52:58 +13:00
parent c097faecc9
commit 5d99225b59

View file

@ -122,18 +122,23 @@ module Fog
end end
def create_disk disk, index = 0, operation = :add, controller_key = 1000 def create_disk disk, index = 0, operation = :add, controller_key = 1000
if (index > 6) then
_index = index + 1
else
_index = index
end
payload = { payload = {
:operation => operation, :operation => operation,
:fileOperation => operation == :add ? :create : :destroy, :fileOperation => operation == :add ? :create : :destroy,
:device => RbVmomi::VIM.VirtualDisk( :device => RbVmomi::VIM.VirtualDisk(
:key => disk.key || index, :key => disk.key || _index,
:backing => RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo( :backing => RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo(
:fileName => "[#{disk.datastore}]", :fileName => "[#{disk.datastore}]",
:diskMode => disk.mode.to_sym, :diskMode => disk.mode.to_sym,
:thinProvisioned => disk.thin :thinProvisioned => disk.thin
), ),
:controllerKey => controller_key, :controllerKey => controller_key,
:unitNumber => index, :unitNumber => _index,
:capacityInKB => disk.size :capacityInKB => disk.size
) )
} }