Skip to content

Commit 825c64e

Browse files
authored
Merge pull request #86 from stackhpc/ec_plugins
Add support for choosing plugin in EC profiles
2 parents 1767d94 + 64c0750 commit 825c64e

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace: "stackhpc"
22
name: "cephadm"
3-
version: "1.12.2"
3+
version: "1.13.0"
44
readme: "README.md"
55
authors:
66
- "Michal Nasiadka"

plugins/modules/cephadm_ec_profile.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@
6262
- Compute coding chunks for each object and store them on different
6363
OSDs.
6464
required: false
65+
plugin:
66+
description:
67+
- Use the erasure code plugin to compute coding chunks and recover
68+
missing chunks.
69+
required: false
70+
directory:
71+
description:
72+
- Set the directory name from which the erasure code plugin is
73+
loaded.
74+
required: false
6575
crush_root:
6676
description:
6777
- The name of the crush bucket used for the first step of the CRUSH
@@ -84,7 +94,7 @@
8494
k: 4
8595
m: 2
8696
87-
- name: delete an erassure code profile
97+
- name: delete an erasure code profile
8898
cephadm_ec_profile:
8999
name: foo
90100
state: absent
@@ -106,7 +116,7 @@ def get_profile(module, name):
106116
return cmd
107117

108118

109-
def create_profile(module, name, k, m, stripe_unit, crush_device_class, force=False): # noqa: E501
119+
def create_profile(module, name, k, m, stripe_unit, crush_device_class, directory, plugin, force=False): # noqa: E501
110120
'''
111121
Create a profile
112122
'''
@@ -116,6 +126,10 @@ def create_profile(module, name, k, m, stripe_unit, crush_device_class, force=Fa
116126
args.append('stripe_unit={}'.format(stripe_unit))
117127
if crush_device_class:
118128
args.append('crush-device-class={}'.format(crush_device_class))
129+
if directory:
130+
args.append('directory={}'.format(plugin))
131+
if plugin:
132+
args.append('plugin={}'.format(plugin))
119133
if force:
120134
args.append('--force')
121135

@@ -147,6 +161,8 @@ def run_module():
147161
k=dict(type='str', required=False),
148162
m=dict(type='str', required=False),
149163
crush_device_class=dict(type='str', required=False, default=''),
164+
directory=dict(type='str', required=False),
165+
plugin=dict(type='str', required=False),
150166
)
151167

152168
module = AnsibleModule(
@@ -162,6 +178,8 @@ def run_module():
162178
k = module.params.get('k')
163179
m = module.params.get('m')
164180
crush_device_class = module.params.get('crush_device_class')
181+
directory = module.params.get('directory')
182+
plugin = module.params.get('plugin')
165183

166184
if module.check_mode:
167185
module.exit_json(
@@ -186,14 +204,18 @@ def run_module():
186204
if current_profile['k'] != k or \
187205
current_profile['m'] != m or \
188206
current_profile.get('stripe_unit', stripe_unit) != stripe_unit or \
189-
current_profile.get('crush-device-class', crush_device_class) != crush_device_class: # noqa: E501
207+
current_profile.get('crush-device-class', crush_device_class) != crush_device_class or \
208+
current_profile.get('directory', directory) != directory or \
209+
current_profile.get('plugin', plugin) != plugin: # noqa: E501
190210
rc, cmd, out, err = exec_command(module,
191211
create_profile(module,
192212
name,
193213
k,
194214
m,
195215
stripe_unit,
196216
crush_device_class, # noqa: E501
217+
directory,
218+
plugin,
197219
force=True)) # noqa: E501
198220
changed = True
199221
else:
@@ -203,7 +225,9 @@ def run_module():
203225
k,
204226
m,
205227
stripe_unit, # noqa: E501
206-
crush_device_class)) # noqa: E501
228+
crush_device_class, # noqa: E501
229+
directory,
230+
plugin))
207231
if rc == 0:
208232
changed = True
209233

roles/ec_profiles/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ This role creates/deletes Ceph EC profiles.
66

77
### Host prerequisites
88

9-
* The role assumes target hosts connection over SSH with user that has passwordless sudo configured.
10-
* Either direct Internet access or private registry with desired Ceph image accessible to all hosts is required.
9+
* The role assumes target host connection over SSH to the first MON server.
1110

1211
### Inventory
1312

@@ -17,11 +16,16 @@ This role assumes the existence of the following groups:
1716

1817
## Role variables
1918

20-
* `cephadm_ec_profiles`: A list of pools to define
19+
* `cephadm_ec_profiles`: A list of pools to manage.
2120
Example:
2221
```
2322
cephadm_ec_profiles:
24-
```
23+
- name: foo
24+
k: 4
25+
m: 2
26+
- name: delete_me
27+
state: absent
2528
26-
Check the `cephadm_ec_profile` module docs for supported key options.
29+
```
2730

31+
Check Erasure Code profiles [docs](https://docs.ceph.com/en/pacific/rados/operations/erasure-code-profile/#osd-erasure-code-profile-set) for supported key options.

roles/ec_profiles/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
stripe_unit: "{{ item.stripe_unit | default(omit) }}"
77
k: "{{ item.k }}"
88
m: "{{ item.m }}"
9+
plugin: "{{ item.plugin | default(omit) }}"
10+
directory: "{{ item.directory | default(omit) }}"
911
crush_root: "{{ item.crush_root | default(omit) }}"
1012
crush_device_class: "{{ item.crush_device_class | default(omit) }}"
1113
with_items: "{{ cephadm_ec_profiles }}"

0 commit comments

Comments
 (0)