]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Enable disconnecting SPICE clients without changing password
authorPeter Krempa <pkrempa@redhat.com>
Thu, 14 Jun 2012 12:48:42 +0000 (14:48 +0200)
committerCole Robinson <crobinso@redhat.com>
Thu, 14 Jun 2012 22:38:27 +0000 (18:38 -0400)
Libvirt updates the configuration of SPICE server only when something
changes. This is unfortunate when the user wants to disconnect a
existing spice session when the connected attribute is already
"disconnect".

This patch modifies the conditions for calling the password updater to
be called when nothing changes, but the connected attribute is already
"disconnect".
(cherry picked from commit e0f0131d33e283f1b76c05eb7bef4bbbb3f2fd72)

src/qemu/qemu_hotplug.c

index 2720752e0313d4e816cb95ce77ae897c80da812b..62de67c9f9f6b91b246c369ea161677e3b8285a2 100644 (file)
@@ -1539,7 +1539,7 @@ qemuDomainChangeGraphics(struct qemud_driver *driver,
                             _("cannot change listen address setting on spice graphics"));
             return -1;
         }
-        if (STRNEQ_NULLABLE(oldListenNetwork,newListenNetwork)) {
+        if (STRNEQ_NULLABLE(oldListenNetwork, newListenNetwork)) {
             qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("cannot change listen network setting on spice graphics"));
             return -1;
@@ -1551,11 +1551,16 @@ qemuDomainChangeGraphics(struct qemud_driver *driver,
             return -1;
         }
 
-        /* If a password lifetime was, or is set, then we must always run,
-         * even if new password matches old password */
+        /* We must reset the password if it has changed but also if:
+         * - password lifetime is or was set
+         * - the requested action has changed
+         * - the action is "disconnect"
+         */
         if (olddev->data.spice.auth.expires ||
             dev->data.spice.auth.expires ||
             olddev->data.spice.auth.connected != dev->data.spice.auth.connected ||
+            dev->data.spice.auth.connected ==
+            VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_DISCONNECT ||
             STRNEQ_NULLABLE(olddev->data.spice.auth.passwd,
                             dev->data.spice.auth.passwd)) {
             VIR_DEBUG("Updating password on SPICE server %p %p",