virt-install: Add --boot useserial=on

Which gives bios output over serial console via sgabios
This commit is contained in:
Cole Robinson 2013-09-04 11:57:26 -04:00
parent ab94df86c4
commit 67cc81f6b1
5 changed files with 23 additions and 13 deletions

View File

@ -361,6 +361,11 @@ configurations like ARM or PPC
Use BIOSPATH as the virtual machine BIOS. Only valid for fully virtualized
guests.
=item B<--boot menu=on,useserial=on>
Enable the bios boot menu, and enable sending bios text output over
serial console.
=back
=back

View File

@ -9,6 +9,7 @@
<boot dev="fd"/>
<init>/sbin/init</init>
<bootmenu enable="no"/>
<bios useserial="yes"/>
</os>
<features><apic/>
</features>

View File

@ -137,6 +137,7 @@ class XMLParseTest(unittest.TestCase):
check("init", None, "/sbin/init")
check("bootorder", ["hd"], ["fd"])
check("enable_bootmenu", None, False)
check("useserial", None, True)
check("kernel", None)
check("initrd", None)
check("kernel_args", None)

View File

@ -374,10 +374,13 @@ def yes_or_no_convert(s):
if s is None:
return None
tvalues = ["y", "yes", "1", "true", "t", "on"]
fvalues = ["n", "no", "0", "false", "f", "off"]
s = s.lower()
if s in ("y", "yes", "1", "true", "t"):
if s in tvalues:
return True
elif s in ("n", "no", "0", "false", "f"):
elif s in fvalues:
return False
return None
@ -1284,7 +1287,6 @@ def parse_boot(guest, optstring):
"""
opts = parse_optstr(optstring)
optlist = [x[0] for x in parse_optstr_tuples(optstring)]
menu = None
def set_param(paramname, dictname, val=None):
val = get_opt_param(opts, dictname, val)
@ -1294,20 +1296,20 @@ def parse_boot(guest, optstring):
setattr(guest.os, paramname, val)
# Convert menu= value
menu = None
if "menu" in opts:
menustr = opts["menu"]
menu = None
if menustr.lower() == "on":
menu = True
elif menustr.lower() == "off":
menu = False
else:
menu = yes_or_no_convert(menustr)
menu = yes_or_no_convert(opts["menu"])
if menu is None:
fail(_("--boot menu must be 'on' or 'off'"))
# Convert useserial= value
useserial = None
if "useserial" in opts:
useserial = yes_or_no_convert(opts["useserial"])
if useserial is None:
fail(_("--boot useserial must be 'on' or 'off'"))
set_param("useserial", "useserial", useserial)
set_param("enable_bootmenu", "menu", menu)
set_param("kernel", "kernel")
set_param("initrd", "initrd")

View File

@ -102,6 +102,7 @@ class OSXML(XMLBuilder):
bootorder = property(_get_bootorder, _set_bootorder)
enable_bootmenu = XMLProperty(xpath="./os/bootmenu/@enable", is_yesno=True)
useserial = XMLProperty(xpath="./os/bios/@useserial", is_yesno=True)
kernel = XMLProperty(xpath="./os/kernel")
initrd = XMLProperty(xpath="./os/initrd")