ceph-osd: introduce ec profile creation

RGW Pools can now use the existing ec profiles and rules created by ceph-osd role.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
pull/7523/head
Seena Fallah 2024-03-14 15:49:31 +01:00 committed by Guillaume Abrioux
parent 80666a20da
commit bbc1ba5c05
5 changed files with 45 additions and 35 deletions

View File

@ -148,6 +148,8 @@ dummy:
# - "{{ crush_rule_hdd }}" # - "{{ crush_rule_hdd }}"
# - "{{ crush_rule_ssd }}" # - "{{ crush_rule_ssd }}"
#ceph_ec_profiles: {}
# Caution: this will create crush roots and racks according to hostvars {{ osd_crush_location }} # Caution: this will create crush roots and racks according to hostvars {{ osd_crush_location }}
# and will move hosts into them which might lead to significant data movement in the cluster! # and will move hosts into them which might lead to significant data movement in the cluster!
# #

View File

@ -140,6 +140,8 @@ crush_rules:
- "{{ crush_rule_hdd }}" - "{{ crush_rule_hdd }}"
- "{{ crush_rule_ssd }}" - "{{ crush_rule_ssd }}"
ceph_ec_profiles: {}
# Caution: this will create crush roots and racks according to hostvars {{ osd_crush_location }} # Caution: this will create crush roots and racks according to hostvars {{ osd_crush_location }}
# and will move hosts into them which might lead to significant data movement in the cluster! # and will move hosts into them which might lead to significant data movement in the cluster!
# #

View File

@ -10,13 +10,39 @@
- hostvars[groups[mon_group_name][0]]['create_crush_tree'] | default(create_crush_tree) | bool - hostvars[groups[mon_group_name][0]]['create_crush_tree'] | default(create_crush_tree) | bool
- osd_crush_location is defined - osd_crush_location is defined
- name: Create configured ec profiles
ceph_ec_profile:
name: "{{ item.key }}"
cluster: "{{ cluster }}"
state: "{{ item.value.state | default('present') }}"
stripe_unit: "{{ item.value.stripe_unit | default(omit) }}"
plugin: "{{ item.value.plugin | default(omit) }}"
k: "{{ item.value.k }}"
m: "{{ item.value.m }}"
d: "{{ item.value.d | default(omit) }}"
l: "{{ item.value.l | default(omit) }}"
c: "{{ item.value.c | default(omit) }}"
scalar_mds: "{{ item.value.scalar_mds | default(omit) }}"
technique: "{{ item.value.technique | default(omit) }}"
crush_root: "{{ item.value.crush_root | default(omit) }}"
crush_failure_domain: "{{ item.value.crush_failure_domain | default(omit) }}"
crush_device_class: "{{ item.value.crush_device_class | default(omit) }}"
force: "{{ item.value.force | default(false) }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
loop: "{{ ceph_ec_profiles | dict2items }}"
delegate_to: '{{ groups[mon_group_name][0] }}'
run_once: true
- name: Create configured crush rules - name: Create configured crush rules
ceph_crush_rule: ceph_crush_rule:
name: "{{ item.name }}" name: "{{ item.name }}"
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
rule_type: replicated rule_type: "{{ item.rule_type | default('replicated') }}"
bucket_root: "{{ item.root }}" profile: "{{ item.ec_profile | default(omit) }}"
bucket_type: "{{ item.type }}" bucket_root: "{{ item.root | default(omit) }}"
bucket_type: "{{ item.type | default(omit) }}"
device_class: "{{ item.class | default(omit) }}" device_class: "{{ item.class | default(omit) }}"
environment: environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"

View File

@ -3,14 +3,14 @@
ceph_ec_profile: ceph_ec_profile:
name: "{{ item.value.ec_profile }}" name: "{{ item.value.ec_profile }}"
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
k: "{{ item.value.ec_k }}" k: "{{ item.value.ec_k | default(omit) }}"
m: "{{ item.value.ec_m }}" m: "{{ item.value.ec_m | default(omit) }}"
crush_device_class: "{{ item.value.ec_crush_device_class | default(omit) }}" crush_device_class: "{{ item.value.ec_crush_device_class | default(omit) }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
loop: "{{ rgw_create_pools | dict2items }}" loop: "{{ rgw_create_pools | dict2items }}"
when: when:
- item.value.type is defined - item.value.create_profile | default(true)
- item.value.type == 'ec' - item.value.type | default('') == 'ec'
environment: environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}"
@ -27,32 +27,10 @@
loop: "{{ rgw_create_pools | dict2items }}" loop: "{{ rgw_create_pools | dict2items }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
when: when:
- item.value.type is defined - item.value.create_profile | default(true)
- item.value.type == 'ec' - item.value.type | default('') == 'ec'
- name: Create ec pools for rgw - name: Create rgw pools
ceph_pool:
name: "{{ item.key }}"
state: present
cluster: "{{ cluster }}"
pg_num: "{{ item.value.pg_num | default(omit) }}"
pgp_num: "{{ item.value.pgp_num | default(omit) }}"
size: "{{ item.value.size | default(omit) }}"
pg_autoscale_mode: "{{ item.value.pg_autoscale_mode | default(omit) }}"
target_size_ratio: "{{ item.value.target_size_ratio | default(omit) }}"
pool_type: erasure
erasure_profile: "{{ item.value.ec_profile }}"
application: rgw
loop: "{{ rgw_create_pools | dict2items }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
when:
- item.value.type is defined
- item.value.type == 'ec'
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: Create replicated pools for rgw
ceph_pool: ceph_pool:
name: "{{ item.key }}" name: "{{ item.key }}"
state: present state: present
@ -63,12 +41,12 @@
min_size: "{{ item.value.min_size | default(omit) }}" min_size: "{{ item.value.min_size | default(omit) }}"
pg_autoscale_mode: "{{ item.value.pg_autoscale_mode | default(omit) }}" pg_autoscale_mode: "{{ item.value.pg_autoscale_mode | default(omit) }}"
target_size_ratio: "{{ item.value.target_size_ratio | default(omit) }}" target_size_ratio: "{{ item.value.target_size_ratio | default(omit) }}"
pool_type: replicated pool_type: "{{ 'erasure' if item.value.type | default('') == 'ec' else 'replicated' }}"
rule_name: "{{ item.value.rule_name | default(ceph_osd_pool_default_crush_rule_name) }}" erasure_profile: "{{ item.value.ec_profile | default(omit) }}"
rule_name: "{{ item.value.rule_name if item.value.rule_name is defined else item.key if item.value.type | default('') == 'ec' else ceph_osd_pool_default_crush_rule_name }}"
application: rgw application: rgw
loop: "{{ rgw_create_pools | dict2items }}" loop: "{{ rgw_create_pools | dict2items }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
when: item.value.type is not defined or item.value.type == 'replicated'
environment: environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}"

View File

@ -15,6 +15,7 @@
when: when:
- item.value.type is defined - item.value.type is defined
- item.value.type == 'ec' - item.value.type == 'ec'
- item.value.create_profile | default(true)
- item.value.ec_k is undefined - item.value.ec_k is undefined
- name: Fail if ec_m is not set for ec pools - name: Fail if ec_m is not set for ec pools
@ -24,4 +25,5 @@
when: when:
- item.value.type is defined - item.value.type is defined
- item.value.type == 'ec' - item.value.type == 'ec'
- item.value.create_profile | default(true)
- item.value.ec_m is undefined - item.value.ec_m is undefined