mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
feature #1797: changed finalize and resubmit to destroy in cli and oca
This commit is contained in:
parent
a7396fdf61
commit
207d2231cb
@ -94,6 +94,12 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
:description=> "Does not communicate with the guest OS"
|
||||
}
|
||||
|
||||
RECREATE = {
|
||||
:name => "recreate",
|
||||
:large => "--recreate",
|
||||
:description=> "Resubmits a fresh VM"
|
||||
}
|
||||
|
||||
def self.rname
|
||||
"VM"
|
||||
end
|
||||
|
@ -204,19 +204,27 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
end
|
||||
end
|
||||
|
||||
delete_desc = <<-EOT.unindent
|
||||
Deletes the given VM
|
||||
destroy_desc = <<-EOT.unindent
|
||||
Deletes the given VM. Using --recreate resubmits the VM.
|
||||
|
||||
Resubmits the VM to PENDING state. This is intended for VMs stuck in a
|
||||
transient state. To re-deploy a fresh copy of the same VM, create a
|
||||
Template and instantiate it, see 'onetemplate instantiate'
|
||||
|
||||
States: ANY
|
||||
EOT
|
||||
|
||||
command :delete, delete_desc, [:range, :vmid_list],
|
||||
:options => [OneVMHelper::SCHEDULE] do
|
||||
command :destroy, destroy_desc, [:range, :vmid_list],
|
||||
:options => [OneVMHelper::SCHEDULE, OneVMHelper::RECREATE] do
|
||||
|
||||
command_name="destroy"
|
||||
command_name<<"-recreate" if options[:recreate]
|
||||
|
||||
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,"deleted") do |vm|
|
||||
vm.finalize
|
||||
vm.destroy(options[:recreate]==true)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -415,25 +423,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
end
|
||||
end
|
||||
|
||||
resubmit_desc = <<-EOT.unindent
|
||||
Resubmits the VM to PENDING state. This is intended for VMs stuck in a
|
||||
transient state. To re-deploy a fresh copy of the same VM, create a
|
||||
Template and instantiate it, see 'onetemplate instantiate'
|
||||
|
||||
States: ANY, except SUSPENDED or DONE
|
||||
EOT
|
||||
|
||||
command :resubmit, resubmit_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,"resubmiting") do |vm|
|
||||
vm.resubmit
|
||||
end
|
||||
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
|
||||
|
@ -291,8 +291,17 @@ module OpenNebula
|
||||
end
|
||||
|
||||
# Deletes a VM from the pool
|
||||
def finalize
|
||||
action('finalize')
|
||||
def destroy(recreate=false)
|
||||
if recreate
|
||||
action('destroy-recreate')
|
||||
else
|
||||
action('destroy')
|
||||
end
|
||||
end
|
||||
|
||||
# @deprecated use {#destroy} instead
|
||||
def finalize(recreate=false)
|
||||
destroy(recreate)
|
||||
end
|
||||
|
||||
# Forces a re-deployment of a VM in UNKNOWN or BOOT state
|
||||
@ -302,9 +311,9 @@ module OpenNebula
|
||||
|
||||
alias_method :restart, :boot
|
||||
|
||||
# Resubmits a VM to PENDING state
|
||||
# @deprecated use {#destroy} instead
|
||||
def resubmit
|
||||
action('resubmit')
|
||||
action('resubmit-recreate')
|
||||
end
|
||||
|
||||
# Sets the re-scheduling flag for the VM
|
||||
|
Loading…
x
Reference in New Issue
Block a user