1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

feature #1797: change onevm disk actions

This commit is contained in:
Javi Fontan 2013-03-13 18:29:43 +01:00
parent e59bf26745
commit 21603b9aee
2 changed files with 11 additions and 11 deletions

View File

@ -82,9 +82,9 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
:description => "Show all template data"
}
HOT = {
:name =>"hot",
:large => "--hot",
LIVE = {
:name =>"live",
:large => "--live",
:description => "The Image will be saved immediately"
}

View File

@ -256,7 +256,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
saveas_desc = <<-EOT.unindent
disk_snapshot_desc = <<-EOT.unindent
Sets the specified VM disk to be saved in a new Image. The Image is
created immediately, but the contents are saved only if the VM is
shut down gracefully (i.e., using 'onevm shutdown' and not
@ -267,13 +267,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
VM is shut down gracefully (i.e., using 'onevm shutdown' and not 'onevm
delete')
If '--hot' is specified, the Image will be saved immediately.
If '--live' is specified, the Image will be saved immediately.
States: ANY
EOT
command :saveas, saveas_desc, :vmid, :diskid, :img_name,
:options=>[TYPE, OneVMHelper::HOT] do
:options=>[TYPE, OneVMHelper::LIVE] do
disk_id = args[1].to_i
image_name = args[2]
image_type = options[:type] || ""
@ -283,7 +283,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
helper.perform_action(args[0],options,verbose) do |vm|
res = vm.save_as(disk_id, image_name, image_type,
options[:hot]==true)
options[:live]==true)
if !OpenNebula.is_error?(res)
puts "Image ID: #{res}"
@ -535,13 +535,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
attachdisk_desc = <<-EOT.unindent
disk_attach_desc = <<-EOT.unindent
Attaches a disk to a running VM
States: RUNNING
EOT
command :attachdisk, attachdisk_desc, :vmid,
command :"disk-attach", disk_attach_desc, :vmid,
:options => [OneVMHelper::FILE, OneVMHelper::IMAGE,
TARGET, CACHE] do
@ -577,13 +577,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
detachdisk_desc = <<-EOT.unindent
disk_detach_desc = <<-EOT.unindent
Detaches a disk from a running VM
States: RUNNING
EOT
command :detachdisk, detachdisk_desc, :vmid, :diskid do
command :"disk-detach", disk_detach_desc, :vmid, :diskid do
diskid = args[1].to_i
helper.perform_action(args[0],options,"Detach disk") do |vm|