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 1/3] abstract migrate: add map_storage() helper
Date: Wed, 21 Jan 2026 11:51:14 +0100	[thread overview]
Message-ID: <20260121105145.47010-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260121105145.47010-1-f.ebner@proxmox.com>

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2026-01-21 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 10:51 [pve-devel] [PATCH-SERIES guest-common/qemu-server/container 0/3] fix #3229: migrate: consider node restriction for 'shared' storage Fiona Ebner
2026-01-21 10:51 ` Fiona Ebner [this message]
2026-01-21 10:51 ` [pve-devel] [PATCH qemu-server 2/3] " Fiona Ebner
2026-01-21 10:51 ` [pve-devel] [PATCH container 3/3] " 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=20260121105145.47010-2-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