Use correct KVM package names on first run (bz #873878)

network: fix parsing ip blocks with prefix= (bz #872814)
Don't recommend all of libvirt, just the kvm bits (bz #872246)
This commit is contained in:
Cole Robinson 2012-12-17 14:55:20 -05:00
parent ce88c8945e
commit 2184a94698
5 changed files with 212 additions and 2 deletions

View File

@ -0,0 +1,96 @@
From 29ffac229ae7036dc238262d5e733a850b233329 Mon Sep 17 00:00:00 2001
Message-Id: <29ffac229ae7036dc238262d5e733a850b233329.1355706113.git.crobinso@redhat.com>
In-Reply-To: <30282a17091014ba5a96d20f4260df55779933c4.1355706113.git.crobinso@redhat.com>
References: <30282a17091014ba5a96d20f4260df55779933c4.1355706113.git.crobinso@redhat.com>
From: Cole Robinson <crobinso@redhat.com>
Date: Sun, 28 Oct 2012 18:49:48 -0400
Subject: [PATCH 7/8] Add hidden --test-first-run switch for testing PackageKit
bits
Basically stubs out the gconf URI fetching + listing so we don't
need to delete anything to trigger it.
(cherry picked from commit 96ce9ac0b1257b66d0075c12aa572afe21eae0b0)
Conflicts:
src/virt-manager.py.in
---
src/virt-manager.py.in | 8 +++++++-
src/virtManager/config.py | 11 ++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/virt-manager.py.in b/src/virt-manager.py.in
index 1f93d22..0cac2c2 100755
--- a/src/virt-manager.py.in
+++ b/src/virt-manager.py.in
@@ -117,6 +117,11 @@ def parse_commandline():
optParser.add_option("--profile", dest="profile",
help=optparse.SUPPRESS_HELP, metavar="FILE")
+ # Don't load any connections on startup to test first run
+ # PackageKit integration
+ optParser.add_option("--test-first-run", dest="testfirstrun",
+ help=optparse.SUPPRESS_HELP, action="store_true")
+
optParser.add_option("-c", "--connect", dest="uri",
help="Connect to hypervisor at URI", metavar="URI")
optParser.add_option("--debug", action="store_true", dest="debug",
@@ -318,7 +323,8 @@ def main():
# display access
import virtManager.config
import virtManager.util
- config = virtManager.config.vmmConfig(appname, appversion, ui_dir)
+ config = virtManager.config.vmmConfig(appname, appversion, ui_dir,
+ options.test_first_run)
virtManager.util.running_config = config
config.default_qemu_user = default_qemu_user
config.rhel6_defaults = rhel_enable_unsupported_opts
diff --git a/src/virtManager/config.py b/src/virtManager/config.py
index 63cbc15..508fea0 100644
--- a/src/virtManager/config.py
+++ b/src/virtManager/config.py
@@ -88,11 +88,12 @@ class vmmConfig(object):
DEFAULT_VIRT_IMAGE_DIR = "/var/lib/libvirt/images"
DEFAULT_VIRT_SAVE_DIR = "/var/lib/libvirt"
- def __init__(self, appname, appversion, ui_dir):
+ def __init__(self, appname, appversion, ui_dir, test_first_run=False):
self.appname = appname
self.appversion = appversion
self.conf_dir = "/apps/" + appname
self.ui_dir = ui_dir
+ self.test_first_run = bool(test_first_run)
self.conf = gconf.client_get_default()
self.conf.add_dir(self.conf_dir, gconf.CLIENT_PRELOAD_NONE)
@@ -590,6 +591,9 @@ class vmmConfig(object):
# Manager view connection list
def add_conn(self, uri):
+ if self.test_first_run:
+ return
+
uris = self.conf.get_list(self.conf_dir + "/connections/uris",
gconf.VALUE_STRING)
if uris == None:
@@ -619,6 +623,8 @@ class vmmConfig(object):
gconf.VALUE_STRING, uris)
def get_conn_uris(self):
+ if self.test_first_run:
+ return []
return self.conf.get_list(self.conf_dir + "/connections/uris",
gconf.VALUE_STRING)
@@ -638,6 +644,9 @@ class vmmConfig(object):
return ((uris is not None) and (uri in uris))
def set_conn_autoconnect(self, uri, val):
+ if self.test_first_run:
+ return
+
uris = self.conf.get_list(self.conf_dir + "/connections/autoconnect",
gconf.VALUE_STRING)
if uris is None:
--
1.8.0.2

View File

@ -0,0 +1,37 @@
From a00bcce0a0d3a5af85dbf685aefec5495349328f Mon Sep 17 00:00:00 2001
Message-Id: <a00bcce0a0d3a5af85dbf685aefec5495349328f.1355706113.git.crobinso@redhat.com>
In-Reply-To: <30282a17091014ba5a96d20f4260df55779933c4.1355706113.git.crobinso@redhat.com>
References: <30282a17091014ba5a96d20f4260df55779933c4.1355706113.git.crobinso@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 30 Oct 2012 14:22:44 +0100
Subject: [PATCH 8/8] Fix --test-first-run
One of previous patches (96ce9ac0b125) invented this feature. However,
in options object it is called testfirstrun not test_first_run.
This produces a runtime error.
(crobinso: add Michal to AUTHORS)
(cherry picked from commit d9e8546e8608d0fd0b6af61e9a2236c91b286cdd)
Conflicts:
AUTHORS
---
src/virt-manager.py.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/virt-manager.py.in b/src/virt-manager.py.in
index 0cac2c2..f01c476 100755
--- a/src/virt-manager.py.in
+++ b/src/virt-manager.py.in
@@ -324,7 +324,7 @@ def main():
import virtManager.config
import virtManager.util
config = virtManager.config.vmmConfig(appname, appversion, ui_dir,
- options.test_first_run)
+ options.testfirstrun)
virtManager.util.running_config = config
config.default_qemu_user = default_qemu_user
config.rhel6_defaults = rhel_enable_unsupported_opts
--
1.8.0.2

View File

@ -0,0 +1,13 @@
diff --git a/src/Makefile.in b/src/Makefile.in
index f3d53be..92a536e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -814,7 +814,7 @@ uninstall-am: uninstall-binSCRIPTS uninstall-dbusDATA \
-e "s,::DEFAULT_QEMU_USER::,$(DEFAULT_QEMU_USER)," \
-e "s,::ENABLE_UNSUPPORTED_RHEL_OPTS::,$(ENABLE_UNSUPPORTED_RHEL_OPTS)," \
-e "s|::PREFERRED_DISTROS::|$(PREFERRED_DISTROS)|" \
- -e "s|::HV_PACKAGES::|$(KVM_PACKAGES)|" \
+ -e "s|::KVM_PACKAGES::|$(KVM_PACKAGES)|" \
-e "s|::ASKPASS_PACKAGE::|$(ASKPASS_PACKAGE)|" \
-e "s|::LIBVIRT_PACKAGES::|$(LIBVIRT_PACKAGES)|" \
< $< > $@

View File

@ -0,0 +1,49 @@
From 820f78af13b564600d600a199d6ef30aecde620e Mon Sep 17 00:00:00 2001
Message-Id: <820f78af13b564600d600a199d6ef30aecde620e.1355773837.git.crobinso@redhat.com>
In-Reply-To: <8bfad3a2cc1c83e8d0f04f232b0ebe0847fd6bca.1355773837.git.crobinso@redhat.com>
References: <8bfad3a2cc1c83e8d0f04f232b0ebe0847fd6bca.1355773837.git.crobinso@redhat.com>
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 17 Dec 2012 14:48:42 -0500
Subject: [PATCH 10/10] network: Fix parsing <ip> blocks with prefix=
https://bugzilla.redhat.com/show_bug.cgi?id=872814
(cherry picked from commit 32f74219b024ddbd6fac5301c58e27540541d569)
---
src/virtManager/network.py | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/virtManager/network.py b/src/virtManager/network.py
index ae89955..fa3e6ea 100644
--- a/src/virtManager/network.py
+++ b/src/virtManager/network.py
@@ -101,12 +101,22 @@ class vmmNetwork(vmmLibvirtObject):
return None
addrStr = util.xpath(xml, "/network/ip/@address")
netmaskStr = util.xpath(xml, "/network/ip/@netmask")
+ prefix = util.xpath(xml, "/network/ip/@prefix")
+
+ if prefix:
+ prefix = int(prefix)
+ binstr = ((prefix * "1") + ((32 - prefix) * "0"))
+ netmaskStr = str(IP(int(binstr, base=2)))
+
+ if netmaskStr:
+ netmask = IP(netmaskStr)
+ gateway = IP(addrStr)
+ network = IP(gateway.int() & netmask.int())
+ ret = IP(str(network) + "/" + netmaskStr)
+ else:
+ ret = IP(str(addrStr))
- netmask = IP(netmaskStr)
- gateway = IP(addrStr)
-
- network = IP(gateway.int() & netmask.int())
- return IP(str(network) + "/" + netmaskStr)
+ return ret
def get_ipv4_forward(self):
xml = self.get_xml()
--
1.8.0.2

View File

@ -2,13 +2,13 @@
%define _package virt-manager
%define _version 0.9.4
%define _release 3
%define _release 4
%define virtinst_version 0.600.3
%define qemu_user "qemu"
%define preferred_distros "fedora,rhel"
%define kvm_packages "qemu-system-x86"
%define libvirt_packages "libvirt"
%define libvirt_packages "libvirt-daemon-qemu"
%define askpass_package "openssh-askpass"
%define disable_unsupported_rhel 0
@ -52,6 +52,12 @@ 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
# Use correct KVM package names on first run (bz 873878)
Patch7: 0007-Add-hidden-test-first-run-switch-for-testing-Package.patch
Patch8: 0008-Fix-test-first-run.patch
Patch9: 0009-really-fix-kvm-substitution.patch
# network: fix parsing ip blocks with prefix= (bz 872814)
Patch10: 0010-network-Fix-parsing-ip-blocks-with-prefix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@ -156,6 +162,10 @@ Common files used by the different Virtual Machine Manager interfaces.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
%if %{qemu_user}
@ -278,6 +288,11 @@ update-desktop-database -q %{_datadir}/applications
%endif
%changelog
* Mon Dec 17 2012 Cole Robinson <crobinso@redhat.com> - 0.9.4-4
- Use correct KVM package names on first run (bz #873878)
- network: fix parsing ip blocks with prefix= (bz #872814)
- Don't recommend all of libvirt, just the kvm bits (bz #872246)
* 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)