From 20705aa35aee8839865a2ab948a3e13a170523c8 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 26 Jan 2017 08:53:57 -0600 Subject: [PATCH 1/5] tests/journal_collocation: adds testing values to ceph_conf_overrides This gives test coverage to changes introduced in: https://github.com/ceph/ceph-ansible/pull/1214 Signed-off-by: Andrew Schoen --- tests/functional/centos/7/journal-collocation/group_vars/all | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/functional/centos/7/journal-collocation/group_vars/all b/tests/functional/centos/7/journal-collocation/group_vars/all index 81857e670..a2f0b06dc 100644 --- a/tests/functional/centos/7/journal-collocation/group_vars/all +++ b/tests/functional/centos/7/journal-collocation/group_vars/all @@ -12,3 +12,7 @@ journal_collocation: True os_tuning_params: - { name: kernel.pid_max, value: 4194303 } - { name: fs.file-max, value: 26234859 } +ceph_conf_overrides: + global: + osd_pool_default_pg_num: 8 + osd_pool_default_size: 1 From e05df64fd0f4e2558eaaeb029899cc3e995c7f32 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 26 Jan 2017 10:38:10 -0600 Subject: [PATCH 2/5] tests: adds purge_cluster and purge_dmcrypt scenarios This also removes the purge_cluster_collocated scenario as it's not needed now because of purge_cluster. Moving all the purge commands into its own section allows for ease of reuse when creating new purge scenarios. Signed-off-by: Andrew Schoen --- tox.ini | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/tox.ini b/tox.ini index 4331b5c3e..8aba9687a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,20 @@ [tox] -envlist = {ansible2.2}-{xenial_cluster,journal_collocation,centos7_cluster,dmcrypt_journal,dmcrypt_journal_collocation,docker_cluster,purge_cluster_collocated} +envlist = {ansible2.2}-{xenial_cluster,journal_collocation,centos7_cluster,dmcrypt_journal,dmcrypt_journal_collocation,docker_cluster,purge_cluster,purge_dmcrypt} skipsdist = True +# extra commands for purging clusters +# that purge the cluster and then set it up again to +# ensure that a purge can clear nodes well enough that they +# can be redployed to. +[purge] +commands= + cp {toxinidir}/infrastructure-playbooks/purge-cluster.yml {toxinidir}/purge-cluster.yml + ansible-playbook -vv -i {changedir}/hosts {toxinidir}/purge-cluster.yml --extra-vars="ireallymeanit=yes fetch_directory={changedir}/fetch" + # set up the cluster again + ansible-playbook -vv -i {changedir}/hosts {toxinidir}/site.yml.sample --extra-vars="fetch_directory={changedir}/fetch" + # test that the cluster can be redeployed in a healthy state + testinfra -n 4 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts {toxinidir}/tests/functional/tests + [testenv] whitelist_externals = vagrant @@ -33,8 +46,8 @@ changedir= centos7_cluster: {toxinidir}/tests/functional/centos/7/cluster # tests a 1 mon, 1 osd, 1 mds and 1 rgw centos7 cluster using docker docker_cluster: {toxinidir}/tests/functional/centos/7/docker-cluster - # creates a cluster, purges the cluster and then brings the cluster back up - purge_cluster_collocated: {toxinidir}/tests/functional/centos/7/journal-collocation + purge_cluster: {toxinidir}/tests/functional/centos/7/cluster + purge_dmcrypt: {toxinidir}/tests/functional/centos/7/dmcrypt-dedicated-journal commands= vagrant up --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} @@ -44,10 +57,7 @@ commands= testinfra -n 4 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts {toxinidir}/tests/functional/tests - purge_cluster_collocated: cp {toxinidir}/infrastructure-playbooks/purge-cluster.yml {toxinidir}/purge-cluster.yml - purge_cluster_collocated: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/purge-cluster.yml --extra-vars="ireallymeanit=yes fetch_directory={changedir}/fetch" - # set up the cluster again - purge_cluster_collocated: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars="fetch_directory={changedir}/fetch" - # test that the cluster can be redeployed in a healthy state - purge_cluster_collocated: testinfra -n 4 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts {toxinidir}/tests/functional/tests + purge_cluster: {[purge]commands} + purge_dmcrypt: {[purge]commands} + vagrant destroy --force From b2a6f095f1199a318a7ffaaf00f643811d336b02 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 26 Jan 2017 11:28:30 -0600 Subject: [PATCH 3/5] purge-cluster: fix syntax when deleting dmcrypt devices Signed-off-by: Andrew Schoen --- infrastructure-playbooks/purge-cluster.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index e09b9552e..133d25fef 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -407,7 +407,7 @@ - name: delete dm-crypt devices if any command: dmsetup remove {{ item }} - with_items: encrypted_ceph_partuuid.stdout_lines + with_items: "{{ encrypted_ceph_partuuid.stdout_lines }}" when: "{{ encrypted_ceph_partuuid.stdout_lines | length > 0 }}" - name: zap osd disks From d3cb8dba4e05f2081051855949b8ec5de34b19f0 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 26 Jan 2017 12:07:42 -0600 Subject: [PATCH 4/5] purge-cluster: fix failure when raw_multi_journal is not defined Because the purge-cluster.yml playbook does not have access to the roles default vars then we can be sure that raw_multi_journal is defined. For example, if this was purging a dmcrypt journal then raw_multi_journal might not be defined at all in group_vars/all.yml or group_vars/osds.yml. Signed-off-by: Andrew Schoen --- infrastructure-playbooks/purge-cluster.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 133d25fef..70a3893dd 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -439,6 +439,7 @@ with_items: "{{ ceph_journal_partition_to_erase_path.stdout_lines }}" when: - ceph_journal_partlabels.rc == 0 + - raw_multi_journal is defined - raw_multi_journal From 2a87c13f17ed155a60e689909e28b4c18b927586 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Fri, 27 Jan 2017 06:12:10 -0600 Subject: [PATCH 5/5] tests/purge_cluster: setup a xenial cluster instead of centos7 The purge_dmcrypt scenario also tests centos7, so change this one to xenial so we can have more test coverage. Signed-off-by: Andrew Schoen --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8aba9687a..30fb7a4a1 100644 --- a/tox.ini +++ b/tox.ini @@ -46,7 +46,7 @@ changedir= centos7_cluster: {toxinidir}/tests/functional/centos/7/cluster # tests a 1 mon, 1 osd, 1 mds and 1 rgw centos7 cluster using docker docker_cluster: {toxinidir}/tests/functional/centos/7/docker-cluster - purge_cluster: {toxinidir}/tests/functional/centos/7/cluster + purge_cluster: {toxinidir}/tests/functional/ubuntu/16.04/cluster purge_dmcrypt: {toxinidir}/tests/functional/centos/7/dmcrypt-dedicated-journal commands= vagrant up --no-provision {posargs:--provider=virtualbox}