Merge lp:~soren/nova/avoid-zombie-chains into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Merged
Approved by: Rick Harris
Approved revision: 735
Merged at revision: 792
Proposed branch: lp:~soren/nova/avoid-zombie-chains
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 36 lines (+7/-8)
1 file modified
nova/virt/libvirt_conn.py (+7/-8)
To merge this branch: bzr merge lp:~soren/nova/avoid-zombie-chains
Reviewer Review Type Date Requested Status
Rick Harris (community) Approve
Devin Carlen (community) Approve
Review via email: mp+53074@code.launchpad.net

Commit message

Remove race condition when refreshing security groups and destroying instances at the same time.

Description of the change

See the linked bug report for the full explanation of the problem.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

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

Just some really really minor nits:

> 10 + if self.instances.pop(instance['id'], False):

Since instance['id'] isn't a bool, the fallback should probably be None.

> 15 - 'filtered'), instance['id'])
> 6 + 'filtered'), instance['id'])

Any reason to include this in the final patch?

Revision history for this message
Soren Hansen (soren) wrote :

2011/3/11 Rick Harris <email address hidden>:
>> 10    +        if self.instances.pop(instance['id'], False):
> Since instance['id'] isn't a bool, the fallback should probably be None.

Fixed.

>> 15    -                       'filtered'), instance['id'])
>> 6     +                   'filtered'), instance['id'])
> Any reason to include this in the final patch?

Um, yes, but not like that :) I wanted to align it with the outer
paren, but somehow I managed to screw that up. Fixed.

--
Soren Hansen        | http://linux2go.dk/
Ubuntu Developer    | http://www.ubuntu.com/
OpenStack Developer | http://www.openstack.org/

lp:~soren/nova/avoid-zombie-chains updated
734. By Soren Hansen

Indentation adjustment (cosmetical).

735. By Soren Hansen

Make the fallback value None instead of False

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

lgtm

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-10 20:40:19 +0000
+++ nova/virt/libvirt_conn.py 2011-03-11 22:43:43 +0000
@@ -1238,13 +1238,12 @@
1238 pass1238 pass
12391239
1240 def unfilter_instance(self, instance):1240 def unfilter_instance(self, instance):
1241 if instance['id'] in self.instances:1241 if self.instances.pop(instance['id'], None):
1242 del self.instances[instance['id']]
1243 self.remove_filters_for_instance(instance)1242 self.remove_filters_for_instance(instance)
1244 self.iptables.apply()1243 self.iptables.apply()
1245 else:1244 else:
1246 LOG.info(_('Attempted to unfilter instance %s which is not '1245 LOG.info(_('Attempted to unfilter instance %s which is not '
1247 'filtered'), instance['id'])1246 'filtered'), instance['id'])
12481247
1249 def prepare_instance_filter(self, instance):1248 def prepare_instance_filter(self, instance):
1250 self.instances[instance['id']] = instance1249 self.instances[instance['id']] = instance
@@ -1387,11 +1386,11 @@
1387 pass1386 pass
13881387
1389 def refresh_security_group_rules(self, security_group):1388 def refresh_security_group_rules(self, security_group):
1390 for instance in self.instances.values():1389 # We use the semaphore to make sure noone applies the rule set
1391 # We use the semaphore to make sure noone applies the rule set1390 # after we've yanked the existing rules but before we've put in
1392 # after we've yanked the existing rules but before we've put in1391 # the new ones.
1393 # the new ones.1392 with self.iptables.semaphore:
1394 with self.iptables.semaphore:1393 for instance in self.instances.values():
1395 self.remove_filters_for_instance(instance)1394 self.remove_filters_for_instance(instance)
1396 self.add_filters_for_instance(instance)1395 self.add_filters_for_instance(instance)
1397 self.iptables.apply()1396 self.iptables.apply()