]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
nuke: clear test firewall rules
authorJohn Spray <jspray@redhat.com>
Wed, 20 Aug 2014 11:09:29 +0000 (12:09 +0100)
committerJohn Spray <jspray@redhat.com>
Thu, 21 Aug 2014 23:51:37 +0000 (00:51 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
teuthology/nuke.py

index 6f4513484773d71f34c8a312d0f953e1f7759381..df549412ec7b4c3d0ba8364447c800a8ca50c612 100644 (file)
@@ -24,6 +24,19 @@ from .task.internal import connect
 log = logging.getLogger(__name__)
 
 
+def clear_firewall(ctx):
+    """
+    Remove any iptables rules created by teuthology.  These rules are identified by containing
+    a comment with 'teuthology' in it.  Non-teuthology firewall rules are unaffected.
+    """
+    ctx.cluster.run(
+        args=[
+            "sudo", "sh", "-c", "iptables-save | grep -v teuthology | iptables-restore"
+        ],
+        wait=False,
+    )
+
+
 def shutdown_daemons(ctx):
     nodes = {}
     for remote in ctx.cluster.remotes.iterkeys():
@@ -420,6 +433,10 @@ def nuke_helper(ctx, should_unlock):
         check_lock(ctx, None)
     connect(ctx, None)
 
+    log.info("Clearing teuthology firewall rules...")
+    clear_firewall(ctx)
+    log.info("Cleared teuthology firewall rules.")
+
     log.info('Unmount ceph-fuse and killing daemons...')
     shutdown_daemons(ctx)
     log.info('All daemons killed.')