]> git.proxmox.com Git - pve-container.git/commitdiff
api: clone_vm: don't include snapshot properties
authorOguz Bektas <o.bektas@proxmox.com>
Wed, 13 Oct 2021 12:31:53 +0000 (14:31 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 14 Oct 2021 09:34:46 +0000 (11:34 +0200)
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@proxmox.com>
src/PVE/API2/LXC.pm

index 1f2f1f01a4e9a1c26e157dd03b484d42f17d1e3f..05cfbad7b3750df8110d5436765cb57bd2d80900 100644 (file)
@@ -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}) {