[pve-devel] [PATCH guest-common 1/3] abstract migrate: add map_storage() helper
Fiona Ebner
f.ebner at proxmox.com
Wed Jan 21 11:51:14 CET 2026
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 <f.ebner at proxmox.com>
---
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
More information about the pve-devel
mailing list