mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Small refactor to have a self-contained deploy action in vCenter
This commit is contained in:
parent
ced1a29bfb
commit
56af55f57f
@ -736,9 +736,12 @@ class VCenterVm
|
||||
vm = connection.find_vm_template(deploy_id)
|
||||
|
||||
# Find out if we need to reconfigure capacity
|
||||
expected_cpu, expected_memory = get_cpu_and_memory(xml_text)
|
||||
current_cpu = vm.config.hardware.numCPU
|
||||
current_memory = vm.config.hardware.memoryMB
|
||||
xml = REXML::Document.new xml_text
|
||||
|
||||
expected_cpu = xml.root.elements["//TEMPLATE/CPU"].text
|
||||
expected_memory = xml.root.elements["//TEMPLATE/MEMORY"].text
|
||||
current_cpu = vm.config.hardware.numCPU
|
||||
current_memory = vm.config.hardware.memoryMB
|
||||
|
||||
if current_cpu != expected_cpu or current_memory != expected_memory
|
||||
capacity_hash = {:numCPUs => expected_cpu.to_i,
|
||||
@ -1250,15 +1253,6 @@ private
|
||||
}
|
||||
end
|
||||
|
||||
def self.get_cpu_and_memory(xml_text)
|
||||
xml = REXML::Document.new xml_text
|
||||
|
||||
cpu = xml.root.elements["//TEMPLATE/CPU"].text
|
||||
memory = xml.root.elements["//TEMPLATE/MEMORY"].text
|
||||
|
||||
return cpu, memory
|
||||
end
|
||||
|
||||
########################################################################
|
||||
# Clone a vCenter VM Template and leaves it powered on
|
||||
########################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user