Merge lp:~soren/nova/get-console-log-fixes into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Merged
Approved by: Devin Carlen
Approved revision: 357
Merged at revision: 361
Proposed branch: lp:~soren/nova/get-console-log-fixes
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 23 lines (+4/-5)
1 file modified
nova/virt/libvirt_conn.py (+4/-5)
To merge this branch: bzr merge lp:~soren/nova/get-console-log-fixes
Reviewer Review Type Date Requested Status
Devin Carlen (community) Approve
Eric Day (community) Approve
Review via email: mp+38600@code.launchpad.net

Description of the change

Fix two problems with get_console_log:
 * libvirt has this annoying "feature" where it chown()s your console to the uid running libvirt. That gets in the way of reading it. Add a call to "sudo chown ...." right before we read it to make sure it works out well.
 * We were looking in the wrong directory for console.log. *blush*

To post a comment you must log in.
Revision history for this message
Eric Day (eday) wrote :

lgtm!

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/virt/libvirt_conn.py'
2--- nova/virt/libvirt_conn.py 2010-10-14 05:51:55 +0000
3+++ nova/virt/libvirt_conn.py 2010-10-15 22:04:47 +0000
4@@ -285,16 +285,15 @@
5
6 @exception.wrap_exception
7 def get_console_output(self, instance):
8- console_log = os.path.join(FLAGS.instances_path, instance['internal_id'], 'console.log')
9- logging.info('console_log: %s' % console_log)
10- logging.info('FLAGS.libvirt_type: %s' % FLAGS.libvirt_type)
11+ console_log = os.path.join(FLAGS.instances_path, instance['name'], 'console.log')
12+ d = process.simple_execute('sudo chown %d %s' % (os.getuid(), console_log))
13 if FLAGS.libvirt_type == 'xen':
14 # Xen is spethial
15- d = process.simple_execute("virsh ttyconsole %s" % instance['name'])
16+ d.addCallback(lambda _: process.simple_execute("virsh ttyconsole %s" % instance['name']))
17 d.addCallback(self._flush_xen_console)
18 d.addCallback(self._append_to_file, console_log)
19 else:
20- d = defer.succeed(console_log)
21+ d.addCallback(lambda _: defer.succeed(console_log))
22 d.addCallback(self._dump_file)
23 return d
24