From 996ee89dc1fc3682cf81322f094b9c1790dba1fb Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Thu, 11 Jun 2015 18:09:41 +0200 Subject: [PATCH] feature #3782: allow disk-saveas operations on the currently running disk --- src/vm/VirtualMachine.cc | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 884600358d..a87af5db8f 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -3229,23 +3229,11 @@ int VirtualMachine::set_saveas_disk(int disk_id, int snap_id, string& err_str) const Snapshots * snaps = get_disk_snapshots(disk_id, err_str); - if (snaps == 0) + if (snap_id != -1) { - if (snap_id != -1) + if (snaps == 0 || !snaps->exists(snap_id)) { - err_str = "Snapshot does not exists."; - return -1; - } - } - else - { - if (snap_id == -1) - { - snap_id = snaps->get_active_id(); - } - else if (!snaps->exists(snap_id)) - { - err_str = "Snapshot does not exists."; + err_str = "Snapshot does not exist."; return -1; } }