public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH container] api: clone_vm: don't include 'parent' property in clones
@ 2021-10-12 13:32 Oguz Bektas
  2021-10-13  9:12 ` Fabian Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Oguz Bektas @ 2021-10-12 13:32 UTC (permalink / raw)
  To: pve-devel

apparently this caused a weird[0] bug... when a container with a
snapshot 'foo' was cloned, it would take 'parent: foo' from the original
container. when you add a new snapshot 'bar' to the cloned container,
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')

[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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 1f2f1f0..15a1926 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1515,6 +1515,7 @@ __PACKAGE__->register_method({
 	    delete $newconf->{snapshots};
 	    delete $newconf->{pending};
 	    delete $newconf->{template};
+	    delete $newconf->{parent};
 	    if ($param->{hostname}) {
 		$newconf->{hostname} = $param->{hostname};
 	    }
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH container] api: clone_vm: don't include 'parent' property in clones
  2021-10-12 13:32 [pve-devel] [PATCH container] api: clone_vm: don't include 'parent' property in clones Oguz Bektas
@ 2021-10-13  9:12 ` Fabian Ebner
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Ebner @ 2021-10-13  9:12 UTC (permalink / raw)
  To: pve-devel, Oguz Bektas

Am 12.10.21 um 15:32 schrieb Oguz Bektas:
> apparently this caused a weird[0] bug... when a container with a
> snapshot 'foo' was cloned, it would take 'parent: foo' from the original
> container. when you add a new snapshot 'bar' to the cloned container,
> 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')
> 
> [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 | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 1f2f1f0..15a1926 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
> @@ -1515,6 +1515,7 @@ __PACKAGE__->register_method({
>   	    delete $newconf->{snapshots};
>   	    delete $newconf->{pending};
>   	    delete $newconf->{template};
> +	    delete $newconf->{parent};
>   	    if ($param->{hostname}) {
>   		$newconf->{hostname} = $param->{hostname};
>   	    }
> 

A short note that we already do this for VMs could've been nice ;) In 
fact, we remove more properties there, namely also snapstate, snaptime 
and vmstate. Makes sense to do the same here (even if vmstate currently 
doesn't exist).

For already affected configs (luckily backups are not affected AFAICT), 
we might think about adding a cleanup/safeguard against creating loops 
when a new snapshot is created. Something like: if any already existing 
snapshot (or normal config) has the new snapshot name as parent, remove 
that parent property. Of course only after checking that the new 
snapshot name does not already exist. Or maybe die and prompt for manual 
cleanup.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-13  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 13:32 [pve-devel] [PATCH container] api: clone_vm: don't include 'parent' property in clones Oguz Bektas
2021-10-13  9:12 ` Fabian Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal