]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
purge cluster during teardown 1083/head
authorVasu Kulkarni <vasu@redhat.com>
Wed, 21 Jun 2017 18:18:27 +0000 (11:18 -0700)
committerVasu Kulkarni <vasu@redhat.com>
Thu, 22 Jun 2017 17:39:12 +0000 (10:39 -0700)
It achieves 2 things
a) tests out purge-cluster and iron out any issues as we find them
b) can make ceph-ansible tests run on any nodes in lab (smithi, mira etc)

Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
teuthology/task/ceph_ansible.py
teuthology/test/task/test_ceph_ansible.py

index 7e5cc3db66361534fb1656605eb0ba4e4e5a7782..2b5981634e99b7128fb77f905f2bd8381e6317f3 100644 (file)
@@ -212,6 +212,34 @@ class CephAnsible(Task):
         os.remove(self.inventory)
         os.remove(self.playbook_file)
         os.remove(self.extra_vars_file)
+        # run purge-cluster that teardowns the cluster
+        args = [
+            'ANSIBLE_STDOUT_CALLBACK=debug',
+            'ansible-playbook', '-vv',
+            '-e', 'ireallymeanit=yes',
+            '-i', 'inven.yml', 'infrastructure-playbooks/purge-cluster.yml'
+        ]
+        log.debug("Running %s", args)
+        str_args = ' '.join(args)
+        installer_node = self.ceph_installer
+        if self.config.get('rhbuild'):
+            installer_node.run(
+                args=[
+                    run.Raw('cd ~/ceph-ansible'),
+                    run.Raw(';'),
+                    run.Raw(str_args)
+                ]
+            )
+        else:
+            installer_node.run(
+                args=[
+                    run.Raw('cd ~/ceph-ansible'),
+                    run.Raw(';'),
+                    run.Raw('source venv/bin/activate'),
+                    run.Raw(';'),
+                    run.Raw(str_args)
+                ]
+            )
 
     def wait_for_ceph_health(self):
         with contextutil.safe_while(sleep=15, tries=6,
index 2e1bdd942e9f314117dffab88615d1bc47fb2369..8314b73f68be1d33bc3d4948fb5eb3fe7aa030b7 100644 (file)
@@ -41,6 +41,11 @@ class TestCephAnsibleTask(TestTask):
         )
         self.patcher_get_scratch_devices.start()
 
+        self.patcher_teardown = patch(
+            'teuthology.task.ceph_ansible.CephAnsible.teardown',
+        )
+        self.patcher_teardown.start()
+
         def fake_set_iface_and_cidr(self):
             self._interface = 'eth0'
             self._cidr = '172.21.0.0/20'
@@ -54,6 +59,7 @@ class TestCephAnsibleTask(TestTask):
     def stop_patchers(self):
         self.patcher_get_scratch_devices.stop()
         self.patcher_remote.stop()
+        self.patcher_teardown.stop()
 
     def test_playbook_none(self):
         skip(SKIP_IRRELEVANT)