From 3a0e168a76beaf8fb43c6afa56c6cf2b634a8aa8 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 23 May 2018 05:07:38 +0200 Subject: [PATCH] mdss: move cephfs pools creation in ceph-mds When deploying a large number of OSD nodes it can be an issue because the protection check [1] won't pass since it tries to create pools before all OSDs are active. The idea here is to move cephfs pools creation in `ceph-mds` role. [1] https://github.com/ceph/ceph/blob/e59258943bcfe3e52d40a59ff30df55e1e6a3865/src/mon/OSDMonitor.cc#L5673 Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1578086 Signed-off-by: Guillaume Abrioux --- .../ceph-mds/tasks/create_mds_filesystems.yml | 37 +++++++++++++++++++ roles/ceph-mds/tasks/main.yml | 5 +++ .../ceph-mon/tasks/create_mds_filesystems.yml | 32 ---------------- roles/ceph-mon/tasks/main.yml | 7 ---- roles/ceph-osd/tasks/main.yml | 2 +- 5 files changed, 43 insertions(+), 40 deletions(-) create mode 100644 roles/ceph-mds/tasks/create_mds_filesystems.yml delete mode 100644 roles/ceph-mon/tasks/create_mds_filesystems.yml diff --git a/roles/ceph-mds/tasks/create_mds_filesystems.yml b/roles/ceph-mds/tasks/create_mds_filesystems.yml new file mode 100644 index 000000000..9320c1544 --- /dev/null +++ b/roles/ceph-mds/tasks/create_mds_filesystems.yml @@ -0,0 +1,37 @@ +--- +- name: create filesystem pools + command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }}" + changed_when: false + delegate_to: "{{ groups[mon_group_name][0] }}" + with_items: + - "{{ cephfs_pools }}" + +- name: check if ceph filesystem already exists + command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs get {{ cephfs }}" + register: check_existing_cephfs + changed_when: false + delegate_to: "{{ groups[mon_group_name][0] }}" + failed_when: false + +- name: create ceph filesystem + command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}" + changed_when: false + delegate_to: "{{ groups[mon_group_name][0] }}" + when: + - check_existing_cephfs.rc != 0 + +- name: allow multimds + command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs set {{ cephfs }} allow_multimds true --yes-i-really-mean-it" + changed_when: false + delegate_to: "{{ groups[mon_group_name][0] }}" + when: + - ceph_release_num[ceph_release] >= ceph_release_num.jewel + - ceph_release_num[ceph_release] < ceph_release_num.mimic + +- name: set max_mds + command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs set {{ cephfs }} max_mds {{ mds_max_mds }}" + changed_when: false + delegate_to: "{{ groups[mon_group_name][0] }}" + when: + - ceph_release_num[ceph_release] >= ceph_release_num.jewel + - mds_max_mds > 1 diff --git a/roles/ceph-mds/tasks/main.yml b/roles/ceph-mds/tasks/main.yml index 18f6f81cf..adf971a10 100644 --- a/roles/ceph-mds/tasks/main.yml +++ b/roles/ceph-mds/tasks/main.yml @@ -8,6 +8,11 @@ - name: include common.yml include: common.yml +- name: include create_mds_filesystems.yml + include: create_mds_filesystems.yml + when: + - inventory_hostname == groups[mds_group_name] | first + - name: non_containerized.yml include: non_containerized.yml when: not containerized_deployment diff --git a/roles/ceph-mon/tasks/create_mds_filesystems.yml b/roles/ceph-mon/tasks/create_mds_filesystems.yml deleted file mode 100644 index 75df0a29b..000000000 --- a/roles/ceph-mon/tasks/create_mds_filesystems.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- name: create filesystem pools - command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }}" - changed_when: false - with_items: - - "{{ cephfs_pools }}" - -- name: check if ceph filesystem already exists - command: "{{docker_exec_cmd }} ceph --cluster {{ cluster }} fs get {{ cephfs }}" - register: check_existing_cephfs - changed_when: false - failed_when: false - -- name: create ceph filesystem - command: "{{ docker_exec_cmd}} ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}" - changed_when: false - when: - - check_existing_cephfs.rc != 0 - -- name: allow multimds - command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} fs set {{ cephfs }} allow_multimds true --yes-i-really-mean-it" - changed_when: false - when: - - ceph_release_num[ceph_release] >= ceph_release_num.jewel - - ceph_release_num[ceph_release] < ceph_release_num.mimic - -- name: set max_mds - command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} fs set {{ cephfs }} max_mds {{ mds_max_mds }}" - changed_when: false - when: - - ceph_release_num[ceph_release] >= ceph_release_num.jewel - - mds_max_mds > 1 diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index ad6b825b4..b3d046257 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -50,13 +50,6 @@ when: - openstack_keys_tmp is defined -- name: include create_mds_filesystems.yml - include: create_mds_filesystems.yml - when: - - groups[mds_group_name] is defined - - groups[mds_group_name]|length > 0 - - inventory_hostname == groups[mon_group_name] | last - - name: include calamari.yml include: calamari.yml when: calamari diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 4adade3b4..baa65a19b 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -92,4 +92,4 @@ include: openstack_config.yml when: - openstack_config - - inventory_hostname == groups[osd_group_name] | last \ No newline at end of file + - inventory_hostname == groups[osd_group_name] | last