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:
parent
de813d909c
commit
28dae143b5
@ -83,11 +83,17 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
LIVE = {
|
LIVE = {
|
||||||
:name =>"live",
|
:name => "live",
|
||||||
:large => "--live",
|
:large => "--live",
|
||||||
:description => "Do the action with the VM running"
|
:description => "Do the action with the VM running"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HARD = {
|
||||||
|
:name => "hard",
|
||||||
|
:large => "--hard",
|
||||||
|
:description=> "Does not communicate with the guest OS"
|
||||||
|
}
|
||||||
|
|
||||||
def self.rname
|
def self.rname
|
||||||
"VM"
|
"VM"
|
||||||
end
|
end
|
||||||
|
@ -332,33 +332,22 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|||||||
Reboots the given VM, this is equivalent to execute the reboot command
|
Reboots the given VM, this is equivalent to execute the reboot command
|
||||||
from the VM console.
|
from the VM console.
|
||||||
|
|
||||||
|
The VM will be ungracefully rebooted if --hard is used.
|
||||||
|
|
||||||
States: RUNNING
|
States: RUNNING
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
command :reboot, reboot_desc, [:range,:vmid_list],
|
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?)
|
if (!options[:schedule].nil?)
|
||||||
helper.schedule_actions(args[0], options, @comm_name)
|
helper.schedule_actions(args[0], options, command_name)
|
||||||
else
|
else
|
||||||
helper.perform_actions(args[0],options,"rebooting") do |vm|
|
helper.perform_actions(args[0],options,"rebooting") do |vm|
|
||||||
vm.reboot
|
vm.reboot(options[:hard])
|
||||||
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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -215,14 +215,11 @@ module OpenNebula
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Reboots an already deployed VM
|
# Reboots an already deployed VM
|
||||||
def reboot
|
def reboot(hard=false)
|
||||||
action('reboot')
|
action(hard ? 'reboot-hard' : 'reboot')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Resets an already deployed VM
|
alias_method :reset, :reboot
|
||||||
def reset
|
|
||||||
action('reset')
|
|
||||||
end
|
|
||||||
|
|
||||||
# Cancels a running VM
|
# Cancels a running VM
|
||||||
def cancel
|
def cancel
|
||||||
|
Loading…
Reference in New Issue
Block a user