Skip to content

Commit db679cf

Browse files
committed
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 <[email protected]>
1 parent ae34c10 commit db679cf

File tree

5 files changed

+45
-35
lines changed

5 files changed

+45
-35
lines changed

Diff for: group_vars/osds.yml.sample

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ dummy:
148148
# - "{{ crush_rule_hdd }}"
149149
# - "{{ crush_rule_ssd }}"
150150

151+
#ceph_ec_profiles: {}
152+
151153
# Caution: this will create crush roots and racks according to hostvars {{ osd_crush_location }}
152154
# and will move hosts into them which might lead to significant data movement in the cluster!
153155
#

Diff for: roles/ceph-osd/defaults/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ crush_rules:
140140
- "{{ crush_rule_hdd }}"
141141
- "{{ crush_rule_ssd }}"
142142

143+
ceph_ec_profiles: {}
144+
143145
# Caution: this will create crush roots and racks according to hostvars {{ osd_crush_location }}
144146
# and will move hosts into them which might lead to significant data movement in the cluster!
145147
#

Diff for: roles/ceph-osd/tasks/crush_rules.yml

+29-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,39 @@
1010
- hostvars[groups[mon_group_name][0]]['create_crush_tree'] | default(create_crush_tree) | bool
1111
- osd_crush_location is defined
1212

13+
- name: Create configured ec profiles
14+
ceph_ec_profile:
15+
name: "{{ item.key }}"
16+
cluster: "{{ cluster }}"
17+
state: "{{ item.value.state | default('present') }}"
18+
stripe_unit: "{{ item.value.stripe_unit | default(omit) }}"
19+
plugin: "{{ item.value.plugin | default(omit) }}"
20+
k: "{{ item.value.k }}"
21+
m: "{{ item.value.m }}"
22+
d: "{{ item.value.d | default(omit) }}"
23+
l: "{{ item.value.l | default(omit) }}"
24+
c: "{{ item.value.c | default(omit) }}"
25+
scalar_mds: "{{ item.value.scalar_mds | default(omit) }}"
26+
technique: "{{ item.value.technique | default(omit) }}"
27+
crush_root: "{{ item.value.crush_root | default(omit) }}"
28+
crush_failure_domain: "{{ item.value.crush_failure_domain | default(omit) }}"
29+
crush_device_class: "{{ item.value.crush_device_class | default(omit) }}"
30+
force: "{{ item.value.force | default(false) }}"
31+
environment:
32+
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
33+
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
34+
loop: "{{ ceph_ec_profiles | dict2items }}"
35+
delegate_to: '{{ groups[mon_group_name][0] }}'
36+
run_once: true
37+
1338
- name: Create configured crush rules
1439
ceph_crush_rule:
1540
name: "{{ item.name }}"
1641
cluster: "{{ cluster }}"
17-
rule_type: replicated
18-
bucket_root: "{{ item.root }}"
19-
bucket_type: "{{ item.type }}"
42+
rule_type: "{{ item.rule_type | default('replicated') }}"
43+
profile: "{{ item.ec_profile | default(omit) }}"
44+
bucket_root: "{{ item.root | default(omit) }}"
45+
bucket_type: "{{ item.type | default(omit) }}"
2046
device_class: "{{ item.class | default(omit) }}"
2147
environment:
2248
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"

Diff for: roles/ceph-rgw/tasks/rgw_create_pools.yml

+10-32
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
ceph_ec_profile:
44
name: "{{ item.value.ec_profile }}"
55
cluster: "{{ cluster }}"
6-
k: "{{ item.value.ec_k }}"
7-
m: "{{ item.value.ec_m }}"
6+
k: "{{ item.value.ec_k | default(omit) }}"
7+
m: "{{ item.value.ec_m | default(omit) }}"
88
crush_device_class: "{{ item.value.ec_crush_device_class | default(omit) }}"
99
delegate_to: "{{ groups[mon_group_name][0] }}"
1010
loop: "{{ rgw_create_pools | dict2items }}"
1111
when:
12-
- item.value.type is defined
13-
- item.value.type == 'ec'
12+
- item.value.create_profile | default(true)
13+
- item.value.type | default('') == 'ec'
1414
environment:
1515
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
1616
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
@@ -27,32 +27,10 @@
2727
loop: "{{ rgw_create_pools | dict2items }}"
2828
delegate_to: "{{ groups[mon_group_name][0] }}"
2929
when:
30-
- item.value.type is defined
31-
- item.value.type == 'ec'
30+
- item.value.create_profile | default(true)
31+
- item.value.type | default('') == 'ec'
3232

33-
- name: Create ec pools for rgw
34-
ceph_pool:
35-
name: "{{ item.key }}"
36-
state: present
37-
cluster: "{{ cluster }}"
38-
pg_num: "{{ item.value.pg_num | default(omit) }}"
39-
pgp_num: "{{ item.value.pgp_num | default(omit) }}"
40-
size: "{{ item.value.size | default(omit) }}"
41-
pg_autoscale_mode: "{{ item.value.pg_autoscale_mode | default(omit) }}"
42-
target_size_ratio: "{{ item.value.target_size_ratio | default(omit) }}"
43-
pool_type: erasure
44-
erasure_profile: "{{ item.value.ec_profile }}"
45-
application: rgw
46-
loop: "{{ rgw_create_pools | dict2items }}"
47-
delegate_to: "{{ groups[mon_group_name][0] }}"
48-
when:
49-
- item.value.type is defined
50-
- item.value.type == 'ec'
51-
environment:
52-
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
53-
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
54-
55-
- name: Create replicated pools for rgw
33+
- name: Create rgw pools
5634
ceph_pool:
5735
name: "{{ item.key }}"
5836
state: present
@@ -63,12 +41,12 @@
6341
min_size: "{{ item.value.min_size | default(omit) }}"
6442
pg_autoscale_mode: "{{ item.value.pg_autoscale_mode | default(omit) }}"
6543
target_size_ratio: "{{ item.value.target_size_ratio | default(omit) }}"
66-
pool_type: replicated
67-
rule_name: "{{ item.value.rule_name | default(ceph_osd_pool_default_crush_rule_name) }}"
44+
pool_type: "{{ 'erasure' if item.value.type | default('') == 'ec' else 'replicated' }}"
45+
erasure_profile: "{{ item.value.ec_profile | default(omit) }}"
46+
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 }}"
6847
application: rgw
6948
loop: "{{ rgw_create_pools | dict2items }}"
7049
delegate_to: "{{ groups[mon_group_name][0] }}"
71-
when: item.value.type is not defined or item.value.type == 'replicated'
7250
environment:
7351
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
7452
CEPH_CONTAINER_BINARY: "{{ container_binary }}"

Diff for: roles/ceph-validate/tasks/check_rgw_pools.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
when:
1616
- item.value.type is defined
1717
- item.value.type == 'ec'
18+
- item.value.create_profile | default(true)
1819
- item.value.ec_k is undefined
1920

2021
- name: Fail if ec_m is not set for ec pools
@@ -24,4 +25,5 @@
2425
when:
2526
- item.value.type is defined
2627
- item.value.type == 'ec'
28+
- item.value.create_profile | default(true)
2729
- item.value.ec_m is undefined

0 commit comments

Comments
 (0)