1
0
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:
Carlos Martín 2013-03-27 14:57:11 +01:00
parent 2589ab86fe
commit bf2a63daf6
3 changed files with 22 additions and 5 deletions

View File

@ -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

View File

@ -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);
}
/**

View File

@ -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