mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
Feature #1224: New command onevm snapshot-create
This commit is contained in:
parent
21183d2a90
commit
91c0daa7b5
@ -624,6 +624,19 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: Write a more complete description:
|
||||
# what is a snapshot (system snapshot)
|
||||
# how to revert to a snapshot
|
||||
snapshot_create_desc = <<-EOT.unindent
|
||||
Creates a new VM snapshot
|
||||
EOT
|
||||
|
||||
command :"snapshot-create", snapshot_create_desc, :vmid, :name do
|
||||
helper.perform_action(args[0],options,"snapshot created") do |o|
|
||||
o.snapshot_create(args[1])
|
||||
end
|
||||
end
|
||||
|
||||
command :list, list_desc, [:filterflag, nil],
|
||||
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS+
|
||||
[OpenNebulaHelper::DESCRIBE] do
|
||||
|
@ -25,19 +25,20 @@ module OpenNebula
|
||||
|
||||
|
||||
VM_METHODS = {
|
||||
:info => "vm.info",
|
||||
:allocate => "vm.allocate",
|
||||
:action => "vm.action",
|
||||
:migrate => "vm.migrate",
|
||||
:deploy => "vm.deploy",
|
||||
:savedisk => "vm.savedisk",
|
||||
:chown => "vm.chown",
|
||||
:chmod => "vm.chmod",
|
||||
:monitoring => "vm.monitoring",
|
||||
:attach => "vm.attach",
|
||||
:detach => "vm.detach",
|
||||
:rename => "vm.rename",
|
||||
:update => "vm.update"
|
||||
:info => "vm.info",
|
||||
:allocate => "vm.allocate",
|
||||
:action => "vm.action",
|
||||
:migrate => "vm.migrate",
|
||||
:deploy => "vm.deploy",
|
||||
:savedisk => "vm.savedisk",
|
||||
:chown => "vm.chown",
|
||||
:chmod => "vm.chmod",
|
||||
:monitoring => "vm.monitoring",
|
||||
:attach => "vm.attach",
|
||||
:detach => "vm.detach",
|
||||
:rename => "vm.rename",
|
||||
:update => "vm.update",
|
||||
:snapshotcreate => "vm.snapshotcreate"
|
||||
}
|
||||
|
||||
VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
|
||||
@ -409,6 +410,16 @@ module OpenNebula
|
||||
return call(VM_METHODS[:rename], @pe_id, name)
|
||||
end
|
||||
|
||||
# Creates a new VM snapshot
|
||||
#
|
||||
# @param name [String] Name for the snapshot.
|
||||
#
|
||||
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
||||
# otherwise
|
||||
def snapshot_create(name)
|
||||
return call(VM_METHODS[:snapshotcreate], @pe_id, name)
|
||||
end
|
||||
|
||||
#######################################################################
|
||||
# Helpers to get VirtualMachine information
|
||||
#######################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user