mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #132: Support for reboot action in base drivers
This commit is contained in:
parent
7301def913
commit
0d21013029
@ -87,7 +87,7 @@ class OpenNebulaDriver < ActionManager
|
||||
:ssh_stream => nil
|
||||
}.merge(ops)
|
||||
|
||||
params = parameters+" #{id} #{host}"
|
||||
params = parameters + " #{id} #{host}"
|
||||
command = action_command_line(aname, params, options[:script_name])
|
||||
|
||||
if action_is_local?(aname)
|
||||
|
@ -36,6 +36,7 @@ class VirtualMachineDriver < OpenNebulaDriver
|
||||
ACTION = {
|
||||
:deploy => "DEPLOY",
|
||||
:shutdown => "SHUTDOWN",
|
||||
:reboot => "REBOOT"
|
||||
:cancel => "CANCEL",
|
||||
:save => "SAVE",
|
||||
:restore => "RESTORE",
|
||||
@ -80,6 +81,7 @@ class VirtualMachineDriver < OpenNebulaDriver
|
||||
|
||||
register_action(ACTION[:deploy].to_sym, method("deploy"))
|
||||
register_action(ACTION[:shutdown].to_sym, method("shutdown"))
|
||||
register_action(ACTION[:reboot].to_sym, method("reboot"))
|
||||
register_action(ACTION[:cancel].to_sym, method("cancel"))
|
||||
register_action(ACTION[:save].to_sym, method("save"))
|
||||
register_action(ACTION[:restore].to_sym, method("restore"))
|
||||
@ -119,6 +121,11 @@ class VirtualMachineDriver < OpenNebulaDriver
|
||||
send_message(ACTION[:shutdown],RESULT[:failure],id,error)
|
||||
end
|
||||
|
||||
def reboot(id, drv_message)
|
||||
error = "Action not implemented by driver #{self.class}"
|
||||
send_message(ACTION[:reboot],RESULT[:failure],id,error)
|
||||
end
|
||||
|
||||
def cancel(id, drv_message)
|
||||
error = "Action not implemented by driver #{self.class}"
|
||||
send_message(ACTION[:cancel],RESULT[:failure],id,error)
|
||||
|
@ -452,9 +452,18 @@ class ExecDriver < VirtualMachineDriver
|
||||
def poll(id, drv_message)
|
||||
data = decode(drv_message)
|
||||
host = data.elements['HOST'].text
|
||||
deploy_id = data.elements['DEPLOY_ID'].text
|
||||
|
||||
do_action("#{deploy_id} #{host}", id, host, ACTION[:poll])
|
||||
do_action("#{id} #{host}", id, host, ACTION[:poll])
|
||||
end
|
||||
|
||||
#
|
||||
# REBOOT action, reboots a running VM
|
||||
#
|
||||
def reboot(id, drv_message)
|
||||
data = decode(drv_message)
|
||||
host = data.elements['HOST'].text
|
||||
|
||||
do_action("#{id} #{host}", id, host, ACTION[:reboot])
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user