]>
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
7 from ..security
import Scope
8 from ..services
.ceph_service
import CephService
9 from . import ApiController
, ControllerDoc
, Endpoint
, EndpointDoc
, \
10 ReadPermission
, RESTController
, UiApiController
13 "crush-failure-domain": (str, ''),
14 "k": (int, 'Number of data chunks'),
15 "m": (int, 'Number of coding chunks'),
16 "plugin": (str, 'Plugin Info'),
17 "technique": (str, ''),
18 "name": (str, 'Name of the profile')
22 @ApiController('/erasure_code_profile', Scope
.POOL
)
23 @ControllerDoc("Erasure Code Profile Management API", "ErasureCodeProfile")
24 class ErasureCodeProfile(RESTController
):
26 create() supports additional key-value arguments that are passed to the
29 @EndpointDoc("List Erasure Code Profile Information",
30 responses
={'200': [LIST_CODE__SCHEMA
]})
32 return CephService
.get_erasure_code_profiles()
35 profiles
= CephService
.get_erasure_code_profiles()
39 raise NotFound('No such erasure code profile')
41 def create(self
, name
, **kwargs
):
42 profile
= ['{}={}'.format(key
, value
) for key
, value
in kwargs
.items()]
43 CephService
.send_command('mon', 'osd erasure-code-profile set', name
=name
,
46 def delete(self
, name
):
47 CephService
.send_command('mon', 'osd erasure-code-profile rm', name
=name
)
50 @UiApiController('/erasure_code_profile', Scope
.POOL
)
51 @ControllerDoc("Dashboard UI helper function; not part of the public API", "ErasureCodeProfileUi")
52 class ErasureCodeProfileUi(ErasureCodeProfile
):
57 Used for profile creation and editing
59 config
= mgr
.get('config')
61 # Because 'shec' and 'clay' are experimental they're not included
62 'plugins': config
['osd_erasure_code_plugins'].split() + ['shec', 'clay'],
63 'directory': config
['erasure_code_dir'],
64 'nodes': mgr
.get('osd_map_tree')['nodes'],
65 'names': [name
for name
, _
in
66 mgr
.get('osd_map').get('erasure_code_profiles', {}).items()]