Make it possible to disable linked clones

This commit adds a new configuration parameter to allow setting whether to create linked clones on a global, or per pool basis. Without this change vmpooler would always attempt to create linked clones. The default behavior of creating linked clones is preserved.
This commit is contained in:
kirby@puppetlabs.com 2019-08-06 13:48:43 -07:00
parent d319643123
commit 09a382a10f
7 changed files with 58 additions and 2 deletions

View file

@ -312,7 +312,7 @@ module Vmpooler
# Put the VM in the specified folder and resource pool
relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(
datastore: find_datastore(target_datastore, connection, target_datacenter_name),
diskMoveType: :moveChildMostDiskBacking
diskMoveType: get_disk_backing(pool)
)
manage_host_selection = @config[:config]['manage_host_selection'] if @config[:config].key?('manage_host_selection')
@ -1028,6 +1028,17 @@ module Vmpooler
return false if template[-1] == '/'
return true
end
def get_disk_backing(pool)
return :moveChildMostDiskBacking if linked_clone?(pool)
return :moveAllDiskBackingsAndConsolidate
end
def linked_clone?(pool)
return if pool[:create_linked_clone] == false
return true if pool[:create_linked_clone]
return true if @config[:config]['create_linked_clones']
end
end
end
end