[pve-devel] [PATCH v3 container 1/2] api: clone_vm: don't include snapshot properties

Oguz Bektas o.bektas at proxmox.com
Thu Oct 14 11:29:56 CEST 2021


apparently this caused a weird[0] bug... when a container with a snapshot was
cloned, it would take 'parent: foo' from the original container. if you
add a new snapshot 'bar', and then another one 'foo', this causes the
snapshots to become parents of each other (thus not parsed correctly in
the tree view of GUI nor with 'pct listsnapshot CTID')

we also drop these properties for VMs, so it makes sense to do the same
here as well.

[0]: https://forum.proxmox.com/threads/snapshots-of-one-lxc-disappeared.97711/

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
v2->v3:
* no changes


 src/PVE/API2/LXC.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 1f2f1f0..05cfbad 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1512,7 +1512,12 @@ __PACKAGE__->register_method({
 	    # Replace the 'disk' lock with a 'create' lock.
 	    $newconf->{lock} = 'create';
 
+	    # delete all snapshot related config options
 	    delete $newconf->{snapshots};
+	    delete $newconf->{parent};
+	    delete $newconf->{snaptime};
+	    delete $newconf->{snapstate};
+
 	    delete $newconf->{pending};
 	    delete $newconf->{template};
 	    if ($param->{hostname}) {
-- 
2.30.2





More information about the pve-devel mailing list