Browse code

Log early boot of Ironic VMs to serial with sgabios

This adds sgabios to the list of packages for Ironic and configures
the libvirt domain to redirect BIOS messages to serial via sgabios,
when console logging is enabled. The sgabios package in Ubuntu
currently has an apparmor bug, so that is worked around here.

This allows visibility into early boot of Ironic nodes and should
help get to the bottom of a frequent failure we're seeing in the gate.

Change-Id: Ifd18851e2d23d198d36e67883a81afc6a92d2a58
Related-Bug: #1393099

Adam Gandelman authored on 2014/11/18 05:26:08
Showing 5 changed files
... ...
@@ -12,6 +12,7 @@ python-libvirt
12 12
 qemu
13 13
 qemu-kvm
14 14
 qemu-utils
15
+sgabios
15 16
 syslinux
16 17
 tftpd-hpa
17 18
 xinetd
... ...
@@ -9,6 +9,7 @@ net-tools
9 9
 openssh-clients
10 10
 openvswitch
11 11
 python-libguestfs
12
+sgabios
12 13
 syslinux
13 14
 tftp-server
14 15
 xinetd
... ...
@@ -147,6 +147,14 @@ function install_ironic {
147 147
     if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
148 148
         install_apache_wsgi
149 149
     fi
150
+
151
+    if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] && is_ubuntu; then
152
+        # Ubuntu packaging+apparmor issue prevents libvirt from loading
153
+        # the ROM from /usr/share/misc.  Workaround by installing it directly
154
+        # to a directory that it can read from. (LP: #1393548)
155
+        sudo rm -rf /usr/share/qemu/sgabios.bin
156
+        sudo cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin
157
+    fi
150 158
 }
151 159
 
152 160
 # install_ironicclient() - Collect sources and prepare
... ...
@@ -78,8 +78,10 @@ def main():
78 78
             params['emulator'] = "/usr/bin/qemu-kvm"
79 79
 
80 80
     if args.console_log:
81
+        params['bios_serial'] = "<bios useserial='yes'/>"
81 82
         params['console_log'] = CONSOLE_LOG % {'console_log': args.console_log}
82 83
     else:
84
+        params['bios_serial'] = ''
83 85
         params['console_log'] = ''
84 86
     libvirt_template = source_template % params
85 87
     conn = libvirt.open("qemu:///system")
... ...
@@ -6,6 +6,7 @@
6 6
     <type arch='%(arch)s' machine='pc-1.0'>hvm</type>
7 7
     <boot dev='%(bootdev)s'/>
8 8
     <bootmenu enable='no'/>
9
+    %(bios_serial)s
9 10
   </os>
10 11
   <features>
11 12
     <acpi/>