From 192ee79c50d602bde4921de734c0326b282e57bf Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Feb 18 2014 22:48:30 +0000 Subject: Fix open connection->lxc Fix issues creating ppc64 guests Fix generating disk targets from customize->addhw --- diff --git a/0001-connect-Fix-connecting-to-lxc-URI.patch b/0001-connect-Fix-connecting-to-lxc-URI.patch new file mode 100644 index 0000000..a330eb2 --- /dev/null +++ b/0001-connect-Fix-connecting-to-lxc-URI.patch @@ -0,0 +1,23 @@ +From 3aef95607e3462f6f738a1bad24c4ccfb615997c Mon Sep 17 00:00:00 2001 +From: Cole Robinson +Date: Mon, 17 Feb 2014 10:22:24 -0500 +Subject: [PATCH] connect: Fix connecting to lxc:/// URI + +(cherry picked from commit 0169042c1ee45fed779fc106476fc98265236651) +--- + virtManager/connect.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/virtManager/connect.py b/virtManager/connect.py +index 7cd4da7..1247d75 100644 +--- a/virtManager/connect.py ++++ b/virtManager/connect.py +@@ -364,7 +364,7 @@ class vmmConnect(vmmGObjectUI): + hvstr = "" + if hv == HV_XEN: + hvstr = "xen" +- elif hv == HV_QEMU or HV_QEMU_SESSION: ++ elif hv == HV_QEMU or hv == HV_QEMU_SESSION: + hvstr = "qemu" + else: + hvstr = "lxc" diff --git a/0002-create-Fix-non-x86-qemu-kvm-guest-creation.patch b/0002-create-Fix-non-x86-qemu-kvm-guest-creation.patch new file mode 100644 index 0000000..42bfb18 --- /dev/null +++ b/0002-create-Fix-non-x86-qemu-kvm-guest-creation.patch @@ -0,0 +1,24 @@ +From f52e2a1d383121e71791f72a7172b98016bb5884 Mon Sep 17 00:00:00 2001 +From: Cole Robinson +Date: Mon, 17 Feb 2014 10:24:41 -0500 +Subject: [PATCH] create: Fix non-x86 qemu/kvm guest creation + +(cherry picked from commit a37b200f69347922800d58342968307b74ec9ded) +--- + virtManager/create.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/virtManager/create.py b/virtManager/create.py +index d8e68c3..f1c57b7 100644 +--- a/virtManager/create.py ++++ b/virtManager/create.py +@@ -1376,7 +1376,8 @@ class vmmCreate(vmmGObjectUI): + + guest.add_default_devices() + +- if self.conn.check_support(self.conn.SUPPORT_CONN_PM_DISABLE): ++ if (guest.os.is_x86() and ++ self.conn.check_support(self.conn.SUPPORT_CONN_PM_DISABLE)): + guest.pm.suspend_to_mem = False + guest.pm.suspend_to_disk = False + diff --git a/0003-caps-Simplify-guest-lookup-routines.patch b/0003-caps-Simplify-guest-lookup-routines.patch new file mode 100644 index 0000000..e965a5e --- /dev/null +++ b/0003-caps-Simplify-guest-lookup-routines.patch @@ -0,0 +1,497 @@ +From 12c4a54a92f935abceb358a8d7ba8f391597f014 Mon Sep 17 00:00:00 2001 +From: Cole Robinson +Date: Mon, 17 Feb 2014 11:43:53 -0500 +Subject: [PATCH] caps: Simplify guest lookup routines + +Checking for acceleration should always be done, API users can opt out +by requesting a specific domain type. + +(cherry picked from commit 63b27ceae1e5a1521b968deb7e04d1a5ebd3de39) +--- + .../compare/virt-convert-ovf-compare.xml | 7 +++- + .../compare/virt-convert-vmx-compare.xml | 7 +++- + .../ovf2libvirt_ovf_directory.libvirt | 7 +++- + .../libvirt_output/ovf2libvirt_test1.libvirt | 7 +++- + .../ovf2libvirt_test1.libvirt.disk_qcow2 | 7 +++- + .../libvirt_output/ovf2libvirt_test2.libvirt | 7 +++- + .../vmx2libvirt_test-vmx-zip.libvirt | 7 +++- + .../libvirt_output/vmx2libvirt_test1.libvirt | 7 +++- + .../vmx2libvirt_test1.libvirt.disk_raw | 7 +++- + .../libvirt_output/vmx2libvirt_vmx-dir.libvirt | 7 +++- + virt-install | 3 -- + virtManager/create.py | 4 +- + virtinst/capabilities.py | 49 +++++----------------- + virtinst/virtimage.py | 9 +--- + 14 files changed, 63 insertions(+), 72 deletions(-) + +diff --git a/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml b/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml +index c073ffc..a1d2f75 100644 +--- a/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml ++++ b/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml +@@ -1,6 +1,6 @@ + Copying test.ovf-disk1.vmdk to /tmp/test.ovf-disk1 + Copying testfile to /tmp/testfile +- ++ + test.ovf + 00000000-1111-2222-3333-444444444444 + This is the description, created by RWMJ. +@@ -16,6 +16,9 @@ Copying testfile to /tmp/testfile + + + ++ ++ core2duo ++ + + + +@@ -25,7 +28,7 @@ Copying testfile to /tmp/testfile + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml b/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml +index 20f046d..ffe7b59 100644 +--- a/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml ++++ b/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml +@@ -1,5 +1,5 @@ + Running /usr/bin/qemu-img convert -O qcow2 fedora.vmdk /var/lib/libvirt/images/fedora.qcow2 +- ++ + fedora + 00000000-1111-2222-3333-444444444444 + 524288 +@@ -14,6 +14,9 @@ Running /usr/bin/qemu-img convert -O qcow2 fedora.vmdk /var/lib/libvirt/images/f + + + ++ ++ core2duo ++ + + + +@@ -23,7 +26,7 @@ Running /usr/bin/qemu-img convert -O qcow2 fedora.vmdk /var/lib/libvirt/images/f + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt +index c88c140..597a0c5 100644 +--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt ++++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt +@@ -1,4 +1,4 @@ +- ++ + CentOS-6.4-i386-Gnome.ovf + 00000000-1111-2222-3333-444444444444 + 524288 +@@ -13,6 +13,9 @@ + + + ++ ++ core2duo ++ + + + +@@ -22,7 +25,7 @@ + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt +index 22978ca..83c3f90 100644 +--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt ++++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt +@@ -1,4 +1,4 @@ +- ++ + test.ovf + 00000000-1111-2222-3333-444444444444 + This is the description, created by RWMJ. +@@ -14,6 +14,9 @@ + + + ++ ++ core2duo ++ + + + +@@ -23,7 +26,7 @@ + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2 b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2 +index d86ced0..1b50422 100644 +--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2 ++++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2 +@@ -1,4 +1,4 @@ +- ++ + test.ovf + 00000000-1111-2222-3333-444444444444 + This is the description, created by RWMJ. +@@ -14,6 +14,9 @@ + + + ++ ++ core2duo ++ + + + +@@ -23,7 +26,7 @@ + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt +index aa0303e..9d28269 100644 +--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt ++++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt +@@ -1,4 +1,4 @@ +- ++ + w2k3_32bit + 00000000-1111-2222-3333-444444444444 + Description added by RWMJ. +@@ -14,6 +14,9 @@ + + + ++ ++ core2duo ++ + + + +@@ -23,7 +26,7 @@ + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test-vmx-zip.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_test-vmx-zip.libvirt +index 179978b..9e2058f 100644 +--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test-vmx-zip.libvirt ++++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test-vmx-zip.libvirt +@@ -1,4 +1,4 @@ +- ++ + minix + 00000000-1111-2222-3333-444444444444 + 204800 +@@ -14,6 +14,9 @@ + + + ++ ++ core2duo ++ + + + +@@ -23,7 +26,7 @@ + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt +index 1ff4eec..a6fc259 100644 +--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt ++++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt +@@ -1,4 +1,4 @@ +- ++ + fedora + 00000000-1111-2222-3333-444444444444 + 524288 +@@ -13,6 +13,9 @@ + + + ++ ++ core2duo ++ + + + +@@ -22,7 +25,7 @@ + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw +index 2abd1e2..9c3d6e2 100644 +--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw ++++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw +@@ -1,4 +1,4 @@ +- ++ + fedora + 00000000-1111-2222-3333-444444444444 + 524288 +@@ -13,6 +13,9 @@ + + + ++ ++ core2duo ++ + + + +@@ -22,7 +25,7 @@ + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt +index 7887f36..74f3541 100644 +--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt ++++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt +@@ -1,4 +1,4 @@ +- ++ + esx4.0-rhel4.8-i386 + 00000000-1111-2222-3333-444444444444 + 524288 +@@ -14,6 +14,9 @@ + + + ++ ++ core2duo ++ + + + +@@ -23,7 +26,7 @@ + restart + restart + +- /usr/bin/qemu-system-x86_64 ++ /usr/bin/qemu-kvm + + + +diff --git a/virt-install b/virt-install +index 6453f77..a801952 100755 +--- a/virt-install ++++ b/virt-install +@@ -177,7 +177,6 @@ def get_guest(conn, options): + options.container]]) > 1: + fail(_("Can't do more than one of --hvm, --paravirt, or --container")) + +- req_accel = True + req_hv_type = options.hv_type and options.hv_type.lower() or None + if options.fullvirt: + req_virt_type = "hvm" +@@ -203,7 +202,6 @@ def get_guest(conn, options): + os_type=req_virt_type, + arch=arch, + typ=req_hv_type, +- accelerated=req_accel, + machine=options.machine) + guest = conn.caps.build_virtinst_guest(conn, capsguest, capsdomain) + guest.os.machine = options.machine +@@ -212,7 +210,6 @@ def get_guest(conn, options): + + if (not req_virt_type and + not req_hv_type and +- req_accel and + conn.is_qemu() and + capsguest.arch in ["i686", "x86_64"] and + not capsdomain.is_accelerated()): +diff --git a/virtManager/create.py b/virtManager/create.py +index f1c57b7..2af62c4 100644 +--- a/virtManager/create.py ++++ b/virtManager/create.py +@@ -858,9 +858,7 @@ class vmmCreate(vmmGObjectUI): + gtype = "hvm" + break + +- (newg, newdom) = self.caps.guest_lookup(os_type=gtype, +- accelerated=True, +- arch=arch) ++ (newg, newdom) = self.caps.guest_lookup(os_type=gtype, arch=arch) + + if (self.capsguest and self.capsdomain and + (newg.arch == self.capsguest.arch and +diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py +index c55f67d..b8d3330 100644 +--- a/virtinst/capabilities.py ++++ b/virtinst/capabilities.py +@@ -345,18 +345,15 @@ class Guest(object): + + child = child.next + +- def _favoredDomain(self, accelerated, domains): ++ def _favoredDomain(self, domains): + """ + Return the recommended domain for use if the user does not explicitly + request one. + """ +- if accelerated is None: +- # Picking last in list so we favour KVM/KQEMU over QEMU +- return domains[-1] ++ if not domains: ++ return None + + priority = ["kvm", "xen", "kqemu", "qemu"] +- if not accelerated: +- priority.reverse() + + for t in priority: + for d in domains: +@@ -366,7 +363,7 @@ class Guest(object): + # Fallback, just return last item in list + return domains[-1] + +- def bestDomainType(self, accelerated=None, dtype=None, machine=None): ++ def bestDomainType(self, dtype=None, machine=None): + domains = [] + for d in self.domains: + if dtype and d.hypervisor_type != dtype.lower(): +@@ -375,22 +372,7 @@ class Guest(object): + continue + domains.append(d) + +- if len(domains) == 0: +- domainerr = "" +- machineerr = "" +- if dtype: +- domainerr = _(", domain type '%s'") % dtype +- if machine: +- machineerr = _(", machine type '%s'") % machine +- +- error = (_("No domains available for virt type '%(type)s', " +- "arch '%(arch)s'") % +- {'type': self.os_type, 'arch': self.arch}) +- error += domainerr +- error += machineerr +- raise RuntimeError(error) +- +- return self._favoredDomain(accelerated, domains) ++ return self._favoredDomain(domains) + + + class Domain(object): +@@ -621,7 +603,7 @@ class Capabilities(object): + return True + return False + +- def guestForOSType(self, typ=None, arch=None): ++ def _guestForOSType(self, typ=None, arch=None): + if self.host is None: + return None + +@@ -652,8 +634,7 @@ class Capabilities(object): + return self._cpu_values.get_arch(arch) + + +- def guest_lookup(self, os_type=None, arch=None, typ=None, +- accelerated=False, machine=None): ++ def guest_lookup(self, os_type=None, arch=None, typ=None, machine=None): + """ + Simple virtualization availability lookup + +@@ -671,20 +652,13 @@ class Capabilities(object): + not found. + + @param typ: Virtualization type ('hvm', 'xen', ...) +- @type typ: C{str} + @param arch: Guest architecture ('x86_64', 'i686' ...) +- @type arch: C{str} + @param os_type: Hypervisor name ('qemu', 'kvm', 'xen', ...) +- @type os_type: C{str} +- @param accelerated: Whether to look for accelerated domain if none is +- specifically requested +- @type accelerated: C{bool} + @param machine: Optional machine type to emulate +- @type machine: C{str} + + @returns: A (Capabilities Guest, Capabilities Domain) tuple + """ +- guest = self.guestForOSType(os_type, arch) ++ guest = self._guestForOSType(os_type, arch) + if not guest: + archstr = _("for arch '%s'") % arch + if not arch: +@@ -697,12 +671,9 @@ class Capabilities(object): + raise ValueError(_("Host does not support %(virttype)s %(arch)s") % + {'virttype' : osstr, 'arch' : archstr}) + +- domain = guest.bestDomainType(accelerated=accelerated, +- dtype=typ, +- machine=machine) +- ++ domain = guest.bestDomainType(dtype=typ, machine=machine) + if domain is None: +- machinestr = "with machine '%s'" % machine ++ machinestr = " with machine '%s'" % machine + if not machine: + machinestr = "" + raise ValueError(_("Host does not support domain type %(domain)s" +diff --git a/virtinst/virtimage.py b/virtinst/virtimage.py +index 44c5640..c09428b 100644 +--- a/virtinst/virtimage.py ++++ b/virtinst/virtimage.py +@@ -348,13 +348,8 @@ class ImageInstaller(Installer): + self._boot_caps = image.domain.boots[boot_index] + + # Set up internal caps.guest object +- self._guest = self.conn.caps.guestForOSType(self.boot_caps.type, +- self.boot_caps.arch) +- if self._guest is None: +- raise RuntimeError(_("Unsupported virtualization type: %s %s" % +- (self.boot_caps.type, self.boot_caps.arch))) +- self._domain = self._guest.bestDomainType() +- ++ self._guest, self._domain = self.conn.caps.guest_lookup( ++ os_type=self.boot_caps.type, arch=self.boot_caps.arch) + + + # Custom ImageInstaller methods diff --git a/0004-create-Don-t-alter-caps-machine-list.patch b/0004-create-Don-t-alter-caps-machine-list.patch new file mode 100644 index 0000000..0e8755e --- /dev/null +++ b/0004-create-Don-t-alter-caps-machine-list.patch @@ -0,0 +1,23 @@ +From 5cfcaad802ec9ab0024297b1e94ce1058e5b629b Mon Sep 17 00:00:00 2001 +From: Cole Robinson +Date: Mon, 17 Feb 2014 11:56:54 -0500 +Subject: [PATCH] create: Don't alter caps machine list + +(cherry picked from commit 7c516b382cbb94c2ecafb07baedae19b8d1a2b67) +--- + virtManager/create.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/virtManager/create.py b/virtManager/create.py +index 2af62c4..b4b1dfe 100644 +--- a/virtManager/create.py ++++ b/virtManager/create.py +@@ -689,7 +689,7 @@ class vmmCreate(vmmGObjectUI): + model = lst.get_model() + model.clear() + +- machines = self.capsdomain.machines ++ machines = self.capsdomain.machines[:] + if self.capsguest.arch in ["i686", "x86_64"]: + machines = [] + machines.sort() diff --git a/virt-manager.spec b/virt-manager.spec index ced336d..f4ca564 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -20,7 +20,7 @@ %define _version 1.0.0 -%define _release 1 +%define _release 2 # This macro is used for the continuous automated builds. It just @@ -39,6 +39,14 @@ Group: Applications/Emulators License: GPLv2+ URL: http://virt-manager.org/ Source0: http://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz + +# Fix open connection->lxc +Patch0001: 0001-connect-Fix-connecting-to-lxc-URI.patch +# Fix issues creating ppc64 guests +Patch0002: 0002-create-Fix-non-x86-qemu-kvm-guest-creation.patch +Patch0003: 0003-caps-Simplify-guest-lookup-routines.patch +# Fix generating disk targets from customize->addhw +Patch0004: 0004-create-Don-t-alter-caps-machine-list.patch BuildArch: noarch @@ -105,6 +113,14 @@ machine). %prep %setup -q +# Fix open connection->lxc +%patch0001 -p1 +# Fix issues creating ppc64 guests +%patch0002 -p1 +%patch0003 -p1 +# Fix generating disk targets from customize->addhw +%patch0004 -p1 + %build %if %{qemu_user} %define _qemu_user --qemu-user=%{qemu_user} @@ -213,6 +229,11 @@ fi %changelog +* Tue Feb 18 2014 Cole Robinson - 1.0.0-2 +- Fix open connection->lxc +- Fix issues creating ppc64 guests +- Fix generating disk targets from customize->addhw + * Fri Feb 14 2014 Cole Robinson - 1.0.0-1 - Rebased to version 1.0.0 - New tool virt-xml: Edit libvirt XML in one shot from the command line