summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoren Hansen <soren@linux2go.dk>2011-03-07 21:59:05 +0100
committerSoren Hansen <soren@linux2go.dk>2011-03-07 21:59:05 +0100
commit4e9c570fbf8b3987d556da085b61f159f32c16f1 (patch)
treed70073c963208d6bf98fa5efb9a6b3d4c3811eab
parent7b7abe7e7a25c0cd07c64c34f69ce050c669cfc3 (diff)
downloadnova-4e9c570fbf8b3987d556da085b61f159f32c16f1.tar.gz
nova-4e9c570fbf8b3987d556da085b61f159f32c16f1.tar.xz
nova-4e9c570fbf8b3987d556da085b61f159f32c16f1.zip
Use IptablesManager.semapahore from securitygroups driver to ensure we don't apply half a rule set.
-rw-r--r--nova/virt/libvirt_conn.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py
index b900cb8eb..825bcb0d7 100644
--- a/nova/virt/libvirt_conn.py
+++ b/nova/virt/libvirt_conn.py
@@ -1372,8 +1372,12 @@ class IptablesFirewallDriver(FirewallDriver):
def refresh_security_group_rules(self, security_group):
for instance in self.instances.values():
- self.remove_filters_for_instance(instance)
- self.add_filters_for_instance(instance)
+ # We use the semaphore to make sure noone applies the rule set
+ # after we've yanked the existing rules but before we've put in
+ # the new ones.
+ with self.iptables.semaphore:
+ self.remove_filters_for_instance(instance)
+ self.add_filters_for_instance(instance)
self.iptables.apply()
def _security_group_chain_name(self, security_group_id):