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

Feature #3305: Make extraConfig persistent in vmx

Also, context for vCenter in plain text instead of XML

(cherry picked from commit 2ff16e74284f31cd293072e483d54cbfeeea708d)

Conflicts:
	src/vmm_mad/remotes/vcenter/vcenter_driver.rb
This commit is contained in:
Tino Vazquez 2014-11-18 17:37:51 +01:00
parent 20500b6c99
commit cf0c889a52

View File

@ -784,15 +784,15 @@ private
clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(
:location => relocate_spec,
:powerOn => true,
:powerOn => false,
:template => false)
rc = vc_template.CloneVM_Task(
vm = vc_template.CloneVM_Task(
:folder => vc_template.parent,
:name => "one-#{vmid}",
:spec => clone_spec).wait_for_completion
vm_uuid = rc.config.uuid
vm_uuid = vm.config.uuid
vnc_port = xml.root.elements["/VM/TEMPLATE/GRAPHICS/PORT"]
vnc_listen = xml.root.elements["/VM/TEMPLATE/GRAPHICS/LISTEN"]
@ -814,18 +814,25 @@ private
if context
# Remove <CONTEXT> (9) and </CONTEXT>\n (11)
context_text = Base64.encode64(context.to_s[9..-11])
config_array +=
[{:key=>"guestinfo.opennebula.context",
context_text = ""
context.elements.each{|context_element|
context_text += context_element.name + "=" +
context_element.text + "\n"
}
context_text = Base64.encode64(context_text.chop)
config_array +=
[{:key=>"guestinfo.opennebula.context",
:value=>context_text}]
end
if config_array != []
spec_hash = {:extraConfig =>config_array}
spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)
rc.ReconfigVM_Task(:spec => spec).wait_for_completion
vm.ReconfigVM_Task(:spec => spec).wait_for_completion
end
vm.PowerOnVM_Task.wait_for_completion
return vm_uuid
end
end