From bd016960cf188538d0c4363dd0ad9ab59be35cc7 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Thu, 31 Oct 2019 16:24:12 -0400 Subject: [PATCH] ceph-osd: add device class to crush rules This adds device class support to crush rules when using the class key in the rule dict via the create-replicated sub command. If the class key isn't specified then we use the create-simple sub command for backward compatibility. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1636508 Signed-off-by: Dimitri Savineau (cherry picked from commit ef2cb99f739ade80e285d83050ac01184aafc753) --- group_vars/mons.yml.sample | 6 ++++-- roles/ceph-mon/defaults/main.yml | 6 ++++-- roles/ceph-osd/tasks/crush_rules.yml | 2 +- tests/functional/all_daemons/container/group_vars/mons | 3 ++- tests/functional/all_daemons/group_vars/mons | 3 ++- tests/functional/podman/group_vars/mons | 3 ++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/group_vars/mons.yml.sample b/group_vars/mons.yml.sample index 5644dc7e1..6f79ae41b 100644 --- a/group_vars/mons.yml.sample +++ b/group_vars/mons.yml.sample @@ -43,14 +43,16 @@ dummy: #crush_rule_hdd: # name: HDD -# root: HDD +# root: default # type: host +# class: hdd # default: false #crush_rule_ssd: # name: SSD -# root: SSD +# root: default # type: host +# class: ssd # default: false #crush_rules: diff --git a/roles/ceph-mon/defaults/main.yml b/roles/ceph-mon/defaults/main.yml index f4460a708..46d20d506 100644 --- a/roles/ceph-mon/defaults/main.yml +++ b/roles/ceph-mon/defaults/main.yml @@ -35,14 +35,16 @@ crush_rule_config: false crush_rule_hdd: name: HDD - root: HDD + root: default type: host + class: hdd default: false crush_rule_ssd: name: SSD - root: SSD + root: default type: host + class: ssd default: false crush_rules: diff --git a/roles/ceph-osd/tasks/crush_rules.yml b/roles/ceph-osd/tasks/crush_rules.yml index 02e5bef51..edeedc1ba 100644 --- a/roles/ceph-osd/tasks/crush_rules.yml +++ b/roles/ceph-osd/tasks/crush_rules.yml @@ -11,7 +11,7 @@ - osd_crush_location is defined - name: create configured crush rules - command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd crush rule create-simple {{ item.name }} {{ item.root }} {{ item.type }}" + command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd crush rule {{ 'create-replicated' if item.class is defined else 'create-simple' }} {{ item.name }} {{ item.root }} {{ item.type }} {{ item.class | default('') }}" changed_when: false with_items: "{{ hostvars[groups[mon_group_name][0]]['crush_rules'] | unique }}" delegate_to: '{{ groups[mon_group_name][0] }}' diff --git a/tests/functional/all_daemons/container/group_vars/mons b/tests/functional/all_daemons/container/group_vars/mons index 4b5405947..7b31aa922 100644 --- a/tests/functional/all_daemons/container/group_vars/mons +++ b/tests/functional/all_daemons/container/group_vars/mons @@ -3,8 +3,9 @@ create_crush_tree: True crush_rule_config: True crush_rule_hdd: name: HDD - root: HDD + root: default type: host + class: hdd default: true crush_rules: - "{{ crush_rule_hdd }}" diff --git a/tests/functional/all_daemons/group_vars/mons b/tests/functional/all_daemons/group_vars/mons index 4b8817342..f6ab9a541 100644 --- a/tests/functional/all_daemons/group_vars/mons +++ b/tests/functional/all_daemons/group_vars/mons @@ -3,8 +3,9 @@ create_crush_tree: True crush_rule_config: True crush_rule_hdd: name: HDD - root: HDD + root: default type: host + class: hdd default: true crush_rules: - "{{ crush_rule_hdd }}" \ No newline at end of file diff --git a/tests/functional/podman/group_vars/mons b/tests/functional/podman/group_vars/mons index 4b5405947..7b31aa922 100644 --- a/tests/functional/podman/group_vars/mons +++ b/tests/functional/podman/group_vars/mons @@ -3,8 +3,9 @@ create_crush_tree: True crush_rule_config: True crush_rule_hdd: name: HDD - root: HDD + root: default type: host + class: hdd default: true crush_rules: - "{{ crush_rule_hdd }}"