summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-03-20 03:17:02 +0000
committerGerrit Code Review <review@openstack.org>2012-03-20 03:17:02 +0000
commit79a2cc44bce8c922278e95f643b85376f257408e (patch)
treee58f2d3591a9093870c67d7ad3488bad3cf525d5
parentffb9361596c1708d7d009c195b4b3bc74d00a01c (diff)
parente5ecf777a452cdb439f0c5be72a2a298669b9c26 (diff)
downloadnova-79a2cc44bce8c922278e95f643b85376f257408e.tar.gz
nova-79a2cc44bce8c922278e95f643b85376f257408e.tar.xz
nova-79a2cc44bce8c922278e95f643b85376f257408e.zip
Merge "Fix lxc console regression"
-rw-r--r--nova/virt/libvirt/connection.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py
index 26260f0ac..3aabfde13 100644
--- a/nova/virt/libvirt/connection.py
+++ b/nova/virt/libvirt/connection.py
@@ -942,25 +942,27 @@ class LibvirtConnection(driver.ComputeDriver):
console_types[console_type].append(console_node)
# If the guest has a console logging to a file prefer to use that
- for file_console in console_types.get('file'):
- source_node = file_console.find('./source')
- if source_node is None:
- continue
- path = source_node.get("path")
- if not path:
- continue
- libvirt_utils.chown(path, os.getuid())
- return libvirt_utils.load_file(path)
+ if console_types.get('file'):
+ for file_console in console_types.get('file'):
+ source_node = file_console.find('./source')
+ if source_node is None:
+ continue
+ path = source_node.get("path")
+ if not path:
+ continue
+ libvirt_utils.chown(path, os.getuid())
+ return libvirt_utils.load_file(path)
# Try 'pty' types
- for pty_console in console_types.get('pty'):
- source_node = pty_console.find('./source')
- if source_node is None:
- continue
- pty = source_node.get("path")
- if not pty:
- continue
- break
+ if console_types.get('pty'):
+ for pty_console in console_types.get('pty'):
+ source_node = pty_console.find('./source')
+ if source_node is None:
+ continue
+ pty = source_node.get("path")
+ if not pty:
+ continue
+ break
else:
raise exception.Error(_("Guest does not have a console available"))