B #2526: improvement in vCenter VM monitoring

Do not fail if VM does not have DS associated
This commit is contained in:
Tino Vazquez committed 2018-10-22 19:22:19 +02:00
1 parent 1a68b64575
commit a6513528df
2 files changed
+7 -5

No files matched your search

@@ -509,8 +509,9 @@ class ClusterComputeResource
str_info << "POLL=\"#{vm.info.gsub('"', "\\\"")}\"]"
rescue Exception => e
STDERR.puts e.inspect
STDERR.puts e.backtrace
tmp_str = e.inspect
tmp_str << e.backtrace.join("\n")
str_info << "ERROR=\"#{Base64.encode64(tmp_str).gsub("\n","")}\"]"
end
end
@@ -806,12 +806,13 @@ class Template
@state = 'POWEROFF' if @state == 'd'
str << "IMPORT_STATE =\"#{@state}\"\n"
# Get DS information
if !@vm_info["datastore"].last._ref.nil?
# Get DS information
if !@vm_info["datastore"].nil?
!@vm_info["datastore"].last.nil? &&
!@vm_info["datastore"].last._ref.nil?
str << "VCENTER_DS_REF = \"#{@vm_info["datastore"].last._ref}\"\n"
end
vnc_port = nil
keymap = VCenterDriver::VIHelper.get_default("VM/TEMPLATE/GRAPHICS/KEYMAP")