Fix first run packagekit interaction (bz #870851)

Fix another backtrace if guest is pmsuspended (bz #871237)
This commit is contained in:
Cole Robinson 2012-10-30 21:44:40 -04:00
parent 4d8e186c75
commit ce88c8945e
4 changed files with 173 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From 983e3b9fcf6d1410396e16bb0141e21939e69da7 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sun, 28 Oct 2012 20:09:32 -0400
Subject: [PATCH] Fix package install with PackageKit 0.8.4 (cherry picked
from commit 35bab2cc98ee4aef87f8a908c4951f2717455c8c)
---
src/virtManager/packageutils.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/virtManager/packageutils.py b/src/virtManager/packageutils.py
index 6478360..736b98c 100644
--- a/src/virtManager/packageutils.py
+++ b/src/virtManager/packageutils.py
@@ -135,7 +135,15 @@ def packagekit_install(package_list):
timeout=timeout)
def packagekit_search(session, pk_control, package_name, packages):
- tid = pk_control.GetTid()
+ newstyle = False
+ try:
+ tid = pk_control.GetTid()
+ except dbus.exceptions.DBusException, e:
+ if e.get_dbus_name() != "org.freedesktop.DBus.Error.UnknownMethod":
+ raise
+ newstyle = True
+ tid = pk_control.CreateTransaction()
+
pk_trans = dbus.Interface(
session.get_object("org.freedesktop.PackageKit", tid),
"org.freedesktop.PackageKit.Transaction")
@@ -160,7 +168,10 @@ def packagekit_search(session, pk_control, package_name, packages):
pk_trans.connect_to_signal('ErrorCode', error)
pk_trans.connect_to_signal('Package', package)
try:
- pk_trans.SearchNames("installed", [package_name])
+ searchtype = "installed"
+ if newstyle:
+ searchtype = 2 ** 2
+ pk_trans.SearchNames(searchtype, [package_name])
except dbus.exceptions.DBusException, e:
if e.get_dbus_name() != "org.freedesktop.DBus.Error.UnknownMethod":
raise
--
1.7.12.1

View File

@ -0,0 +1,69 @@
From b8d61f6602f82b6e90199d9ce430f9eebb1c894a Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sun, 28 Oct 2012 20:18:51 -0400
Subject: [PATCH] Fix detection of running libvirtd via systemd (cherry picked
from commit 2163ba3a3035ea8fccd5113d53d120801ba12040)
---
src/virtManager/engine.py | 6 ++++--
src/virtManager/packageutils.py | 5 ++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/virtManager/engine.py b/src/virtManager/engine.py
index 337fc67..2ec455b 100644
--- a/src/virtManager/engine.py
+++ b/src/virtManager/engine.py
@@ -178,8 +178,11 @@ class vmmEngine(vmmGObject):
manager.set_startup_error(msg)
return
+ do_start = not did_install_libvirt
if did_install_libvirt:
didstart = packageutils.start_libvirtd()
+ do_start = didstart
+
warnmsg = _(
"Libvirt was just installed, so the 'libvirtd' service will\n"
"will need to be started.\n"
@@ -189,8 +192,7 @@ class vmmEngine(vmmGObject):
if not didstart:
self.err.ok(_("Libvirt service must be started"), warnmsg)
- self.connect_to_uri(tryuri, autoconnect=True,
- do_start=not did_install_libvirt)
+ self.connect_to_uri(tryuri, autoconnect=True, do_start=do_start)
def load_stored_uris(self):
diff --git a/src/virtManager/packageutils.py b/src/virtManager/packageutils.py
index 736b98c..63cf2b5 100644
--- a/src/virtManager/packageutils.py
+++ b/src/virtManager/packageutils.py
@@ -217,7 +217,7 @@ def start_libvirtd():
state = props.Get("org.freedesktop.systemd1.Unit", "ActiveState")
logging.debug("libvirtd state=%s", state)
- if state == "Active":
+ if str(state).lower() == "active":
logging.debug("libvirtd already active, not starting")
return True
except:
@@ -226,12 +226,15 @@ def start_libvirtd():
# Connect to system-config-services and offer to start
try:
+ logging.debug("libvirtd not running, asking system-config-services "
+ "to start it")
scs = dbus.Interface(bus.get_object(
"org.fedoraproject.Config.Services",
"/org/fedoraproject/Config/Services/systemd1"),
"org.freedesktop.systemd1.Manager")
scs.StartUnit(unitname, "replace")
time.sleep(2)
+ logging.debug("Starting libvirtd appeared to succeed")
return True
except:
logging.exception("Failed to talk to system-config-services")
--
1.7.12.1

View File

@ -0,0 +1,45 @@
From f55c0cefba2a71d4e44003802ac4ca59db0542ad Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 29 Oct 2012 18:55:51 -0400
Subject: [PATCH] domain: Fix more backtraces from PMSUSPEND status (cherry
picked from commit
538420e03239da7870b5b051c043072109f68fda)
---
src/virtManager/domain.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
index d536f77..56087b4 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -1389,6 +1389,8 @@ class vmmDomain(vmmLibvirtObject):
elif (hasattr(libvirt, "VIR_DOMAIN_PMSUSPENDED") and
status == libvirt.VIR_DOMAIN_PMSUSPENDED):
return _("Suspended")
+
+ logging.debug("Unknown status %d, returning 'Unknown'")
return _("Unknown")
def _normalize_status(self, status):
@@ -1429,9 +1431,16 @@ class vmmDomain(vmmLibvirtObject):
libvirt.VIR_DOMAIN_SHUTDOWN: "state_shutoff",
libvirt.VIR_DOMAIN_SHUTOFF: "state_shutoff",
libvirt.VIR_DOMAIN_NOSTATE: "state_running",
+ # VIR_DOMAIN_PMSUSPENDED
+ 7: "state_paused",
}
- return status_icons[self.status()]
+ status = self.status()
+ if status not in status_icons:
+ logging.debug("Unknown status %d, using NOSTATE")
+ status = libvirt.VIR_DOMAIN_NOSTATE
+
+ return status_icons[status]
def force_update_status(self):
"""
--
1.7.12.1

View File

@ -2,7 +2,7 @@
%define _package virt-manager %define _package virt-manager
%define _version 0.9.4 %define _version 0.9.4
%define _release 2 %define _release 3
%define virtinst_version 0.600.3 %define virtinst_version 0.600.3
%define qemu_user "qemu" %define qemu_user "qemu"
@ -47,6 +47,11 @@ Patch1: 0001-virt-manager-Fix-KVM_PACKAGES-substitution-variable.patch
Patch2: 0002-domain-Handle-PMSUSPENDED-status.patch Patch2: 0002-domain-Handle-PMSUSPENDED-status.patch
# Fix 'browse local' behavior when choosing directory (bz #855335) # Fix 'browse local' behavior when choosing directory (bz #855335)
Patch3: 0003-browse_local-Fix-choosing-directory-of-F17.patch Patch3: 0003-browse_local-Fix-choosing-directory-of-F17.patch
# Fix first run packagekit interaction (bz 870851)
Patch4: 0004-Fix-package-install-with-PackageKit-0.8.4.patch
Patch5: 0005-Fix-detection-of-running-libvirtd-via-systemd.patch
# Fix another backtrace if guest is pmsuspended (bz 871237)
Patch6: 0006-domain-Fix-more-backtraces-from-PMSUSPEND-status.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch BuildArch: noarch
@ -148,6 +153,9 @@ Common files used by the different Virtual Machine Manager interfaces.
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build %build
%if %{qemu_user} %if %{qemu_user}
@ -270,6 +278,10 @@ update-desktop-database -q %{_datadir}/applications
%endif %endif
%changelog %changelog
* Tue Oct 30 2012 Cole Robinson <crobinso@redhat.com> - 0.9.4-3
- Fix first run packagekit interaction (bz #870851)
- Fix another backtrace if guest is pmsuspended (bz #871237)
* Wed Oct 24 2012 Cole Robinson <crobinso@redhat.com> - 0.9.4-2 * Wed Oct 24 2012 Cole Robinson <crobinso@redhat.com> - 0.9.4-2
- Fix KVM package install on app first run - Fix KVM package install on app first run
- Fix listing domain with 'suspended' state (bz #850954) - Fix listing domain with 'suspended' state (bz #850954)