Subject: virt-install: Fix --initrd-inject From: Cole Robinson crobinso@redhat.com Tue Aug 23 15:35:32 2011 -0400 Date: Tue Aug 23 15:35:32 2011 -0400: Git: b7054426336929abb0ab0d822ad208a11d418904 And add unit tests for it! Index: virtinst-0.600.0/tests/clitest.py =================================================================== --- virtinst-0.600.0.orig/tests/clitest.py +++ virtinst-0.600.0/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 Index: virtinst-0.600.0/virtinst/DistroInstaller.py =================================================================== --- virtinst-0.600.0.orig/virtinst/DistroInstaller.py +++ virtinst-0.600.0/virtinst/DistroInstaller.py @@ -270,11 +270,10 @@ class DistroInstaller(Installer.Installe 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.Installe 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,