For remote migration and non-shared storages, always map. For
intra-cluster migration and a shared storage, map when the storage is
not configured for the target. The latter part is in preparation to
fix bug #3229.

Signed-off-by: Fiona Ebner <[email protected]>
---
 src/PVE/AbstractMigrate.pm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/PVE/AbstractMigrate.pm b/src/PVE/AbstractMigrate.pm
index 6b4d34c..919f12d 100644
--- a/src/PVE/AbstractMigrate.pm
+++ b/src/PVE/AbstractMigrate.pm
@@ -384,4 +384,20 @@ sub get_bwlimit {
     return $bwlimit;
 }
 
+sub map_storage {
+    my ($self, $scfg, $storeid) = @_;
+
+    # NOTE: For remote migration, always map shared storages. For local 
migration, shared storages
+    # were never mapped in the past, but to fix bug #3229, storages that are 
not configured for the
+    # target are mapped too.
+    my $do_map;
+    if ($self->{opts}->{remote} || !$scfg->{shared}) {
+        $do_map = 1;
+    } else { # intra-cluster migration, shared storage
+        $do_map = !PVE::Storage::storage_check_node($self->{storecfg}, 
$storeid, $self->{node}, 1);
+    }
+
+    return $do_map ? PVE::JSONSchema::map_id($self->{opts}->{storagemap}, 
$storeid) : $storeid;
+}
+
 1;
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to