Repository: cloudstack Updated Branches: refs/heads/4.3 c680f6ea9 -> 276f29cad
CLOUDSTACK-6927: change cleanup to set instead of list Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/276f29ca Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/276f29ca Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/276f29ca Branch: refs/heads/4.3 Commit: 276f29cad173ad242152daf39b59b0f56c21ac9b Parents: c680f6e Author: Loic Lambiel <[email protected]> Authored: Thu Jun 12 15:43:16 2014 +0200 Committer: Sebastien Goasguen <[email protected]> Committed: Tue Jun 17 17:12:10 2014 +0200 ---------------------------------------------------------------------- scripts/vm/network/security_group.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/276f29ca/scripts/vm/network/security_group.py ---------------------------------------------------------------------- diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py index 88a4e45..3f4c51a 100755 --- a/scripts/vm/network/security_group.py +++ b/scripts/vm/network/security_group.py @@ -687,7 +687,7 @@ def cleanup_rules(): try: chainscmd = """iptables-save | awk '{for(i=1;i<=NF;i++){ if($i ~ /[i|r|s|v]-[0-9]/){print $i} } }'""" chains = execute(chainscmd).split('\n') - cleanup = [] + cleanup = set() results = [] results = virshlist('paused', 'running') for chain in chains: @@ -704,7 +704,7 @@ def cleanup_rules(): if not vm_name in results: logging.debug("chain " + chain + " does not correspond to a vm or vm is not running or paused, cleaning up iptable rules") - cleanup.append(vm_name) + cleanup.add(vm_name) chainscmd = """ebtables-save | awk '{for(i=1;i<=NF;i++){ if($i ~ /[i|r|s|v]-[0-9]/){print $i} } }'""" chains = execute(chainscmd).split('\n') @@ -720,9 +720,8 @@ def cleanup_rules(): if not vm_name in results: logging.debug("chain " + chain + " does not correspond to a vm or vm is not running or paused, cleaning up ebtable rules") - cleanup.append(vm_name) + cleanup.add(vm_name) - cleanup = list(set(cleanup)) for vmname in cleanup: destroy_network_rules_for_vm(vmname)
