unable to migrate: virPortAllocatorSetUsed:299 : internal error: Failed to reserve port 49153

Michal Privoznik mprivozn at redhat.com
Mon Oct 26 08:39:58 UTC 2020


On 10/12/20 4:46 AM, Vjaceslavs Klimovs wrote:
> On libvirt 6.8.0 and qemu 5.1.0, when trying to live migrate "error:
> internal error: Failed to reserve port" error is received and
> migration does not succeed:
> 
> virsh # migrate cartridge qemu+tls://ratchet.lan/system --live
> --persistent --undefinesource --copy-storage-all --verbose
> error: internal error: Failed to reserve port 49153
> 
> virsh #
> 

Sorry for not replying earlier. But this is a clear libvirt bug and I 
think it's a regression introduced by the following commit:

https://gitlab.com/libvirt/libvirt/-/commit/e74d627bb3b

The problem is, if you have two or more disks that need to be copied 
over to the destination, the @server_started variable is not set after 
the first iteration of the "for (i = 0; i < vm->def->ndisks; i++)" loop. 
I think this should be the fix:


diff --git i/src/qemu/qemu_migration.c w/src/qemu/qemu_migration.c
index 2f5d61f8e7..6f764b0c73 100644
--- i/src/qemu/qemu_migration.c
+++ w/src/qemu/qemu_migration.c
@@ -479,9 +479,11 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver,
 
QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
              goto cleanup;

-        if (!server_started &&
-            qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) < 0)
-            goto exit_monitor;
+        if (!server_started) {
+            if (qemuMonitorNBDServerStart(priv->mon, &server, 
tls_alias) < 0)
+                goto exit_monitor;
+            server_started = true;
+        }

          if (qemuBlockExportAddNBD(vm, diskAlias, disk->src, diskAlias, 
true, NULL) < 0)
              goto exit_monitor;



Can you please give it a try? If it fixes the issue, I'll post it as a 
patch.

Thanks,
Michal




More information about the libvirt-users mailing list