Merge lp:~soren/nova/stuff into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Merged
Approved by: Rick Harris
Approved revision: 816
Merged at revision: 817
Proposed branch: lp:~soren/nova/stuff
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 20 lines (+2/-2)
1 file modified
nova/virt/libvirt_conn.py (+2/-2)
To merge this branch: bzr merge lp:~soren/nova/stuff
Reviewer Review Type Date Requested Status
Rick Harris (community) Approve
Josh Kearney (community) Approve
Review via email: mp+53781@code.launchpad.net

Commit message

Comparisons to None should not use == or !=.

Stop converting sets to lists before comparing them. They might be in different order after being list()ified.

Description of the change

Fixes a couple of things that were raised in (but unrelated to) https://code.launchpad.net/~soren/nova/libvirt-is-more-than-kvm-and-qemu/+merge/53610

To post a comment you must log in.
Revision history for this message
Josh Kearney (jk0) wrote :

Good catch.

review: Approve
Revision history for this message
Rick Harris (rconradharris) wrote :

Good stuff.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/virt/libvirt_conn.py'
--- nova/virt/libvirt_conn.py 2011-03-16 19:26:41 +0000
+++ nova/virt/libvirt_conn.py 2011-03-17 10:47:33 +0000
@@ -998,14 +998,14 @@
998 topology_node = xml.xpathEval('//host/cpu/topology')[0]\998 topology_node = xml.xpathEval('//host/cpu/topology')[0]\
999 .get_properties()999 .get_properties()
1000 topology = dict()1000 topology = dict()
1001 while topology_node != None:1001 while topology_node:
1002 name = topology_node.get_name()1002 name = topology_node.get_name()
1003 topology[name] = topology_node.getContent()1003 topology[name] = topology_node.getContent()
1004 topology_node = topology_node.get_next()1004 topology_node = topology_node.get_next()
10051005
1006 keys = ['cores', 'sockets', 'threads']1006 keys = ['cores', 'sockets', 'threads']
1007 tkeys = topology.keys()1007 tkeys = topology.keys()
1008 if list(set(tkeys)) != list(set(keys)):1008 if set(tkeys) != set(keys):
1009 ks = ', '.join(keys)1009 ks = ', '.join(keys)
1010 raise exception.Invalid(_("Invalid xml: topology(%(topology)s) "1010 raise exception.Invalid(_("Invalid xml: topology(%(topology)s) "
1011 "must have %(ks)s") % locals())1011 "must have %(ks)s") % locals())