mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
feature #1797: change shutdown and cancel in CLI and ruby OCA
This commit is contained in:
parent
207d2231cb
commit
2304bf84ad
@ -304,16 +304,22 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
shutdown_desc = <<-EOT.unindent
|
||||
Shuts down the given VM. The VM life cycle will end.
|
||||
|
||||
With --hard it unplugs the VM.
|
||||
|
||||
States: RUNNING
|
||||
EOT
|
||||
|
||||
command :shutdown, shutdown_desc, [:range,:vmid_list],
|
||||
:options => [OneVMHelper::SCHEDULE] do
|
||||
:options => [OneVMHelper::SCHEDULE, OneVMHelper::HARD] do
|
||||
|
||||
command_name='shutdown'
|
||||
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,"shutting down") do |vm|
|
||||
vm.shutdown
|
||||
vm.shutdown(options[:hard]==true)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -423,25 +429,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
end
|
||||
end
|
||||
|
||||
cancel_desc = <<-EOT.unindent
|
||||
Cancels the given VM. The process is checked by OpenNebula, so
|
||||
if the process fails the VM remains in running state. If the action
|
||||
succeeds the VMDIR in the remote machine is not deleted
|
||||
|
||||
States: RUNNING
|
||||
EOT
|
||||
|
||||
command :cancel, cancel_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,"canceling") do |vm|
|
||||
vm.cancel
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
stop_desc = <<-EOT.unindent
|
||||
Stops a running VM. The VM state is saved and transferred back to the
|
||||
front-end along with the disk files
|
||||
|
@ -205,8 +205,8 @@ module OpenNebula
|
||||
end
|
||||
|
||||
# Shutdowns an already deployed VM
|
||||
def shutdown
|
||||
action('shutdown')
|
||||
def shutdown(hard=false)
|
||||
action(hard ? 'shutdown-hard' : 'shutdown')
|
||||
end
|
||||
|
||||
# Powers off a running VM
|
||||
@ -224,9 +224,9 @@ module OpenNebula
|
||||
reboot(true)
|
||||
end
|
||||
|
||||
# Cancels a running VM
|
||||
# @deprecated use {#shutdown}
|
||||
def cancel
|
||||
action('cancel')
|
||||
shutdown(true)
|
||||
end
|
||||
|
||||
# Sets a VM to hold state, scheduler will not deploy it
|
||||
|
Loading…
x
Reference in New Issue
Block a user