[virt-tools-list] [PATCH virt-install 4/4] virt-install: Deal with os-variant's install param

Fabiano Fidêncio fidencio at redhat.com
Fri Feb 8 15:23:58 UTC 2019


As os-variant has a new "install" parameter that can be passed, let's
take advantage of it and automatically fill options.location with data
from osinfo-db whenever install=location is passed (and, of course,
osinfo-db has the information).

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 virt-install | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/virt-install b/virt-install
index 3aa643d2..4e812930 100755
--- a/virt-install
+++ b/virt-install
@@ -441,6 +441,19 @@ def build_installer(options, guest):
     install_bootdev = None
 
     has_installer = True
+    if options.os_variant.install == "location":
+        if not options.location:
+            location = guest.osinfo.get_location(guest.os.arch)
+            if not location:
+                logging.debug(_("No location could be guessed from osinfo-db "
+                    "and the installation cannot proceed"))
+                # This triggers an error in validate_required_options
+                return None
+            logging.debug("Generated default libosinfo '--location %s'", location)
+            options.location = location
+    elif options.os_variant.install == "cdrom":
+        pass
+
     if options.location:
         (location,
          location_kernel,
-- 
2.20.1




More information about the virt-tools-list mailing list