bug 8380: default chains weren't getting deleted

status 8380: resolved fixed
This commit is contained in:
Chiradeep Vittal 2011-02-04 12:00:19 -08:00
parent 9e858992de
commit de19cade39
1 changed files with 2 additions and 2 deletions

View File

@ -1773,7 +1773,7 @@ def delete_rules_for_vm_in_bridge_firewall_chain(vmName):
vm_name = vmName
vmchain = vm_name
if vm_name.startswith('i-') or vm_name.startswith('r-'):
vmchain = '-'.join(vm_name.split('-')[:-1])
vmchain = '-'.join(vm_name.split('-')[:-2])
delcmd = "iptables -S BRIDGE-FIREWALL | grep " + vmchain + " | sed 's/-A/-D/'"
delcmds = util.pread2(['/bin/bash', '-c', delcmd]).split('\n')
@ -1930,7 +1930,7 @@ def cleanup_rules_for_dead_vms(session):
@echo
def cleanup_rules(session, args):
try:
chainscmd = "iptables-save | grep '^:' | grep -v '.*-def' | awk '{print $1}' | cut -d':' -f2"
chainscmd = "iptables-save | grep '^:' | awk '{print $1}' | cut -d':' -f2 | sed 's/-def/-VM/'|sort|uniq"
chains = util.pread2(['/bin/bash', '-c', chainscmd]).split('\n')
cleaned = 0
cleanup = []