]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/controllers/erasure_code_profile.py
ca63ba286a4b1a3c7bee597a21ff12d1e2e70b05
1 # -*- coding: utf-8 -*-
2 from __future__
import absolute_import
4 from cherrypy
import NotFound
6 from . import ApiController
, RESTController
, Endpoint
, ReadPermission
, UiApiController
7 from ..security
import Scope
8 from ..services
.ceph_service
import CephService
12 @ApiController('/erasure_code_profile', Scope
.POOL
)
13 class ErasureCodeProfile(RESTController
):
15 create() supports additional key-value arguments that are passed to the
20 return CephService
.get_erasure_code_profiles()
23 profiles
= CephService
.get_erasure_code_profiles()
27 raise NotFound('No such erasure code profile')
29 def create(self
, name
, **kwargs
):
30 profile
= ['{}={}'.format(key
, value
) for key
, value
in kwargs
.items()]
31 CephService
.send_command('mon', 'osd erasure-code-profile set', name
=name
,
34 def delete(self
, name
):
35 CephService
.send_command('mon', 'osd erasure-code-profile rm', name
=name
)
38 @UiApiController('/erasure_code_profile', Scope
.POOL
)
39 class ErasureCodeProfileUi(ErasureCodeProfile
):
43 '''Used for profile creation and editing'''
44 config
= mgr
.get('config')
45 osd_map_crush
= mgr
.get('osd_map_crush')
47 # Because 'shec' is experimental it's not included
48 'plugins': config
['osd_erasure_code_plugins'].split() + ['shec'],
49 'directory': config
['erasure_code_dir'],
50 'devices': list({device
['class'] for device
in osd_map_crush
['devices']}),
51 'failure_domains': [domain
['name'] for domain
in osd_map_crush
['types']],
52 'names': [name
for name
, _
in
53 mgr
.get('osd_map').get('erasure_code_profiles', {}).items()]