[pve-devel] [PATCH qemu-server v2] fix #1749: do not copy pending changes when cloning a vm

Dominik Csapak d.csapak at proxmox.com
Wed May 2 11:23:59 CEST 2018


cloning a vm means copying the current state, not the
state of 'some time in the future, when the vm is started again'
we should not copy the pending changes, which also fixes the
issue that we got a wrong pending change on the disks,net,smbios,etc.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* added a log message
* moved the code to the realcmd so that the message appears in the task log
 PVE/API2/Qemu.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 0f27d29..fb8a6e3 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2723,6 +2723,13 @@ __PACKAGE__->register_method({
 		    }
 
 		    delete $newconf->{lock};
+
+		    # do not write pending changes
+		    if ($newconf->{pending}) {
+			warn "found pending changes, discarding for clone\n";
+			delete $newconf->{pending};
+		    }
+
 		    PVE::QemuConfig->write_config($newid, $newconf);
 
                     if ($target) {
-- 
2.11.0





More information about the pve-devel mailing list