Skip to content

Commit

Permalink
Add support for lxc consoles.
Browse files Browse the repository at this point in the history
Add lxc console support. Similar to how we get console
on libvirt-xen domains. This fixes bug 853602.

Change-Id: Ib39953b804dc3284132651f29f33ad5783d1959a
Signed-off-by: Chuck Short <chuck.short@canonical.com>
  • Loading branch information
Chuck Short committed Mar 6, 2012
1 parent e8bc00e commit e817959
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions nova/virt/libvirt.xml.template
Expand Up @@ -6,6 +6,7 @@
#if $type == 'lxc'
<type>exe</type>
<init>/sbin/init</init>
<cmdline>console=ttyS0</cmdline>
#else if $type == 'uml'
#set $root_disk_bus = 'uml'
#set $ephemeral_disk_bus = 'uml'
Expand Down
12 changes: 9 additions & 3 deletions nova/virt/libvirt/connection.py
Expand Up @@ -880,7 +880,7 @@ def _wait_for_boot():
timer = utils.LoopingCall(_wait_for_boot)
return timer.start(interval=0.5, now=True)

def _flush_xen_console(self, virsh_output):
def _flush_libvirt_console(self, virsh_output):
LOG.info(_('virsh said: %r'), virsh_output)
virsh_output = virsh_output[0].strip()

Expand Down Expand Up @@ -919,11 +919,17 @@ def get_console_output(self, instance):
virsh_output = utils.execute('virsh',
'ttyconsole',
instance['name'])
data = self._flush_xen_console(virsh_output)
data = self._flush_libvirt_console(virsh_output)
fpath = self._append_to_file(data, console_log)
elif FLAGS.libvirt_type == 'lxc':
# LXC is also special
LOG.info(_("Unable to read LXC console"), instance=instance)
virsh_output = utils.execute('virsh',
'-c',
'lxc:///',
'ttyconsole',
instance['name'])
data = self._flush_libvirt_console(virsh_output)
fpath = self._append_to_file(data, console_log)
else:
fpath = console_log

Expand Down

0 comments on commit e817959

Please sign in to comment.