From 2e164b451ee6a33e2d9ba33d7bf2121f3f4817a0 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Tue, 20 Sep 2016 17:27:03 +0200 Subject: [PATCH] qemu: Ignore graphics cookie if port == 0 Old libvirt represents as In this mode, QEMU doesn't listen for SPICE connection anywhere and clients have to use virDomainOpenGraphics* APIs to attach to the domain. That is, the client has to run on the same host where the domains runs and it's impossible to tell the client to reconnect to the destination QEMU during migration (unless there is some kind of proxy on the host). While current libvirt correctly ignores such graphics devices when creating graphics migration cookie, old libvirt just sends in the cookie. After seeing this cookie, we happily would call client_migrate_info QMP command and wait for SPICE_MIGRATE_COMPLETED event, which is quite pointless since the doesn't know where to connecti anyway. We should just ignore such cookies. https://bugzilla.redhat.com/show_bug.cgi?id=1376083 Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e734816c4e..8a220d938a 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2903,6 +2903,15 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver, goto cleanup; } + /* Older libvirt sends port == 0 for listen type='none' graphics. It's + * safe to ignore such requests since relocation to unknown port does + * not make sense in general. + */ + if (port <= 0 && tlsPort <= 0) { + ret = 0; + goto cleanup; + } + if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) { ret = qemuMonitorGraphicsRelocate(priv->mon, type, listenAddress,