mgr: module to test osd_perf_query methods

Signed-off-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
Mykola Golub 2018-10-03 15:25:27 +03:00
parent b18ddf4d37
commit 264ad39ff6
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1 @@
from .module import OSDPerfQuery

View File

@ -0,0 +1,34 @@
"""
osd_perf_query module
"""
from mgr_module import MgrModule
class OSDPerfQuery(MgrModule):
COMMANDS = [
{
"cmd": "osd perf query add "
"name=query,type=CephString,req=true",
"desc": "add osd perf query",
"perm": "w"
},
{
"cmd": "osd perf query remove "
"name=query_id,type=CephInt,req=true",
"desc": "remove osd perf query",
"perm": "w"
},
]
def handle_command(self, inbuf, cmd):
if cmd['prefix'] == "osd perf query add":
query_id = self.add_osd_perf_query(cmd['query'])
return 0, str(query_id), "added query " + cmd['query'] + " with id " + str(query_id)
elif cmd['prefix'] == "osd perf query remove":
self.remove_osd_perf_query(cmd['query_id'])
return 0, "", "removed query with id " + str(cmd['query_id'])
else:
raise NotImplementedError(cmd['prefix'])