diff options
| author | Soren Hansen <soren.hansen@rackspace.com> | 2010-10-15 22:53:57 +0000 |
|---|---|---|
| committer | Tarmac <> | 2010-10-15 22:53:57 +0000 |
| commit | 24de0631b622014323a4348ebc8408fadbafe99a (patch) | |
| tree | f52c45cae508f6876c6eadae69307b0f24ca042a | |
| parent | f36cfc4d6c0557f440572f375923c76cd7d7b1df (diff) | |
| parent | b4ac1ddbfa0607bb75a187680b8d55006c6ea0c0 (diff) | |
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*
| -rw-r--r-- | nova/virt/libvirt_conn.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index d8d36ff65..58a5a941c 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -285,16 +285,15 @@ class LibvirtConnection(object): @exception.wrap_exception def get_console_output(self, instance): - console_log = os.path.join(FLAGS.instances_path, instance['internal_id'], 'console.log') - logging.info('console_log: %s' % console_log) - logging.info('FLAGS.libvirt_type: %s' % FLAGS.libvirt_type) + console_log = os.path.join(FLAGS.instances_path, instance['name'], 'console.log') + d = process.simple_execute('sudo chown %d %s' % (os.getuid(), console_log)) if FLAGS.libvirt_type == 'xen': # Xen is spethial - d = process.simple_execute("virsh ttyconsole %s" % instance['name']) + d.addCallback(lambda _: process.simple_execute("virsh ttyconsole %s" % instance['name'])) d.addCallback(self._flush_xen_console) d.addCallback(self._append_to_file, console_log) else: - d = defer.succeed(console_log) + d.addCallback(lambda _: defer.succeed(console_log)) d.addCallback(self._dump_file) return d |
