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 <dsavinea@redhat.com>
pull/4747/head
Dimitri Savineau 2019-10-31 16:24:12 -04:00 committed by Guillaume Abrioux
parent ed36a11eab
commit ef2cb99f73
6 changed files with 15 additions and 8 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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] }}'

View File

@ -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 }}"

View File

@ -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 }}"

View File

@ -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 }}"