self.assert_in_and_not_none(data['histogram'], ['osd'])
self.assert_in_and_not_none(data['histogram']['osd'], ['op_w_latency_in_bytes_histogram',
'op_r_latency_out_bytes_histogram'])
+
+ @authenticate
+ def test_scrub(self):
+ self._post('/api/osd/0/scrub?deep=False')
+ self.assertStatus(200)
+
+ self._post('/api/osd/0/scrub?deep=True')
+ self.assertStatus(200)
from . import ApiController, AuthRequired, RESTController
from .. import mgr
+
from ..services.ceph_service import CephService
from ..services.exception import handle_send_command_error
+from ..tools import str_to_bool
@ApiController('/osd')
'osd_metadata': mgr.get_metadata('osd', svc_id),
'histogram': histogram,
}
+
+ @RESTController.Resource('POST', query_params=['deep'])
+ def scrub(self, svc_id, deep=False):
+ api_scrub = "osd deep-scrub" if str_to_bool(deep) else "osd scrub"
+ CephService.send_command("mon", api_scrub, who=svc_id)
export class OsdService {
private path = 'api/osd';
- constructor (private http: HttpClient) {}
+ constructor(private http: HttpClient) {}
- getList () {
+ getList() {
return this.http.get(`${this.path}`);
}
getDetails(id: number) {
return this.http.get(`${this.path}/${id}`);
}
+
+ scrub(id, deep) {
+ return this.http.post(`${this.path}/${id}/scrub?deep=${deep}`, null);
+ }
}