diff options
| author | Soren Hansen <soren@linux2go.dk> | 2011-03-17 22:16:27 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-03-17 22:16:27 +0000 |
| commit | 0d40b15dc011324a4ebf7a7c6150cf3e4fd151d9 (patch) | |
| tree | 47233825bea70110d12ddd95988a24583072e7bb | |
| parent | 4edbeea2e81a7aff271be5e96cc18cb3ea6e5133 (diff) | |
| parent | cf648ea89015818a3ec7c8d6d59b50f8ed3604f7 (diff) | |
| download | nova-0d40b15dc011324a4ebf7a7c6150cf3e4fd151d9.tar.gz nova-0d40b15dc011324a4ebf7a7c6150cf3e4fd151d9.tar.xz nova-0d40b15dc011324a4ebf7a7c6150cf3e4fd151d9.zip | |
Fix a couple of things that assume that libvirt == kvm/qemu.
| -rwxr-xr-x | bin/nova-manage | 6 | ||||
| -rw-r--r-- | nova/virt/libvirt_conn.py | 43 |
2 files changed, 31 insertions, 18 deletions
diff --git a/bin/nova-manage b/bin/nova-manage index a4d820209..6dcdddd5e 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -579,8 +579,10 @@ class VmCommands(object): ctxt = context.get_admin_context() instance_id = ec2utils.ec2_id_to_id(ec2_id) - if FLAGS.connection_type != 'libvirt': - msg = _('Only KVM is supported for now. Sorry!') + if (FLAGS.connection_type != 'libvirt' or + (FLAGS.connection_type == 'libvirt' and + FLAGS.libvirt_type not in ['kvm', 'qemu'])): + msg = _('Only KVM and QEmu are supported for now. Sorry!') raise exception.Error(msg) if (FLAGS.volume_driver != 'nova.volume.driver.AOEDriver' and \ diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index 0a85da541..e80b9fbdf 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -991,24 +991,35 @@ class LibvirtConnection(object): + xml.serialize()) cpu_info = dict() - cpu_info['arch'] = xml.xpathEval('//host/cpu/arch')[0].getContent() - cpu_info['model'] = xml.xpathEval('//host/cpu/model')[0].getContent() - cpu_info['vendor'] = xml.xpathEval('//host/cpu/vendor')[0].getContent() - topology_node = xml.xpathEval('//host/cpu/topology')[0]\ - .get_properties() + arch_nodes = xml.xpathEval('//host/cpu/arch') + if arch_nodes: + cpu_info['arch'] = arch_nodes[0].getContent() + + model_nodes = xml.xpathEval('//host/cpu/model') + if model_nodes: + cpu_info['model'] = model_nodes[0].getContent() + + vendor_nodes = xml.xpathEval('//host/cpu/vendor') + if vendor_nodes: + cpu_info['vendor'] = vendor_nodes[0].getContent() + + topology_nodes = xml.xpathEval('//host/cpu/topology') topology = dict() - while topology_node: - name = topology_node.get_name() - topology[name] = topology_node.getContent() - topology_node = topology_node.get_next() - - keys = ['cores', 'sockets', 'threads'] - tkeys = topology.keys() - if set(tkeys) != set(keys): - ks = ', '.join(keys) - raise exception.Invalid(_("Invalid xml: topology(%(topology)s) " - "must have %(ks)s") % locals()) + if topology_nodes: + topology_node = topology_nodes[0].get_properties() + while topology_node: + name = topology_node.get_name() + topology[name] = topology_node.getContent() + topology_node = topology_node.get_next() + + keys = ['cores', 'sockets', 'threads'] + tkeys = topology.keys() + if set(tkeys) != set(keys): + ks = ', '.join(keys) + raise exception.Invalid(_("Invalid xml: topology" + "(%(topology)s) must have " + "%(ks)s") % locals()) feature_nodes = xml.xpathEval('//host/cpu/feature') features = list() |
