1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

F #5289: Fix flow batch action (#1317)

This commit is contained in:
Pavel Czerný 2021-06-18 11:27:54 +02:00 committed by GitHub
parent 9375625793
commit 8f94dc7666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -570,9 +570,21 @@ module OpenNebula
vm_id = node['deploy_id']
vm = OpenNebula::VirtualMachine.new_with_id(vm_id,
@service.client)
if do_offset
offset = (index / vms_per_period.to_i).floor
time_offset = offset * period.to_i
end
tmp_str = "SCHED_ACTION = ["
tmp_str << "ACTION = #{action},"
tmp_str << "ARGS = \"#{args}\"," if args
tmp_str << "TIME = #{now + time_offset}]"
rc = vm.sched_action_add(tmp_str)
if OpenNebula.is_error?(rc)
msg = "Role #{name} : VM #{vm_id} monitorization failed;"\
" #{rc.message}"
msg = "Role #{name} : VM #{vm_id} error scheduling "\
"action; #{rc.message}"
error_msgs << msg
@ -580,29 +592,7 @@ module OpenNebula
@service.log_error(msg)
else
if do_offset
offset = (index / vms_per_period.to_i).floor
time_offset = offset * period.to_i
end
tmp_str = "SCHED_ACTION = ["
tmp_str << "ACTION = #{action},"
tmp_str << "ARGS = \"#{args}\"," if args
tmp_str << "TIME = #{now + time_offset}]"
rc = vm.sched_action_add(tmp_str)
if OpenNebula.is_error?(rc)
msg = "Role #{name} : VM #{vm_id} error scheduling "\
"action; #{rc.message}"
error_msgs << msg
Log.error LOG_COMP, msg, @service.id
@service.log_error(msg)
else
vms_id << vm.id
end
vms_id << vm.id
end
end