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

whitespace fix

This commit is contained in:
Eric Stonfer 2012-01-17 13:52:49 -05:00
parent 8e341ad831
commit 8542632a67

View file

@ -70,47 +70,45 @@ module Fog
esx_host = vm_mob_ref.collect!('runtime.host')['runtime.host'] esx_host = vm_mob_ref.collect!('runtime.host')['runtime.host']
# The parent of the ESX host itself is a ComputeResource which has a resourcePool # The parent of the ESX host itself is a ComputeResource which has a resourcePool
resource_pool = esx_host.parent.resourcePool resource_pool = esx_host.parent.resourcePool
relocation_spec=nil relocation_spec=nil
if ( options['linked_clone'] ) if ( options['linked_clone'] )
# cribbed heavily from the rbvmomi clone_vm.rb # cribbed heavily from the rbvmomi clone_vm.rb
# this chunk of code reconfigures the disk of the clone source to be read only, # 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 # and then creates a delta disk on top of that, this is required by the API in order to create
# linked clondes # linked clondes
disks=vm_mob_ref.config.hardware.device.select{|vm_device| vm_device.class == RbVmomi::VIM::VirtualDisk} 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| disks.select{|vm_device| vm_device.backing.parent == nil}.each do |disk|
disk_spec = { disk_spec = {
:deviceChange => [ :deviceChange => [
{ {
:operation => :remove, :operation => :remove,
:device => disk :device => disk
}, },
{ {
:operation => :add, :operation => :add,
:fileOperation => :create, :fileOperation => :create,
:device => disk.dup.tap{|disk_backing| :device => disk.dup.tap{|disk_backing|
disk_backing.backing = disk_backing.backing.dup; disk_backing.backing = disk_backing.backing.dup;
disk_backing.backing.fileName = "[#{disk.backing.datastore.name}]"; disk_backing.backing.fileName = "[#{disk.backing.datastore.name}]";
disk_backing.backing.parent = disk.backing 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 end
# Next, create a Relocation Spec instance # Next, create a Relocation Spec instance
relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool, relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool,
:diskMoveType => :moveChildMostDiskBacking) :diskMoveType => :moveChildMostDiskBacking)
else else
relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool, relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool,
:transform => options['transform'] || 'sparse') :transform => options['transform'] || 'sparse')
end end
# And the clone specification # And the clone specification
clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(:location => relocation_spec, clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(:location => relocation_spec,
:powerOn => options['power_on'] || true, :powerOn => options['power_on'] || true,
:template => false) :template => false)
task = vm_mob_ref.CloneVM_Task(:folder => vm_mob_ref.parent, :name => options['name'], :spec => clone_spec) 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 # 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 # 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 # to set 'wait' => true if your app wants to wait. Otherwise, you're