summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoren Hansen <soren@linux2go.dk>2011-03-22 14:50:53 +0100
committerSoren Hansen <soren@linux2go.dk>2011-03-22 14:50:53 +0100
commit804083b6ba811834c0bf9d5e2edcdf0130d7d1ce (patch)
tree04f1f8fb8e02b3f5a0d6d5d30e80c4c544228113
parent01e7e598d0eb4aab9c3e7f69926a2875cdf22136 (diff)
IptablesManager.semaphore is no more.
-rw-r--r--nova/network/linux_net.py37
1 files changed, 16 insertions, 21 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index 8cbf8db24..9faa7de07 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -277,28 +277,23 @@ class IptablesManager(object):
This will blow away any rules left over from previous runs of the
same component of Nova, and replace them with our current set of
rules. This happens atomically, thanks to iptables-restore.
-
- We wrap the call in a semaphore lock, so that we don't race with
- ourselves. In the event of a race with another component running
- an iptables-* command at the same time, we retry up to 5 times.
"""
- with self.semaphore:
- s = [('iptables', self.ipv4)]
- if FLAGS.use_ipv6:
- s += [('ip6tables', self.ipv6)]
-
- for cmd, tables in s:
- for table in tables:
- current_table, _ = self.execute('sudo',
- '%s-save' % (cmd,),
- '-t', '%s' % (table,),
- attempts=5)
- current_lines = current_table.split('\n')
- new_filter = self._modify_rules(current_lines,
- tables[table])
- self.execute('sudo', '%s-restore' % (cmd,),
- process_input='\n'.join(new_filter),
- attempts=5)
+ s = [('iptables', self.ipv4)]
+ if FLAGS.use_ipv6:
+ s += [('ip6tables', self.ipv6)]
+
+ for cmd, tables in s:
+ for table in tables:
+ current_table, _ = self.execute('sudo',
+ '%s-save' % (cmd,),
+ '-t', '%s' % (table,),
+ attempts=5)
+ current_lines = current_table.split('\n')
+ new_filter = self._modify_rules(current_lines,
+ tables[table])
+ self.execute('sudo', '%s-restore' % (cmd,),
+ process_input='\n'.join(new_filter),
+ attempts=5)
def _modify_rules(self, current_lines, table, binary=None):
unwrapped_chains = table.unwrapped_chains