[pve-devel] applied: [PATCH qemu-server] Fix #1999: regression for corner cases
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Jun 5 19:26:01 CEST 2019
On 6/5/19 3:30 PM, Rhonda D'Vine wrote:
> This commit addresses the following things:
>
> * There can be multiple independent snapshot tree roots, display them
> all
> * If a snapshot defines a parent that doesn't exist, it is now
> considered a snapshot root
>
> There is a potential issue (which was also before and also affects the
> GUI): circular snapshot trees. That plays into the second mentioned
> issue above. If you manage to have a snapshot that defines a
> non-existing root in the config, and then create a snapshot with that
> exact name as a child of that snapshot, it would create a circular
> dependency. This would have to get addressed in the GUI too.
>
> Signed-off-by: Rhonda D'Vine <rhonda at proxmox.com>
applied, but changed the commit subject line to something meaningful:
> Fix #1999: cli: listsnapshot: handle multiple roots and mark orphaned as root
so that one knows circa what and why this touches, please try to word
those in such a way that a `git log --oneline` doesn't only leaves question
marks when reading it and thus simplifies writing changelogs for me and
other maintainers :-) Anyway, thanks a lot!
> ---
> PVE/CLI/qm.pm | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
> index 87b97ce..b5e838e 100755
> --- a/PVE/CLI/qm.pm
> +++ b/PVE/CLI/qm.pm
> @@ -926,12 +926,13 @@ our $cmddef = {
>
> my $snapshots = { map { $_->{name} => $_ } @$res };
>
> - my $root;
> + my @roots;
> foreach my $e (@$res) {
> - if (my $parent = $e->{parent}) {
> + my $parent;
> + if (($parent = $e->{parent}) && defined $snapshots->{$parent}) {
> push @{$snapshots->{$parent}->{children}}, $e->{name};
> } else {
> - $root = $e->{name};
> + push @roots, $e->{name};
> }
> }
>
> @@ -967,7 +968,9 @@ our $cmddef = {
> }
> };
>
> - $snapshottree->('`->', $root, $snapshots);
> + foreach my $root (sort $snaptimesort @roots) {
> + $snapshottree->('`->', $root, $snapshots);
> + }
> }],
>
> rollback => [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
>
More information about the pve-devel
mailing list