L #~: fix stop action in vCenter (#1963)

(cherry picked from commit d98d5ece07)
This commit is contained in:
Carlos J. Herrera authored and Tino Vazquez committed 2022-04-21 16:42:05 +02:00
1 parent ee02565cc4
commit dc62738737
2 files changed
+9 -1

No files matched your search

+6 -1
View File
@@ -68,6 +68,11 @@ begin
vm = OpenNebula::VirtualMachine.new_with_id(vmid, one_client)
vm.info
last_action = vm['HISTORY_RECORDS/HISTORY[last()]/ACTION']
last_action_str = OpenNebula::VirtualMachine.get_history_action(last_action)
exit 0 if last_action_str == "stop"
src_ds = vm.retrieve_elements('HISTORY_RECORDS/HISTORY/DS_ID')[-2]
if src_ds == dsid
@@ -78,7 +83,7 @@ begin
.migrate_routine(vmid, host_orig, host_dest, false, dsid)
end
rescue StandardError => e
message = "Cannot migrate for VM #{vmid}. "\
message = "Cannot move the VM #{vmid}. "\
'Failed due to '\
"\"#{e.message}\"\n"
OpenNebula.log_error(message)
@@ -3388,6 +3388,9 @@ end
pool.info
src_id = pool["/HOST_POOL/HOST[NAME='#{src_host}']/ID"].to_i
return if src_id == 0
dst_id = pool["/HOST_POOL/HOST[NAME='#{dst_host}']/ID"].to_i
# different destination ds