Make VCPU attribute more robust

This commit is contained in:
Jaime Melis committed 2015-10-07 17:05:31 +02:00
1 parent 1d57922e43
commit 0490cf97b9
1 file changed
+2 -2
@@ -798,7 +798,7 @@ class VCenterVm
# Find out if we need to reconfigure capacity
xml = REXML::Document.new xml_text
expected_cpu = xml.root.elements["//TEMPLATE/VCPU"].text
expected_cpu = xml.root.elements["//TEMPLATE/VCPU"].text rescue xml.root.elements["//TEMPLATE/CPU"].text.to_f.ceil rescue 1
expected_memory = xml.root.elements["//TEMPLATE/MEMORY"].text
current_cpu = vm.config.hardware.numCPU
current_memory = vm.config.hardware.memoryMB
@@ -1510,7 +1510,7 @@ private
# Capacity section
cpu = xml.root.elements["//TEMPLATE/VCPU"].text
cpu = xml.root.elements["//TEMPLATE/VCPU"].text rescue xml.root.elements["//TEMPLATE/CPU"].text.to_f.ceil rescue 1
memory = xml.root.elements["//TEMPLATE/MEMORY"].text
capacity_spec = {:numCPUs => cpu.to_i,
:memoryMB => memory }