From: Vasu Kulkarni Date: Wed, 21 Jun 2017 18:18:27 +0000 (-0700) Subject: purge cluster during teardown X-Git-Tag: 1.1.0~416^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1083%2Fhead;p=teuthology.git purge cluster during teardown 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 --- diff --git a/teuthology/task/ceph_ansible.py b/teuthology/task/ceph_ansible.py index 7e5cc3db6..2b5981634 100644 --- a/teuthology/task/ceph_ansible.py +++ b/teuthology/task/ceph_ansible.py @@ -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, diff --git a/teuthology/test/task/test_ceph_ansible.py b/teuthology/test/task/test_ceph_ansible.py index 2e1bdd942..8314b73f6 100644 --- a/teuthology/test/task/test_ceph_ansible.py +++ b/teuthology/test/task/test_ceph_ansible.py @@ -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)