From 3e9f524c14b2d3e904b17115c5df84dc3a034dad Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sep 27 2011 17:50:33 +0000 Subject: virt-install: Fix --initrd-inject Fix changing disk bus in virt-manager Fix remote URL installs as root --- diff --git a/python-virtinst.spec b/python-virtinst.spec index cbf861e..b988309 100644 --- a/python-virtinst.spec +++ b/python-virtinst.spec @@ -1,7 +1,7 @@ # -*- rpm-spec -*- %define _version 0.600.0 -%define _release 3 +%define _release 4 %define with_rhel6_defaults 0 %define with_selinux 1 @@ -38,6 +38,12 @@ Patch1: %{appname}-fix-po-install.patch Patch2: %{appname}-catch-version-errs.patch # Regenerate outdated man pages Patch3: %{appname}-regenerate-man-pages.patch +# virt-install: Fix --initrd-inject +Patch4: %{appname}-fix-initrd-inject.patch +# Fix changing disk bus in virt-manager +Patch5: %{appname}-fix-vmm-disk-bus.patch +# Fix remote URL installs as root +Patch6: %{appname}-fix-remote-url.patch License: GPLv2+ Group: Development/Libraries @@ -67,6 +73,9 @@ and install new VMs) and virt-clone (clone an existing virtual machine). %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build %if %{with_rhel6_defaults} @@ -104,6 +113,11 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/virt-convert %changelog +* Tue Sep 27 2011 Cole Robinson - 0.600.0-4 +- virt-install: Fix --initrd-inject +- Fix changing disk bus in virt-manager +- Fix remote URL installs as root + * Tue Aug 02 2011 Cole Robinson - 0.600.0-3 - Regenerate outdated man pages diff --git a/virtinst-fix-initrd-inject.patch b/virtinst-fix-initrd-inject.patch new file mode 100644 index 0000000..f9ef02c --- /dev/null +++ b/virtinst-fix-initrd-inject.patch @@ -0,0 +1,56 @@ +commit b7054426336929abb0ab0d822ad208a11d418904 +Author: Cole Robinson +Date: Tue Aug 23 15:35:32 2011 -0400 + + virt-install: Fix --initrd-inject + + And add unit tests for it! + +diff --git a/tests/cli-test-xml/faketree/images/pxeboot/initrd.img b/tests/cli-test-xml/faketree/images/pxeboot/initrd.img +index 0f3339f..256e89a 100644 +Binary files a/tests/cli-test-xml/faketree/images/pxeboot/initrd.img and b/tests/cli-test-xml/faketree/images/pxeboot/initrd.img differ +diff --git a/tests/cli-test-xml/faketree/images/pxeboot/vmlinuz b/tests/cli-test-xml/faketree/images/pxeboot/vmlinuz +index fa797a2..af1a261 100644 +Binary files a/tests/cli-test-xml/faketree/images/pxeboot/vmlinuz and b/tests/cli-test-xml/faketree/images/pxeboot/vmlinuz differ +diff --git a/tests/clitest.py b/tests/clitest.py +index 7f332dc..26fc68e 100644 +--- a/tests/clitest.py ++++ b/tests/clitest.py +@@ -265,6 +265,11 @@ args_dict = { + "--arch i486 --pxe", + # Directory tree URL install + "--hvm --location %(TREEDIR)s", ++ # initrd-inject ++ "--hvm --location %(TREEDIR)s --initrd-inject virt-install --extra-args ks=file:/virt-install", ++ # initrd-inject with manual kernel/initrd ++ "--hvm --location %(TREEDIR)s --initrd-inject virt-install --extra-args ks=file:/virt-install", ++ # Directory tree URL install with extra-args + # Directory tree URL install with extra-args + "--hvm --location %(TREEDIR)s --extra-args console=ttyS0", + # Directory tree CDROM install +diff --git a/virtinst/DistroInstaller.py b/virtinst/DistroInstaller.py +index 88963db..0bfe5b0 100644 +--- a/virtinst/DistroInstaller.py ++++ b/virtinst/DistroInstaller.py +@@ -270,11 +270,10 @@ class DistroInstaller(Installer.Installer): + transient=transient) + self.install_devices.append(disk) + +- def _perform_initrd_injections(self): ++ def _perform_initrd_injections(self, initrd): + """ + Insert files into the root directory of the initial ram disk + """ +- initrd = self._install_bootconfig.initrd + tempdir = tempfile.mkdtemp(dir=self.scratchdir) + os.chmod(tempdir, 0775) + +@@ -379,7 +378,7 @@ class DistroInstaller(Installer.Installer): + self._tmpfiles.append(initrdfn) + + if self._initrd_injections: +- self._perform_initrd_injections() ++ self._perform_initrd_injections(initrdfn) + + # If required, upload media to an accessible guest location + kernelfn, initrdfn = self._upload_media(guest, meter, diff --git a/virtinst-fix-remote-url.patch b/virtinst-fix-remote-url.patch new file mode 100644 index 0000000..0d5839f --- /dev/null +++ b/virtinst-fix-remote-url.patch @@ -0,0 +1,62 @@ +commit 9ad2e3a68b8f5cc1b5c11588dc1c4d5edcca3deb +Author: Cole Robinson +Date: Tue Aug 30 14:54:47 2011 -0400 + + VirtualDisk: Fix logic error determining if we are creating storage + + If creating a storage volume, the logic would fall through and check if + the path existed locally. This isn't valid for remote connections. + + Addtionally cleanup similar functions to be easier to read and hopefully + avoid these problems in the future. + +diff --git a/virtinst/VirtualDisk.py b/virtinst/VirtualDisk.py +index 87b72ad..6ea3bfd 100644 +--- a/virtinst/VirtualDisk.py ++++ b/virtinst/VirtualDisk.py +@@ -1123,23 +1123,38 @@ class VirtualDisk(VirtualDevice): + Return bool representing if managed storage parameters have + been explicitly specified or filled in + """ +- return (self.vol_object != None or self.vol_install != None or +- self._pool_object != None) ++ return bool(self.vol_object != None or ++ self.vol_install != None or ++ self._pool_object != None) + + def __creating_storage(self): + """ + Return True if the user requested us to create a device + """ +- return not (self.__no_storage() or +- (self.__managed_storage() and +- self.vol_object or self._pool_object) or +- (self.path and os.path.exists(self.path))) ++ if self.__no_storage(): ++ return False ++ ++ if self.__managed_storage(): ++ if self.vol_object or self._pool_object: ++ return False ++ return True ++ ++ if (not self.is_remote() and ++ self.path and ++ os.path.exists(self.path)): ++ return False ++ ++ return True + + def __no_storage(self): + """ + Return True if no path or storage was specified + """ +- return (not self.__managed_storage() and not self.path) ++ if self.__managed_storage(): ++ return False ++ if self.path: ++ return False ++ return True + + + def _storage_security_label(self): diff --git a/virtinst-fix-vmm-disk-bus.patch b/virtinst-fix-vmm-disk-bus.patch new file mode 100644 index 0000000..eb6ec02 --- /dev/null +++ b/virtinst-fix-vmm-disk-bus.patch @@ -0,0 +1,20 @@ +commit 061668208fa6cd8f45cf66dd921a56386de3f3b5 +Author: Cole Robinson +Date: Mon Aug 29 13:12:32 2011 -0400 + + VirtualDeviceAddress: Only clear XML if not building from scratch + +diff --git a/virtinst/VirtualDevice.py b/virtinst/VirtualDevice.py +index 386eb00..869d50e 100644 +--- a/virtinst/VirtualDevice.py ++++ b/virtinst/VirtualDevice.py +@@ -170,7 +170,8 @@ class VirtualDeviceAddress(XMLBuilderDomain): + self._unit = None + self._port = None + +- self._remove_child_xpath("./address") ++ if self._is_parse(): ++ self._remove_child_xpath("./address") + + def _get_type(self): + return self._type