[Devstack]Add ability to enable ironic node pty console

Make it possible to enable pty console, so that we can test shellinabox
console with the vm, but in order to not affect the gate logs, we need
to keep the log console by default.

Related-bug: #1526305
Change-Id: I9cb13c85fe1b5d596582dbe15bbd9adf98b03140
This commit is contained in:
Zhenguo Niu 2015-12-11 15:50:26 +08:00
parent aa1f251b69
commit 24955b2125
3 changed files with 17 additions and 12 deletions

View File

@ -359,12 +359,9 @@ function configure_ironic_conductor {
iniset $IRONIC_CONF_FILE pxe tftp_root $IRONIC_TFTPBOOT_DIR
iniset $IRONIC_CONF_FILE pxe tftp_master_path $IRONIC_TFTPBOOT_DIR/master_images
local pxe_params=""
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
pxe_params+="nofb nomodeset vga=normal console=ttyS0"
if is_deployed_with_ipa_ramdisk; then
pxe_params+=" systemd.journald.forward_to_console=yes"
fi
local pxe_params="nofb nomodeset vga=normal console=ttyS0"
if is_deployed_with_ipa_ramdisk; then
pxe_params+=" systemd.journald.forward_to_console=yes"
fi
# When booting with less than 1GB, we need to switch from default tmpfs
# to ramfs for ramdisks to decompress successfully.

View File

@ -41,6 +41,16 @@ CONSOLE_LOG = """
"""
CONSOLE_PTY = """
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
"""
def main():
parser = argparse.ArgumentParser(
description="Configure a kvm virtual machine for the seed image.")
@ -91,11 +101,9 @@ def main():
params['emulator'] = "/usr/bin/qemu-kvm"
if args.console_log:
params['bios_serial'] = "<bios useserial='yes'/>"
params['console_log'] = CONSOLE_LOG % {'console_log': args.console_log}
params['console'] = CONSOLE_LOG % {'console_log': args.console_log}
else:
params['bios_serial'] = ''
params['console_log'] = ''
params['console'] = CONSOLE_PTY
libvirt_template = source_template % params
conn = libvirt.open("qemu:///system")

View File

@ -6,7 +6,7 @@
<type arch='%(arch)s' machine='pc-1.0'>hvm</type>
<boot dev='%(bootdev)s'/>
<bootmenu enable='no'/>
%(bios_serial)s
<bios useserial='yes'/>
</os>
<features>
<acpi/>
@ -40,7 +40,7 @@
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
%(console_log)s
%(console)s
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</memballoon>