]> git.proxmox.com Git - pve-guest-common.git/commitdiff
replication: avoid passing removed storages to target
authorFiona Ebner <f.ebner@proxmox.com>
Fri, 23 Jun 2023 10:08:11 +0000 (12:08 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 30 Aug 2023 09:52:56 +0000 (11:52 +0200)
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

index 469ca193643b604ecde35e2d27064d93354ff25b..bd627e5923f0f3cd45be1021919be477ce94d815 100644 (file)
@@ -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}'");