1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-02 09:47:00 +03:00

F #6099: Implement non-shared vm skipping for ft/host_error.rb (#2583)

This commit is contained in:
Neal 2023-04-21 02:45:52 -06:00 committed by GitHub
parent 16035a1145
commit 20c70e4985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,7 @@ end
mode = nil # **must** be set to something other than nil using the options
force = false # By default, don't recreate/delete suspended and poweroff VMs
repeat = 2 # By default, wait for 2 monitorization cycles
repeat = 2 # By default, wait for 2 monitorization cycles
fencing = true
opts = GetoptLong.new(
@ -248,6 +248,13 @@ if OpenNebula.is_error?(rc)
exit_error "Could not get vm pool"
end
ds_pool = OpenNebula::DatastorePool.new(client)
rc = ds_pool.info_all
if OpenNebula.is_error?(rc)
exit_error "Could not get datastore pool"
end
# STATE=3: ACTIVE (LCM unknown)
# STATE=5: SUSPENDED
# STATE=8: POWEROFF
@ -283,6 +290,21 @@ if vm_ids_array
log "delete #{vm_id}"
vm.delete
when :migrate
begin
vm_ds_id = vm.retrieve_elements('/VM/HISTORY_RECORDS/HISTORY[last()]/DS_ID')[0]
ds_xpath = "/DATASTORE_POOL/DATASTORE[ID=\"#{vm_ds_id}\"]/TEMPLATE/SHARED"
is_shared = ds_pool.retrieve_elements(ds_xpath)[0]
if is_shared.upcase == "NO"
log "Skipping VM #{vm_id} deployed on non-shared datastore"
next
end
rescue
log_error "Could not get Datastore ID or SHARED attribute for VM #{vm_id}"
next
end
log "resched #{vm_id}"
vm.resched
else