From 5d99225b59ae41255b9c9fbb377af8e60f3b66c9 Mon Sep 17 00:00:00 2001 From: Francois Herbert Date: Fri, 23 Oct 2015 10:52:58 +1300 Subject: [PATCH] Fix issue when creating virtual machines with more than 7 disks --- lib/fog/vsphere/requests/compute/create_vm.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/fog/vsphere/requests/compute/create_vm.rb b/lib/fog/vsphere/requests/compute/create_vm.rb index 72726bec7..84eb989ba 100644 --- a/lib/fog/vsphere/requests/compute/create_vm.rb +++ b/lib/fog/vsphere/requests/compute/create_vm.rb @@ -122,18 +122,23 @@ module Fog end def create_disk disk, index = 0, operation = :add, controller_key = 1000 + if (index > 6) then + _index = index + 1 + else + _index = index + end payload = { :operation => operation, :fileOperation => operation == :add ? :create : :destroy, :device => RbVmomi::VIM.VirtualDisk( - :key => disk.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, + :unitNumber => _index, :capacityInKB => disk.size ) }