1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

feature #1797: changed reboot in the CLI and ruby oca

This commit is contained in:
Javi Fontan 2013-03-14 17:23:18 +01:00
parent de813d909c
commit 28dae143b5
3 changed files with 19 additions and 27 deletions

View File

@ -83,11 +83,17 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
}
LIVE = {
:name =>"live",
:name => "live",
:large => "--live",
:description => "Do the action with the VM running"
}
HARD = {
:name => "hard",
:large => "--hard",
:description=> "Does not communicate with the guest OS"
}
def self.rname
"VM"
end

View File

@ -332,33 +332,22 @@ cmd=CommandParser::CmdParser.new(ARGV) do
Reboots the given VM, this is equivalent to execute the reboot command
from the VM console.
The VM will be ungracefully rebooted if --hard is used.
States: RUNNING
EOT
command :reboot, reboot_desc, [:range,:vmid_list],
:options => [OneVMHelper::SCHEDULE] do
:options => [OneVMHelper::SCHEDULE, OneVMHelper::HARD] do
command_name='reboot'
command_name<<'-hard' if options[:hard]
if (!options[:schedule].nil?)
helper.schedule_actions(args[0], options, @comm_name)
helper.schedule_actions(args[0], options, command_name)
else
helper.perform_actions(args[0],options,"rebooting") do |vm|
vm.reboot
end
end
end
reset_desc = <<-EOT.unindent
Resets the given VM
States: RUNNING
EOT
command :reset, reset_desc, [:range,:vmid_list],
:options => [OneVMHelper::SCHEDULE] do
if (!options[:schedule].nil?)
helper.schedule_actions(args[0], options, @comm_name)
else
helper.perform_actions(args[0],options,"resetting") do |vm|
vm.reset
vm.reboot(options[:hard])
end
end
end

View File

@ -215,14 +215,11 @@ module OpenNebula
end
# Reboots an already deployed VM
def reboot
action('reboot')
def reboot(hard=false)
action(hard ? 'reboot-hard' : 'reboot')
end
# Resets an already deployed VM
def reset
action('reset')
end
alias_method :reset, :reboot
# Cancels a running VM
def cancel