]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/controllers/erasure_code_profile.py
1 # -*- coding: utf-8 -*-
2 from __future__
import absolute_import
4 from cherrypy
import NotFound
6 from . import ApiController
, ControllerDoc
, RESTController
, Endpoint
, ReadPermission
, \
8 from ..security
import Scope
9 from ..services
.ceph_service
import CephService
13 @ApiController('/erasure_code_profile', Scope
.POOL
)
14 class ErasureCodeProfile(RESTController
):
16 create() supports additional key-value arguments that are passed to the
21 return CephService
.get_erasure_code_profiles()
24 profiles
= CephService
.get_erasure_code_profiles()
28 raise NotFound('No such erasure code profile')
30 def create(self
, name
, **kwargs
):
31 profile
= ['{}={}'.format(key
, value
) for key
, value
in kwargs
.items()]
32 CephService
.send_command('mon', 'osd erasure-code-profile set', name
=name
,
35 def delete(self
, name
):
36 CephService
.send_command('mon', 'osd erasure-code-profile rm', name
=name
)
39 @UiApiController('/erasure_code_profile', Scope
.POOL
)
40 @ControllerDoc("Dashboard UI helper function; not part of the public API", "ErasureCodeProfileUi")
41 class ErasureCodeProfileUi(ErasureCodeProfile
):
46 Used for profile creation and editing
48 config
= mgr
.get('config')
50 # Because 'shec' is experimental it's not included
51 'plugins': config
['osd_erasure_code_plugins'].split() + ['shec'],
52 'directory': config
['erasure_code_dir'],
53 'nodes': mgr
.get('osd_map_tree')['nodes'],
54 'names': [name
for name
, _
in
55 mgr
.get('osd_map').get('erasure_code_profiles', {}).items()]