From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, c.heiss@proxmox.com
Subject: Re: [pve-devel] [PATCH storage] fix #4289: pbs: wait for backup verification to finish before updating volume attribute
Date: Wed, 4 Jan 2023 11:50:38 +0100 [thread overview]
Message-ID: <dff207ed-4116-2010-1be0-d3b263469ea9@proxmox.com> (raw)
In-Reply-To: <20230102123633.2493599-3-c.heiss@proxmox.com>
Am 02.01.23 um 13:36 schrieb Christoph Heiss:
> diff --git a/PVE/Storage/PBSPlugin.pm b/PVE/Storage/PBSPlugin.pm
> index 4320974..1cdbc11 100644
> --- a/PVE/Storage/PBSPlugin.pm
> +++ b/PVE/Storage/PBSPlugin.pm
> @@ -906,8 +906,30 @@ sub get_volume_attribute {
> return;
> }
>
> +sub wait_for_verify_finish {
> + my ($conn, $node, $datastore, $attrs) = @_;
> +
> + my $param = {
> + running => 'true',
> + since => $attrs->{'backup-time'},
> + store => $datastore,
> + typefilter => 'verify',
> + };
> +
> + my $taskname = sprintf('%s:%s/%s/%X',
> + $datastore,
> + @{$attrs}{qw(backup-type backup-id backup-time)},
> + );
I don't think it's likely that the task name format here will change
often, but as you already mentioned in the cover letter, it's not ideal
to have it hard-coded here.
> +
> + while (1) {
> + my $res = eval { $conn->get("/api2/json/nodes/$node/tasks", $param); };
> + last if !grep { $_->{worker_id} eq $taskname } @$res;
> + sleep(1);
> + }
> +}
> +
> @@ -921,6 +943,9 @@ sub update_volume_attribute {
> my $conn = pbs_api_connect($scfg, $password);
> my $datastore = $scfg->{datastore};
>
> + $logfunc->('info', 'waiting for server to finish backup verification...') if $logfunc;
Should only be printed if there is actually a verification we need to
wait for.
> + wait_for_verify_finish($conn, $scfg->{server}, $datastore, $param);
To me, it feels out of place to be concerned with waiting on
verification in (the rather low-level) update_volume_attribute(), which
is a rather specific thing to do. I'd say it's fine to fail there when
the snapshot is locked by verification or some other operation.
Waiting for verification also can increase the backup duration/time
holding the vzdump lock on the PVE side quite a bit. It might not seem
that big of a deal, because usually only manual backups use 'protected'.
But by doing it in update_volume_attribute(), you also do it for
'notes', where it's not needed and which is relevant to backup jobs
where the increased wait might be very noticeable. So at least, it
should only be done for 'protected' if doing it in
update_volume_attribute().
It would be better if the protected flag could be specified upon
creation already. Would also fix the following race I guess:
1. backup finishes
2. prune running on PBS
3. protected status set from PVE
If going for the waiting approach after all, I think it should rather be
done in vzdump, before calling update_volume_attribute(). And the helper
to wait on verification should likely be part of PBSClient.pm (would
need to teach it to use an API connection first).
next prev parent reply other threads:[~2023-01-04 10:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-02 12:36 [pve-devel] [PATCH manager/storage] fix #4289: " Christoph Heiss
2023-01-02 12:36 ` [pve-devel] [PATCH manager] vzdump: pass logfunc down into storage plugin when " Christoph Heiss
2023-01-02 12:36 ` [pve-devel] [PATCH storage] fix #4289: pbs: wait for backup verification to finish before " Christoph Heiss
2023-01-04 10:50 ` Fiona Ebner [this message]
2023-01-10 11:11 ` Christoph Heiss
2023-01-10 12:34 ` Fiona Ebner
2023-01-10 12:44 ` Christoph Heiss
[not found] ` <159837ba-f916-7b03-2cab-8e486b38b6bb@proxmox.com>
2023-01-10 13:21 ` Fiona Ebner
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=dff207ed-4116-2010-1be0-d3b263469ea9@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=c.heiss@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