1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-25 06:03:36 +03:00

VMM now sends only one action per host at the same time

This commit is contained in:
Javi Fontan 2010-08-31 18:36:39 +02:00
parent 93e8a6bea4
commit 4bc49760cf

View File

@ -59,12 +59,16 @@ class VirtualMachineDriver < OpenNebulaDriver
:deleted => 'd',
:unknown => '-'
}
HOST_ARG = 2
# -------------------------------------------------------------------------
# Register default actions for the protocol
# -------------------------------------------------------------------------
def initialize(concurrency=10, threaded=true)
super(concurrency,threaded)
@hosts = Array.new
register_action(ACTION[:deploy].to_sym, method("deploy"))
register_action(ACTION[:shutdown].to_sym, method("shutdown"))
@ -152,6 +156,28 @@ class VirtualMachineDriver < OpenNebulaDriver
error = "Action not implemented by driver #{self.class}"
send_message(ACTION[:poll],RESULT[:failure],id,error)
end
private
def delete_running_action(action_id)
action=@action_running[action_id]
if action
@hosts.delete(action[:args][HOST_ARG])
@action_running.delete(action_id)
end
end
def get_runable_action
action=@action_queue.select do |a|
@hosts.include? a[:args][HOST_ARG]
end.first
if action
@hosts << action[:args][HOST_ARG]
@action_queue.delete(action)
end
return action
end
end
if __FILE__ == $0