From f830495c362a02ca9695c4f5ffd6dd1959ca60e1 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 13 Feb 2012 19:07:57 -0500 Subject: [PATCH] Fix error reporting for failed remote connections (bz 787011) Fix setting window title when VNC mouse is grabbed (bz 788443) Advertise VDI format in disk details (bz 761300) Don't let an unavailable host hang the app (bz 766769) Don't overwrite existing create dialog when reshowing (bz 754152) Improve tooltip for 'force console shortcuts' (bz 788448) --- virt-manager-conn-hang-app.patch | 121 ++++++++++++++++++ ...manager-console-shortcut-explanation.patch | 22 ++++ virt-manager-create-reshow.patch | 24 ++++ virt-manager-remote-error-reporting.patch | 101 +++++++++++++++ virt-manager-vdi-format.patch | 22 ++++ virt-manager-vnc-grab-recursion.patch | 23 ++++ virt-manager.spec | 28 +++- 7 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 virt-manager-conn-hang-app.patch create mode 100644 virt-manager-console-shortcut-explanation.patch create mode 100644 virt-manager-create-reshow.patch create mode 100644 virt-manager-remote-error-reporting.patch create mode 100644 virt-manager-vdi-format.patch create mode 100644 virt-manager-vnc-grab-recursion.patch diff --git a/virt-manager-conn-hang-app.patch b/virt-manager-conn-hang-app.patch new file mode 100644 index 0000000..7c781d0 --- /dev/null +++ b/virt-manager-conn-hang-app.patch @@ -0,0 +1,121 @@ +commit 13dd371e4840b8dca70508477cfc6820ac5d9a71 +Author: Cole Robinson +Date: Wed Feb 8 14:15:15 2012 -0500 + + Don't let media polling block app if a connection goes down + + If we unplug a remote machine we are connected to, doing the media + timeout with a gobject timeout means running it in the main thread, + which if it's blocking on the remote connection will freeze the whole + app. + +diff --git a/src/virtManager/connection.py b/src/virtManager/connection.py +index 15c1d5e..d649c44 100644 +--- a/src/virtManager/connection.py ++++ b/src/virtManager/connection.py +@@ -1583,6 +1583,9 @@ class vmmConnection(vmmGObject): + "connection doesn't seem to have dropped. " + "Ignoring.") + ++ for dev in self.mediadevs.values(): ++ dev.tick() ++ + if not noStatsUpdate: + self._recalculate_stats(now, updateVMs) + +diff --git a/src/virtManager/mediadev.py b/src/virtManager/mediadev.py +index 3731599..a046d9e 100644 +--- a/src/virtManager/mediadev.py ++++ b/src/virtManager/mediadev.py +@@ -19,6 +19,7 @@ + # + + import logging ++import time + + import virtinst + +@@ -49,7 +50,7 @@ class vmmMediaDevice(vmmGObject): + + obj = vmmMediaDevice(path, key, has_media, media_label, media_key, + dev, drvtype) +- obj.enable_poll_for_media() ++ obj.do_poll = True + + return obj + +@@ -65,7 +66,8 @@ class vmmMediaDevice(vmmGObject): + self.media_type = media_type + + self.nodedev_obj = nodedev_obj +- self.poll_signal = None ++ self.do_poll = False ++ self.last_tick = 0 + + def _cleanup(self): + pass +@@ -130,50 +132,38 @@ class vmmMediaDevice(vmmGObject): + ######################################### + # Nodedev API polling for media updates # + ######################################### +- def enable_poll_for_media(self): +- if self.poll_signal: +- return +- +- self.poll_signal = self.safe_timeout_add(MEDIA_TIMEOUT * 1000, +- self._poll_for_media) +- self.add_gobject_timeout(self.poll_signal) +- +- def disable_poll_for_media(self): +- self.remove_gobject_timeout(self.poll_signal) +- self.poll_signal = None +- +- def _poll_for_media(self): +- if not self.poll_signal: +- return False + ++ def tick(self): + if not self.nodedev_obj: +- return False ++ return + + if not self.nodedev_obj.conn.is_active(): +- return False ++ return ++ ++ if (time.time() - self.last_tick) < MEDIA_TIMEOUT: ++ return ++ self.last_tick = time.time() + + try: + self.nodedev_obj.refresh_xml() + xml = self.nodedev_obj.get_xml() + except: + # Assume the device was removed +- return False ++ return + + try: + vobj = virtinst.NodeDeviceParser.parse(xml) + has_media = vobj.media_available + except: + logging.exception("Node device CDROM polling failed") +- return False ++ return ++ ++ if has_media == self.has_media(): ++ return + +- if has_media != self.has_media(): +- self.set_media(has_media, None, None) +- if has_media: +- self.emit("media-added") +- else: +- self.emit("media-removed") ++ self.set_media(has_media, None, None) ++ self.idle_emit(has_media and "media-added" or "media-removed") + +- return True + + vmmGObject.type_register(vmmMediaDevice) + vmmMediaDevice.signal_new(vmmMediaDevice, "media-added", []) diff --git a/virt-manager-console-shortcut-explanation.patch b/virt-manager-console-shortcut-explanation.patch new file mode 100644 index 0000000..d94aa18 --- /dev/null +++ b/virt-manager-console-shortcut-explanation.patch @@ -0,0 +1,22 @@ +diff -rup virt-manager-0.9.1/src/vmm-preferences.glade new/src/vmm-preferences.glade +--- virt-manager-0.9.1/src/vmm-preferences.glade 2012-01-27 09:38:01.000000000 -0500 ++++ new/src/vmm-preferences.glade 2012-02-13 19:05:22.890465706 -0500 +@@ -398,8 +398,8 @@ Always + + + True +- Force console menu accelerators while the console is active. Enabling this may overwrite keyboard interaction with the guest. +- Force console keyboard shortcuts: ++ When the guest graphical console has keyboard focus, do not disable shortcuts for console window menus (Alt+F -> File, etc.) Normally these are disabled to ensure that typing in the guest does not accidentally perform an operation in virt-manager's console window. ++ Don't disable console shortcuts: + + + False +@@ -412,6 +412,7 @@ Always + True + False + True ++ When the guest graphical console has keyboard focus, do not disable shortcuts for console window menus (Alt+F -> File, etc.) Normally these are disabled to ensure that typing in the guest does not accidentally perform an operation in virt-manager's console window. + + + diff --git a/virt-manager-create-reshow.patch b/virt-manager-create-reshow.patch new file mode 100644 index 0000000..7cb3fb6 --- /dev/null +++ b/virt-manager-create-reshow.patch @@ -0,0 +1,24 @@ +commit f12f4ea1980e68a12129922f456f9275ee897f65 +Author: Cole Robinson +Date: Mon Feb 13 16:19:34 2012 -0500 + + create: reshow shouldn't overwrite values in visible dialog + +diff --git a/src/virtManager/create.py b/src/virtManager/create.py +index 56d4e27..4d02922 100644 +--- a/src/virtManager/create.py ++++ b/src/virtManager/create.py +@@ -169,9 +169,11 @@ class vmmCreate(vmmGObjectUI): + + def show(self, parent, uri=None): + logging.debug("Showing new vm wizard") +- self.reset_state(uri) + +- self.topwin.set_transient_for(parent) ++ if not self.is_visible(): ++ self.reset_state(uri) ++ self.topwin.set_transient_for(parent) ++ + self.topwin.present() + + def close(self, ignore1=None, ignore2=None): diff --git a/virt-manager-remote-error-reporting.patch b/virt-manager-remote-error-reporting.patch new file mode 100644 index 0000000..da481f9 --- /dev/null +++ b/virt-manager-remote-error-reporting.patch @@ -0,0 +1,101 @@ +commit 54d007b2875a887b1579604e45b122dde286b9be +Author: Cole Robinson +Date: Thu Feb 2 16:45:18 2012 -0500 + + manager: Fix error reporting when can't connect remotely + + Also rejigger the error building again to be more useful and + less scary in cases where we are pretty confident we know what the + problem is. + +diff --git a/src/virtManager/manager.py b/src/virtManager/manager.py +index 2e8a679..a4b2df5 100644 +--- a/src/virtManager/manager.py ++++ b/src/virtManager/manager.py +@@ -646,42 +646,55 @@ class vmmManager(vmmGObjectUI): + conn.open() + return True + +- def _connect_error(self, conn, shortmsg, tb, warnconsole): +- shortmsg = shortmsg.strip(" \n") ++ def _connect_error(self, conn, errmsg, tb, warnconsole): ++ errmsg = errmsg.strip(" \n") + tb = tb.strip(" \n") +- msg = _("Unable to connect to libvirt:\n\n%s\n\n") % shortmsg ++ hint = "" ++ show_errmsg = True ++ ++ if conn.is_remote(): ++ logging.debug(conn.get_transport()) ++ if re.search(r"nc: .* -- 'U'", tb): ++ hint += _("The remote host requires a version of netcat/nc\n" ++ "which supports the -U option.") ++ show_errmsg = False ++ elif conn.get_transport()[0] == "ssh" and re.search(r"ssh-askpass", tb): ++ hint += _("You need to install openssh-askpass or similar\n" ++ "to connect to this host.") ++ show_errmsg = False ++ else: ++ hint += _("Verify that the 'libvirtd' daemon is running\n" ++ "on the remote host.") + +- if conn.is_xen() and not conn.is_remote(): +- msg += _("Verify that:\n" +- " - A Xen host kernel was booted\n" +- " - The Xen service has been started\n") +- msg = msg.strip("\n") +- details = "%s\n\n%s" % (msg, tb) ++ elif conn.is_xen(): ++ hint += _("Verify that:\n" ++ " - A Xen host kernel was booted\n" ++ " - The Xen service has been started") + + else: +- hints = [] +- if conn.is_remote() and re.search(r"nc: .* -- 'U'", details): +- hints.append( +- _("\n - The remote netcat understands the '-U' option")) +- + if warnconsole: +- msg += _("Could not detect a local session: if you are \n" +- "running virt-manager over ssh -X or VNC, you \n" +- "may not be able to connect to libvirt as a \n" +- "regular user. Try running as root.\n\n") +- else: +- msg += _("Verify that:\n" + +- " - The 'libvirtd' daemon has been started") +- for hint in hints: +- msg += hint +- +- msg = msg.strip("\n") +- details = (("%s\n\n" % msg) + +- (_("Libvirt URI is: %s\n\n") % conn.get_uri()) + +- tb) +- +- self.err.show_err(msg, details, +- title=_("Virtual Machine Manager Connection Failure")) ++ hint += _("Could not detect a local session: if you are \n" ++ "running virt-manager over ssh -X or VNC, you \n" ++ "may not be able to connect to libvirt as a \n" ++ "regular user. Try running as root.") ++ show_errmsg = False ++ elif re.search(r"libvirt-sock", tb): ++ hint += _("Verify that the 'libvirtd' daemon is running.") ++ show_errmsg = False ++ ++ msg = _("Unable to connect to libvirt.") ++ if show_errmsg: ++ msg += "\n\n%s" % errmsg ++ if hint: ++ msg += "\n\n%s" % hint ++ ++ msg = msg.strip("\n") ++ details = msg ++ details += "\n\n" ++ details += "Libvirt URI is: %s\n\n" % conn.get_uri() ++ details += tb ++ ++ self.err.show_err(msg, details, title=_("Virtual Machine Manager Connection Failure")) + + + #################################### diff --git a/virt-manager-vdi-format.patch b/virt-manager-vdi-format.patch new file mode 100644 index 0000000..3f571e1 --- /dev/null +++ b/virt-manager-vdi-format.patch @@ -0,0 +1,22 @@ +commit 265e04205e4766f459d4ced516dbd784cf2ca57f +Author: Cole Robinson +Date: Tue Feb 7 17:13:59 2012 -0500 + + Add VDI to disk format list + + People actually distribute images in that format: + + https://bugzilla.redhat.com/show_bug.cgi?id=761300 + +diff --git a/src/virtManager/uihelpers.py b/src/virtManager/uihelpers.py +index c274592..3ba4a71 100644 +--- a/src/virtManager/uihelpers.py ++++ b/src/virtManager/uihelpers.py +@@ -397,6 +397,7 @@ def build_storage_format_combo(vm, combo): + formats = ["raw", "qcow2"] + if vm.rhel6_defaults(): + formats.append("vmdk") ++ formats.append("vdi") + + for m in formats: + dev_model.append([m]) diff --git a/virt-manager-vnc-grab-recursion.patch b/virt-manager-vnc-grab-recursion.patch new file mode 100644 index 0000000..724a444 --- /dev/null +++ b/virt-manager-vnc-grab-recursion.patch @@ -0,0 +1,23 @@ +commit c47fc5454039a9e7093f179c1e06ffc576dc1ad3 +Author: Cole Robinson +Date: Mon Feb 6 17:57:14 2012 -0500 + + vnc: Fix accidental recursion we reporting grab keys + +diff --git a/src/virtManager/console.py b/src/virtManager/console.py +index 3b39a6c..13fc755 100644 +--- a/src/virtManager/console.py ++++ b/src/virtManager/console.py +@@ -387,12 +387,6 @@ class VNCViewer(Viewer): + def open_fd(self, fd): + self.display.open_fd(fd) + +- def get_grab_keys(self): +- keystr = self.get_grab_keys() +- if not keystr: +- keystr = "Control_L+Alt_L" +- return keystr +- + def set_credential_username(self, cred): + self.display.set_credential(gtkvnc.CREDENTIAL_USERNAME, cred) + diff --git a/virt-manager.spec b/virt-manager.spec index 7c9c73a..fc58640 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -2,7 +2,7 @@ %define _package virt-manager %define _version 0.9.1 -%define _release 1 +%define _release 2 %define virtinst_version 0.600.1 %define qemu_user "qemu" @@ -34,6 +34,18 @@ Group: Applications/Emulators License: GPLv2+ URL: http://virt-manager.org/ Source0: http://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz +# Fix error reporting for failed remote connections (bz 787011) +Patch1: %{name}-remote-error-reporting.patch +# Fix setting window title when VNC mouse is grabbed (bz 788443) +Patch2: %{name}-vnc-grab-recursion.patch +# Advertise VDI format in disk details (bz 761300) +Patch3: %{name}-vdi-format.patch +# Don't let an unavailable host hang the app (bz 766769) +Patch4: %{name}-conn-hang-app.patch +# Don't overwrite existing create dialog when reshowing (bz 754152) +Patch5: %{name}-create-reshow.patch +# Improve tooltip for 'force console shortcuts' (bz 788448) +Patch6: %{name}-console-shortcut-explanation.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -142,6 +154,12 @@ Common files used by the different Virtual Machine Manager interfaces. %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build %if %{qemu_user} @@ -259,6 +277,14 @@ update-desktop-database -q %{_datadir}/applications %endif %changelog +* Mon Feb 13 2012 Cole Robinson - 0.9.1-2 +- Fix error reporting for failed remote connections (bz 787011) +- Fix setting window title when VNC mouse is grabbed (bz 788443) +- Advertise VDI format in disk details (bz 761300) +- Don't let an unavailable host hang the app (bz 766769) +- Don't overwrite existing create dialog when reshowing (bz 754152) +- Improve tooltip for 'force console shortcuts' (bz 788448) + * Wed Feb 01 2012 Cole Robinson - 0.9.1-1 - Rebased to version 0.9.1 - Support for adding usb redirection devices (Marc-André Lureau)