public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH guest-common] replication: avoid passing removed storages to target
Date: Fri, 23 Jun 2023 12:08:11 +0200	[thread overview]
Message-ID: <20230623100811.28031-1-f.ebner@proxmox.com> (raw)

After removing a storage, replication states can still contain
references to it, even if no volume references it anymore.

If a storage does not exist in the storage configuration, the
replication target runs into an error when preparing the job locally.
This error prevents both running and removing the replication job. Fix
it by not passing the invalid storage ID in the first place.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/Replication.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/Replication.pm b/src/PVE/Replication.pm
index 469ca19..bd627e5 100644
--- a/src/PVE/Replication.pm
+++ b/src/PVE/Replication.pm
@@ -275,6 +275,9 @@ sub replicate {
     $logfunc->("guest => $guest_name, running => $running");
     $logfunc->("volumes => " . join(',', @$sorted_volids));
 
+    # filter out left-over non-existing/removed storages - avoids error on target
+    $state->{storeid_list} = [ grep { $storecfg->{ids}->{$_} } $state->{storeid_list}->@* ];
+
     if (my $remove_job = $jobcfg->{remove_job}) {
 
 	$logfunc->("start job removal - mode '${remove_job}'");
-- 
2.39.2





             reply	other threads:[~2023-06-23 10:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 10:08 Fiona Ebner [this message]
2023-08-30  9:12 ` Fiona Ebner
2023-08-30  9:27 ` Thomas Lamprecht
2023-08-30  9:42   ` Fiona Ebner
2023-09-01  7:40     ` 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=20230623100811.28031-1-f.ebner@proxmox.com \
    --to=f.ebner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal