[virt-tools-list] [virt-manager PATCH] virt-install: concatenate all extra-args argument

Pavel Hrdina phrdina at redhat.com
Fri Mar 18 08:08:52 UTC 2016


So far we used only the last --extra-args argument from virt-install
command line, but it makes more sense to use all occurrences of
--extra-args and pass them to kernel.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml | 2 +-
 virt-install                                            | 9 +++++----
 virtManager/create.py                                   | 6 +-----
 virtinst/distroinstaller.py                             | 3 ++-
 virtinst/installer.py                                   | 4 ++--
 virtinst/urlfetcher.py                                  | 3 ---
 6 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml b/tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml
index 4a43c3b..76397ff 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml
@@ -8,7 +8,7 @@
     <type arch="x86_64">hvm</type>
     <kernel>/tmp/virtinst-vmlinuz.</kernel>
     <initrd>/tmp/virtinst-initrd.img.</initrd>
-    <cmdline>method=tests/cli-test-xml/faketree console=ttyS0</cmdline>
+    <cmdline>console=ttyS0 method=tests/cli-test-xml/faketree</cmdline>
   </os>
   <features>
     <acpi/>
diff --git a/virt-install b/virt-install
index e465c46..5343f0c 100755
--- a/virt-install
+++ b/virt-install
@@ -521,8 +521,9 @@ def _show_nographics_warnings(options, guest):
         # warn about it.
         return
 
-    if console_type in (options.extra_args or ""):
-        return
+    for args in options.extra_args:
+        if console_type in (options.extra_args or ""):
+            return
 
     logging.warn(_("Did not find '%(console_string)s' in --extra-args, "
         "which is likely required to see text install output from the "
@@ -589,7 +590,7 @@ def build_guest_instance(conn, options, parsermap):
     convert_old_os_options(options)
 
     # non-xml install options
-    guest.installer.extraargs = options.extra_args
+    guest.installer.extraargs = options.extra_args or []
     guest.installer.initrd_injections = options.initrd_inject
     guest.autostart = options.autostart
 
@@ -922,7 +923,7 @@ def parse_args():
                     help=_("Build guest around an existing disk image"))
     insg.add_argument("--livecd", action="store_true",
                     help=_("Treat the CD-ROM media as a Live CD"))
-    insg.add_argument("-x", "--extra-args",
+    insg.add_argument("-x", "--extra-args", action="append",
                     help=_("Additional arguments to pass to the install kernel "
                            "booted from --location"))
     insg.add_argument("--initrd-inject", action="append",
diff --git a/virtManager/create.py b/virtManager/create.py
index f979cf2..ca83674 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -1807,12 +1807,8 @@ class vmmCreate(vmmGObjectUI):
             if cdrom:
                 self._guest.installer.cdrom = True
 
-            extraargs = ""
             if extra:
-                extraargs += extra
-
-            if extraargs:
-                self._guest.installer.extraargs = extraargs
+                self._guest.installer.extraargs = [extra]
 
             if init:
                 self._guest.os.init = init
diff --git a/virtinst/distroinstaller.py b/virtinst/distroinstaller.py
index 1b792d4..bd4999c 100644
--- a/virtinst/distroinstaller.py
+++ b/virtinst/distroinstaller.py
@@ -374,7 +374,8 @@ class DistroInstaller(Installer):
 
         self._install_kernel = kernel
         self._install_initrd = initrd
-        self.extraargs = args
+        if args:
+            self.extraargs.append(args)
 
 
     ###########################
diff --git a/virtinst/installer.py b/virtinst/installer.py
index 0eebc45..50c72c7 100644
--- a/virtinst/installer.py
+++ b/virtinst/installer.py
@@ -59,7 +59,7 @@ class Installer(object):
 
         self.cdrom = False
         self.livecd = False
-        self.extraargs = None
+        self.extraargs = []
 
         self.initrd_injections = []
 
@@ -128,7 +128,7 @@ class Installer(object):
         if self._install_initrd:
             guest.os.initrd = self._install_initrd
         if self.extraargs:
-            guest.os.kernel_args = self.extraargs
+            guest.os.kernel_args = " ".join(self.extraargs)
 
 
     ##########################
diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
index 3266186..30c467e 100644
--- a/virtinst/urlfetcher.py
+++ b/virtinst/urlfetcher.py
@@ -644,9 +644,6 @@ class Distro(object):
         if not self.fetcher.location.startswith("/"):
             args += "%s=%s" % (self._get_method_arg(), self.fetcher.location)
 
-        if guest.installer.extraargs:
-            args += " " + guest.installer.extraargs
-
         try:
             initrd = self.fetcher.acquireFile(initrdpath)
             return kernel, initrd, args
-- 
2.7.3




More information about the virt-tools-list mailing list