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

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

This commit is contained in:
Pavel Czerný 2022-06-20 19:30:45 +02:00 committed by GitHub
parent 9fd8826bb6
commit 45b35e7768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();