virt-install: concatenate all extra-args argument

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@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-03-18 03:28:17 +01:00
parent c8aaf08682
commit 4c3e7969c6
6 changed files with 11 additions and 16 deletions

View File

@ -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/>

View File

@ -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",

View File

@ -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

View File

@ -374,7 +374,8 @@ class DistroInstaller(Installer):
self._install_kernel = kernel
self._install_initrd = initrd
self.extraargs = args
if args:
self.extraargs.append(args)
###########################

View File

@ -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)
##########################

View File

@ -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