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

M #-: Fix ec2_driver vms monitoring

Avoid reusing global `vm` var in threads.

(cherry picked from commit f4bac81b8a7e07ed2c40e28de354c06cb0f44a58)
This commit is contained in:
Jan Orel 2020-06-16 12:17:51 +02:00 committed by Tino Vazquez
parent c4d65dcd2f
commit 46282d8e71
No known key found for this signature in database
GPG Key ID: 2FE9C32E94AEABBE

View File

@ -718,7 +718,6 @@ class EC2Driver
# rubocop:disable Layout/LineLength
vpool = OpenNebula::VirtualMachinePool.new(OpenNebula::Client.new,
OpenNebula::VirtualMachinePool::INFO_ALL_VM)
# rubocop:enable Layout/LineLength
vpool.info
vpool.each do |vm|
@ -728,16 +727,17 @@ class EC2Driver
@ec2.instances.each {|i| work_q.push i }
else
# The same but just for a single VM
vm = OpenNebula::VirtualMachine.new_with_id(deploy_id,
OpenNebula::Client.new)
vm.info
onevm_info[deploy_id] = vm
one_vm = OpenNebula::VirtualMachine.new_with_id(deploy_id,
OpenNebula::Client.new)
one_vm.info
onevm_info[deploy_id] = one_vm
work_q.push get_instance(deploy_id)
# rubocop:enable Layout/LineLength
end
vms = []
workers = (0...20).map do
workers = (0...[work_q.length, 20].min).map do
Thread.new do
begin
while (i = work_q.pop(true))