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

B #5790: onevm disk-saveas can use snapshot name (#2148)

(cherry picked from commit 45b35e77688618ca9a2ddf1393f5c0ad917f2db7)
This commit is contained in:
Pavel Czerný 2022-06-20 19:30:45 +02:00 committed by Ruben S. Montero
parent de7b158bf9
commit 34c1d4345c
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
3 changed files with 9 additions and 3 deletions

View File

@ -297,7 +297,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
vm.info
ids = vm.retrieve_elements("/VM/SNAPSHOTS/SNAPSHOT[NAME='#{id}']/ID")
return [-1, "#{id} not found or duplicated"] \
return [-1, "Snapshot #{id} not found or duplicated"] \
if ids.nil? || ids.size > 1
[0, ids[0].to_i]

View File

@ -472,7 +472,13 @@ CommandParser::CmdParser.new(ARGV) do
verbose = "disk #{disk_id} prepared to be saved in " \
"the image #{image_name}"
else
snapshot_id = snapshot_id.to_i
err, snapshot_id = helper.retrieve_disk_snapshot_id(args[0],
snapshot_id)
if err == -1
STDERR.puts snapshot_id
exit(-1)
end
verbose = "disk #{disk_id} snapshot #{snapshot_id} prepared to " \
"be saved in the image #{image_name}"

View File

@ -2016,7 +2016,7 @@ int DispatchManager::disk_snapshot_revert(int vid, int did, int snap_id,
if (vm->set_snapshot_disk(did, snap_id) == -1)
{
oss << "Disk id (" << did << ") or snapshot id ("
<< snap_id << ") is not invalid.";
<< snap_id << ") is not valid.";
error_str = oss.str();