mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #1224: New command onevm snapshot-revert
This commit is contained in:
parent
87b5de9cd3
commit
f2dce5f9c3
@ -633,6 +633,17 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: Write a more complete description:
|
||||
snapshot_revert_desc = <<-EOT.unindent
|
||||
Reverts a VM to a saved snapshot
|
||||
EOT
|
||||
|
||||
command :"snapshot-revert", snapshot_revert_desc, :vmid, :snapshot_id do
|
||||
helper.perform_action(args[0],options,"snapshot reverted") do |o|
|
||||
o.snapshot_revert(args[1])
|
||||
end
|
||||
end
|
||||
|
||||
list_desc = <<-EOT.unindent
|
||||
Lists VMs in the pool
|
||||
EOT
|
||||
|
@ -38,7 +38,8 @@ module OpenNebula
|
||||
:detach => "vm.detach",
|
||||
:rename => "vm.rename",
|
||||
:update => "vm.update",
|
||||
:snapshotcreate => "vm.snapshotcreate"
|
||||
:snapshotcreate => "vm.snapshotcreate",
|
||||
:snapshotrevert => "vm.snapshotrevert"
|
||||
}
|
||||
|
||||
VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
|
||||
@ -420,6 +421,16 @@ module OpenNebula
|
||||
return call(VM_METHODS[:snapshotcreate], @pe_id, name)
|
||||
end
|
||||
|
||||
# Creates a new VM snapshot
|
||||
#
|
||||
# @param snap_id [Integer] Id of the snapshot
|
||||
#
|
||||
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
||||
# otherwise
|
||||
def snapshot_revert(snap_id)
|
||||
return call(VM_METHODS[:snapshotrevert], @pe_id, snap_id)
|
||||
end
|
||||
|
||||
#######################################################################
|
||||
# Helpers to get VirtualMachine information
|
||||
#######################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user