Skip to content
Browse files
Added virt-install kernel and initrd params support
Added support for using custom kernel, initrd and
kernel args params to virt-install command line

This will help us booting VM with custom
complied kernel
  • Loading branch information
Satheesh Rajendran committed Jan 2, 2017
1 parent 6ac5bea commit 09d46e331ae20b96dc882330fbb82ef6536af98e
Showing with 34 additions and 0 deletions.
  1. +34 −0 virttest/
@@ -659,6 +659,33 @@ def add_memballoon(help_text, memballoon_model):
logging.debug("vm.add_memballoon returning: %s", result)
return result

def add_kernel(help_text, cmdline, kernel_path=None, initrd_path=None,
Adding Custom kernel option to boot.
: param help_text: string, virt-install help text
: param cmdline: string, current virt-install cmdline
: param kernel_path: string, custom kernel path.
: param initrd_path: string, custom initrd path.
: param kernel_args: string, custom boot args.
if has_option(help_text, "boot"):
if "--boot" in cmdline:
result = ","
result = " --boot "
if has_sub_option("boot", "kernel") and kernel_path:
result += "kernel=%s," % kernel_path
if has_sub_option("boot", "initrd") and initrd_path:
result += "initrd=%s," % initrd_path
if has_sub_option("boot", "kernel_args") and kernel_args:
result += "kernel_args=%s," % kernel_args
result = ""
logging.warning("boot option is not supported")
return result.strip(',')

# End of command line option wrappers

if name is None:
@@ -978,6 +1005,13 @@ def add_memballoon(help_text, memballoon_model):
virt_install_cmd += " --boot emulator=%s" % emulator_path

kernel = params.get("kernel", None)
initrd = params.get("initrd", None)
kernel_args = params.get("kernel_args", None)
if (kernel or initrd) and kernel_args:
virt_install_cmd += add_kernel(help_text, virt_install_cmd, kernel,
initrd, kernel_args)

# bz still open, not fully functional yet
if params.get("use_virt_install_wait") == "yes":
virt_install_cmd += (" --wait %s" %

0 comments on commit 09d46e3

Please sign in to comment.