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 qemu-server] blockdev: add NBD: fix handling of IPv6 host to unbreak TCP disk live migration
Date: Mon, 24 Nov 2025 13:21:51 +0100	[thread overview]
Message-ID: <20251124122223.358353-1-f.ebner@proxmox.com> (raw)

As reported in the community forum [0], live disk migration using
migration type 'insecure' would fail when the target is an IPv6 host.
When passing the IPv6 address to QMP, the surrounding square brackets
need to be removed first.

[0]: https://forum.proxmox.com/threads/176727/

Fixes: 3fee3186 ("blockdev: add support for NBD paths")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuServer/Blockdev.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev.pm
index 26e9c383..af7e769b 100644
--- a/src/PVE/QemuServer/Blockdev.pm
+++ b/src/PVE/QemuServer/Blockdev.pm
@@ -274,8 +274,13 @@ my sub generate_file_blockdev {
         my $server = { type => 'unix', path => "$1" };
         $blockdev = { driver => 'nbd', server => $server, export => "$2" };
     } elsif ($drive->{file} =~ m/^$NBD_TCP_PATH_RE_3$/) {
-        my $server = { type => 'inet', host => "$1", port => "$2" }; # port is also a string in QAPI
-        $blockdev = { driver => 'nbd', server => $server, export => "$3" };
+        my ($host, $port, $export) = ($1, $2, $3);
+        if ($host =~ m/^\[(.*)\]$/) { # IPv6 address needs to be passed without square brackets
+            $host = $1;
+        }
+        # port is also a string in QAPI
+        my $server = { type => 'inet', host => "$host", port => "$port" };
+        $blockdev = { driver => 'nbd', server => $server, export => "$export" };
     } elsif ($drive->{file} eq 'cdrom') {
         my $path = PVE::QemuServer::Drive::get_iso_path($storecfg, $drive->{file});
         $blockdev = { driver => 'host_cdrom', filename => "$path" };
-- 
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:[~2025-11-24 12:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20251124122223.358353-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