1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-29 18:50:08 +03:00

feature #4012: support selecting vcenter customization

A new parameter CUSTOMIZATION_SPEC can be added to a vcenter template
so this customization is used on VM clone.
This commit is contained in:
Javi Fontan 2015-09-30 15:57:07 +02:00
parent 5f9f7f2913
commit e8241f8de8

View File

@ -1340,10 +1340,33 @@ private
:diskMoveType => :moveChildMostDiskBacking,
:pool => connection.resource_pool)
clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(
:location => relocate_spec,
:powerOn => false,
:template => false)
clone_parameters = {
:location => relocate_spec,
:powerOn => false,
:template => false
}
customization = template.elements["CUSTOMIZATION_SPEC"]
vim = connection.vim
if !customization.nil?
begin
custom_spec = vim.serviceContent.customizationSpecManager.
GetCustomizationSpec(:name => customization.text)
if custom_spec && spec=custom_spec.spec
clone_parameters[:customization] = spec
else
raise "Error getting customization spec"
end
rescue
raise "Customization spec '#{customization.text}' not found"
end
end
clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(clone_parameters)
begin
vm = vc_template.CloneVM_Task(