[virt-install PATCH v2 12/14] installertreemedia: Perform a unattended installation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In case the InstallerTreeMedia has any unattended_data set, let's just
generate the install script and have everything set up for performing a
unattended installation.

path is appended to the tmpfiles as it's the generated unattended script
and it has to be cleaned up when no longer needed.

cmdline is preppended to the args gotten from _prepare_kernel_url() in
order to be used during the first OS boot (and only there!).

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 virtinst/installertreemedia.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/virtinst/installertreemedia.py b/virtinst/installertreemedia.py
index 642946d9..2484e88c 100644
--- a/virtinst/installertreemedia.py
+++ b/virtinst/installertreemedia.py
@@ -14,6 +14,7 @@ from .devices import DeviceDisk
 from .initrdinject import perform_initrd_injections
 from .kernelupload import upload_kernel_initrd
 from .osdict import OSDB
+from .unattended import generate_install_script
 
 
 # Enum of the various install media types we can have
@@ -172,11 +173,24 @@ class InstallerTreeMedia(object):
         self._unattended_data = unattended_data
 
     def prepare(self, guest, meter):
+        cmdline = None
         if self._unattended_data:
-            pass
+            path, cmdline = generate_install_script(
+                    guest, self._unattended_data)
+
+            self.initrd_injections.append(path)
+            self._tmpfiles.append(path)
 
         fetcher = self._get_fetcher(guest, meter)
-        return self._prepare_kernel_url(guest, fetcher)
+        k, i, a = self._prepare_kernel_url(guest, fetcher)
+
+        # If a cmdline was set due to unattended installation, prepend the
+        # unattended kernel cmdline to the args returned by
+        #_prepare_kernel_url()
+        if cmdline:
+            a = "%s %s" % (cmdline, a)
+
+        return k, i, a
 
     def cleanup(self, guest):
         ignore = guest
-- 
2.20.1

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux