mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-01 06:50:25 +03:00
Feature #1835: Add poweroff --hard to cli, ruby & java oca
This commit is contained in:
parent
2589ab86fe
commit
bf2a63daf6
@ -327,12 +327,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
EOT
|
||||
|
||||
command :poweroff, poweroff_desc, [:range,:vmid_list],
|
||||
:options => [OneVMHelper::SCHEDULE] do
|
||||
:options => [OneVMHelper::SCHEDULE, OneVMHelper::HARD] do
|
||||
|
||||
command_name='poweroff'
|
||||
command_name<<'-hard' if options[:hard]
|
||||
|
||||
if (!options[:schedule].nil?)
|
||||
helper.schedule_actions(args[0], options, @comm_name)
|
||||
else
|
||||
helper.perform_actions(args[0],options,"shutting down") do |vm|
|
||||
vm.poweroff
|
||||
vm.poweroff(options[:hard]==true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -838,7 +838,20 @@ public class VirtualMachine extends PoolElement{
|
||||
*/
|
||||
public OneResponse poweroff()
|
||||
{
|
||||
return action("poweroff");
|
||||
return poweroff(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Powers off a running VM.
|
||||
* @param hard True to perform a hard (no acpi) shutdown, false for a
|
||||
* graceful shutdown
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse poweroff(boolean hard)
|
||||
{
|
||||
String actionSt = hard ? "poweroff-hard" : "poweroff";
|
||||
|
||||
return action(actionSt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,8 +211,8 @@ module OpenNebula
|
||||
end
|
||||
|
||||
# Powers off a running VM
|
||||
def poweroff
|
||||
action('poweroff')
|
||||
def poweroff(hard=false)
|
||||
action(hard ? 'poweroff-hard' : 'poweroff')
|
||||
end
|
||||
|
||||
# Reboots an already deployed VM
|
||||
|
Loading…
x
Reference in New Issue
Block a user