public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] blockdev: add NBD: fix handling of IPv6 host to unbreak TCP disk live migration
@ 2025-11-24 12:21 Fiona Ebner
  0 siblings, 0 replies; only message in thread
From: Fiona Ebner @ 2025-11-24 12:21 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-24 12:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-24 12:21 [pve-devel] [PATCH qemu-server] blockdev: add NBD: fix handling of IPv6 host to unbreak TCP disk live migration Fiona Ebner

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