From 2184a9469872595237e125500d927f7a196bc5ff Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 17 Dec 2012 14:55:20 -0500 Subject: [PATCH] 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) --- ...first-run-switch-for-testing-Package.patch | 96 +++++++++++++++++++ 0008-Fix-test-first-run.patch | 37 +++++++ 0009-really-fix-kvm-substitution.patch | 13 +++ ...rk-Fix-parsing-ip-blocks-with-prefix.patch | 49 ++++++++++ virt-manager.spec | 19 +++- 5 files changed, 212 insertions(+), 2 deletions(-) create mode 100644 0007-Add-hidden-test-first-run-switch-for-testing-Package.patch create mode 100644 0008-Fix-test-first-run.patch create mode 100644 0009-really-fix-kvm-substitution.patch create mode 100644 0010-network-Fix-parsing-ip-blocks-with-prefix.patch diff --git a/0007-Add-hidden-test-first-run-switch-for-testing-Package.patch b/0007-Add-hidden-test-first-run-switch-for-testing-Package.patch new file mode 100644 index 0000000..c32aa14 --- /dev/null +++ b/0007-Add-hidden-test-first-run-switch-for-testing-Package.patch @@ -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 +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 + diff --git a/0008-Fix-test-first-run.patch b/0008-Fix-test-first-run.patch new file mode 100644 index 0000000..5a88553 --- /dev/null +++ b/0008-Fix-test-first-run.patch @@ -0,0 +1,37 @@ +From a00bcce0a0d3a5af85dbf685aefec5495349328f Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <30282a17091014ba5a96d20f4260df55779933c4.1355706113.git.crobinso@redhat.com> +References: <30282a17091014ba5a96d20f4260df55779933c4.1355706113.git.crobinso@redhat.com> +From: Michal Privoznik +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 + diff --git a/0009-really-fix-kvm-substitution.patch b/0009-really-fix-kvm-substitution.patch new file mode 100644 index 0000000..34f1996 --- /dev/null +++ b/0009-really-fix-kvm-substitution.patch @@ -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)|" \ + < $< > $@ diff --git a/0010-network-Fix-parsing-ip-blocks-with-prefix.patch b/0010-network-Fix-parsing-ip-blocks-with-prefix.patch new file mode 100644 index 0000000..ac4a94d --- /dev/null +++ b/0010-network-Fix-parsing-ip-blocks-with-prefix.patch @@ -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 +Date: Mon, 17 Dec 2012 14:48:42 -0500 +Subject: [PATCH 10/10] network: Fix parsing 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 + diff --git a/virt-manager.spec b/virt-manager.spec index cae3866..e86d62c 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -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 - 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 - 0.9.4-3 - Fix first run packagekit interaction (bz #870851) - Fix another backtrace if guest is pmsuspended (bz #871237)