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
1=== modified file 'nova/virt/libvirt_conn.py'
2--- nova/virt/libvirt_conn.py 2011-03-16 19:26:41 +0000
3+++ nova/virt/libvirt_conn.py 2011-03-17 10:47:33 +0000
4@@ -998,14 +998,14 @@
5 topology_node = xml.xpathEval('//host/cpu/topology')[0]\
6 .get_properties()
7 topology = dict()
8- while topology_node != None:
9+ while topology_node:
10 name = topology_node.get_name()
11 topology[name] = topology_node.getContent()
12 topology_node = topology_node.get_next()
13
14 keys = ['cores', 'sockets', 'threads']
15 tkeys = topology.keys()
16- if list(set(tkeys)) != list(set(keys)):
17+ if set(tkeys) != set(keys):
18 ks = ', '.join(keys)
19 raise exception.Invalid(_("Invalid xml: topology(%(topology)s) "
20 "must have %(ks)s") % locals())