From: Oguz Bektas <o.bektas@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH v3 guest-common 2/2] snapshots: delete parent property if new snapshot name is already a parent to existing one
Date: Thu, 4 Nov 2021 11:40:43 +0100 [thread overview]
Message-ID: <YYO4q3EMk+lL/nSQ@gaia> (raw)
In-Reply-To: <20211014092957.845329-3-o.bektas@proxmox.com>
hi,
was this patch missed?
or is there a problem with it?
the fix for containers was applied but without this one.
thanks
On Thu, Oct 14, 2021 at 11:29:57AM +0200, Oguz Bektas wrote:
> Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
> ---
> v2->v3:
> * automatically delete the 'parent' property for an existing snapshot
> (instead of aborting) if its the same as the new snapshot name (and the
> snapshot referenced by 'parent' is not used)
>
>
>
> src/PVE/AbstractConfig.pm | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/AbstractConfig.pm b/src/PVE/AbstractConfig.pm
> index 3348d8a..e4ddeab 100644
> --- a/src/PVE/AbstractConfig.pm
> +++ b/src/PVE/AbstractConfig.pm
> @@ -721,14 +721,21 @@ sub __snapshot_prepare {
>
> $conf->{lock} = 'snapshot';
>
> + my $snapshots = $conf->{snapshots};
> +
> die "snapshot name '$snapname' already used\n"
> - if defined($conf->{snapshots}->{$snapname});
> + if defined($snapshots->{$snapname});
>
> my $storecfg = PVE::Storage::config();
> die "snapshot feature is not available\n"
> if !$class->has_feature('snapshot', $conf, $storecfg, undef, undef, $snapname eq 'vzdump');
>
> - $snap = $conf->{snapshots}->{$snapname} = {};
> + foreach my $existing_snapshot (keys %$snapshots) {
> + my $parent_name = $snapshots->{$existing_snapshot}->{parent} // '';
> + delete $snapshots->{$existing_snapshot}->{parent} if $snapname eq $parent_name;
> + }
> +
> + $snap = $snapshots->{$snapname} = {};
>
> if ($save_vmstate && $class->__snapshot_check_running($vmid)) {
> $class->__snapshot_save_vmstate($vmid, $conf, $snapname, $storecfg);
> --
> 2.30.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
next prev parent reply other threads:[~2021-11-04 10:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-14 9:29 [pve-devel] [PATCH v3 container guest-common 0/2] snapshot parent checks for containers Oguz Bektas
2021-10-14 9:29 ` [pve-devel] [PATCH v3 container 1/2] api: clone_vm: don't include snapshot properties Oguz Bektas
2021-10-14 9:29 ` [pve-devel] [PATCH v3 guest-common 2/2] snapshots: delete parent property if new snapshot name is already a parent to existing one Oguz Bektas
2021-11-04 10:40 ` Oguz Bektas [this message]
2021-11-29 12:31 ` Hannes Laimer
2021-11-30 7:32 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YYO4q3EMk+lL/nSQ@gaia \
--to=o.bektas@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox