From 1ccc7fbff34ea44e5b0cf01a359d127a4c62a695 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Thu, 28 Apr 2016 17:55:11 +0200 Subject: [PATCH] qemu_hotplug: fix checking graphics ports We cannot change ports for running domain and we should error out if autoport is enabled. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_hotplug.c | 13 +++++-------- .../qemuhotplug-graphics-spice-listen-network.xml | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 07b419d539..f40b34d9c7 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2666,9 +2666,8 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, switch (dev->type) { case VIR_DOMAIN_GRAPHICS_TYPE_VNC: - if ((olddev->data.vnc.autoport != dev->data.vnc.autoport) || - (!dev->data.vnc.autoport && - (olddev->data.vnc.port != dev->data.vnc.port))) { + if (olddev->data.vnc.autoport != dev->data.vnc.autoport || + olddev->data.vnc.port != dev->data.vnc.port) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot change port settings on vnc graphics")); goto cleanup; @@ -2710,11 +2709,9 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, break; case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: - if ((olddev->data.spice.autoport != dev->data.spice.autoport) || - (!dev->data.spice.autoport && - (olddev->data.spice.port != dev->data.spice.port)) || - (!dev->data.spice.autoport && - (olddev->data.spice.tlsPort != dev->data.spice.tlsPort))) { + if (olddev->data.spice.autoport != dev->data.spice.autoport || + olddev->data.spice.port != dev->data.spice.port || + olddev->data.spice.tlsPort != dev->data.spice.tlsPort) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot change port settings on spice graphics")); goto cleanup; diff --git a/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-listen-network.xml b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-listen-network.xml index 426a14db22..f2a6aeb6e1 100644 --- a/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-listen-network.xml +++ b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-listen-network.xml @@ -1,4 +1,4 @@ - +