From 8542632a67d82c5fe7fea6152516eb16fa5aff47 Mon Sep 17 00:00:00 2001 From: Eric Stonfer Date: Tue, 17 Jan 2012 13:52:49 -0500 Subject: [PATCH] whitespace fix --- lib/fog/vsphere/requests/compute/vm_clone.rb | 52 ++++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/lib/fog/vsphere/requests/compute/vm_clone.rb b/lib/fog/vsphere/requests/compute/vm_clone.rb index a60e9046d..a9d313652 100644 --- a/lib/fog/vsphere/requests/compute/vm_clone.rb +++ b/lib/fog/vsphere/requests/compute/vm_clone.rb @@ -70,47 +70,45 @@ module Fog esx_host = vm_mob_ref.collect!('runtime.host')['runtime.host'] # The parent of the ESX host itself is a ComputeResource which has a resourcePool resource_pool = esx_host.parent.resourcePool - relocation_spec=nil + relocation_spec=nil if ( options['linked_clone'] ) - # cribbed heavily from the rbvmomi clone_vm.rb - # this chunk of code reconfigures the disk of the clone source to be read only, - # and then creates a delta disk on top of that, this is required by the API in order to create - # linked clondes - disks=vm_mob_ref.config.hardware.device.select{|vm_device| vm_device.class == RbVmomi::VIM::VirtualDisk} - disks.select{|vm_device| vm_device.backing.parent == nil}.each do |disk| - disk_spec = { - :deviceChange => [ - { - :operation => :remove, - :device => disk - }, - { - :operation => :add, - :fileOperation => :create, - :device => disk.dup.tap{|disk_backing| - disk_backing.backing = disk_backing.backing.dup; - disk_backing.backing.fileName = "[#{disk.backing.datastore.name}]"; - disk_backing.backing.parent = disk.backing - } + # cribbed heavily from the rbvmomi clone_vm.rb + # this chunk of code reconfigures the disk of the clone source to be read only, + # and then creates a delta disk on top of that, this is required by the API in order to create + # linked clondes + disks=vm_mob_ref.config.hardware.device.select{|vm_device| vm_device.class == RbVmomi::VIM::VirtualDisk} + disks.select{|vm_device| vm_device.backing.parent == nil}.each do |disk| + disk_spec = { + :deviceChange => [ + { + :operation => :remove, + :device => disk }, - ] + { + :operation => :add, + :fileOperation => :create, + :device => disk.dup.tap{|disk_backing| + disk_backing.backing = disk_backing.backing.dup; + disk_backing.backing.fileName = "[#{disk.backing.datastore.name}]"; + disk_backing.backing.parent = disk.backing + } + }, + ] } - vm_mob_ref.ReconfigVM_Task(:spec => disk_spec).wait_for_completion + vm_mob_ref.ReconfigVM_Task(:spec => disk_spec).wait_for_completion end # Next, create a Relocation Spec instance relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool, - :diskMoveType => :moveChildMostDiskBacking) - + :diskMoveType => :moveChildMostDiskBacking) else relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool, - :transform => options['transform'] || 'sparse') + :transform => options['transform'] || 'sparse') end # And the clone specification clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(:location => relocation_spec, :powerOn => options['power_on'] || true, :template => false) task = vm_mob_ref.CloneVM_Task(:folder => vm_mob_ref.parent, :name => options['name'], :spec => clone_spec) - # Waiting for the VM to complete allows us to get the VirtulMachine # object of the new machine when it's done. It is HIGHLY recommended # to set 'wait' => true if your app wants to wait. Otherwise, you're