diff options
| author | Soren Hansen <soren@linux2go.dk> | 2011-03-22 14:50:53 +0100 |
|---|---|---|
| committer | Soren Hansen <soren@linux2go.dk> | 2011-03-22 14:50:53 +0100 |
| commit | 804083b6ba811834c0bf9d5e2edcdf0130d7d1ce (patch) | |
| tree | 04f1f8fb8e02b3f5a0d6d5d30e80c4c544228113 | |
| parent | 01e7e598d0eb4aab9c3e7f69926a2875cdf22136 (diff) | |
IptablesManager.semaphore is no more.
| -rw-r--r-- | nova/network/linux_net.py | 37 |
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 |
