@authenticate
def test_cephfs_clients(self):
fs_id = self.fs.get_namespace_id()
- data = self._get("/api/cephfs/clients/{}".format(fs_id))
+ data = self._get("/api/cephfs/{}/clients".format(fs_id))
self.assertStatus(200)
self.assertIn('status', data)
self.assertIn('data', data)
@authenticate
- def test_cephfs_data(self):
+ def test_cephfs_get(self):
fs_id = self.fs.get_namespace_id()
- data = self._get("/api/cephfs/data/{}/".format(fs_id))
+ data = self._get("/api/cephfs/{}/".format(fs_id))
self.assertStatus(200)
self.assertIn('cephfs', data)
@authenticate
def test_cephfs_mds_counters(self):
fs_id = self.fs.get_namespace_id()
- data = self._get("/api/cephfs/mds_counters/{}".format(fs_id))
+ data = self._get("/api/cephfs/{}/mds_counters".format(fs_id))
self.assertStatus(200)
self.assertIsInstance(data, dict)
@authenticate
def test_cephfs_mds_counters_wrong(self):
- data = self._get("/api/cephfs/mds_counters/baadbaad")
+ self._get("/api/cephfs/baadbaad/mds_counters")
self.assertStatus(400)
self.assertJsonBody({
"component": 'cephfs',
"code": "invalid_cephfs_id",
- "detail": "Invalid cephfs id baadbaad"
+ "detail": "Invalid cephfs ID baadbaad"
})
+ @authenticate
+ def test_cephfs_list(self):
+ data = self._get("/api/cephfs/")
+ self.assertStatus(200)
+ self.assertIsInstance(data, list)
+
+ cephfs = data[0]
+ self.assertIn('id', cephfs)
+ self.assertIn('mdsmap', cephfs)
+ self.assertIsNotNone(cephfs['id'])
+ self.assertIsNotNone(cephfs['mdsmap'])
import cherrypy
from ..exceptions import DashboardException
-from . import ApiController, AuthRequired, Endpoint, BaseController
+from . import ApiController, AuthRequired, RESTController
from .. import mgr
from ..services.ceph_service import CephService
from ..tools import ViewCache
@ApiController('/cephfs')
@AuthRequired()
-class CephFS(BaseController):
+class CephFS(RESTController):
def __init__(self):
super(CephFS, self).__init__()
# dict is FSCID
self.cephfs_clients = {}
- @Endpoint()
- def clients(self, fs_id):
+ def list(self):
+ fsmap = mgr.get("fs_map")
+ return fsmap['filesystems']
+
+ def get(self, fs_id):
fs_id = self.fs_id_to_int(fs_id)
- return self._clients(fs_id)
+ return self.fs_status(fs_id)
- @Endpoint()
- def data(self, fs_id):
+ @RESTController.Resource('GET')
+ def clients(self, fs_id):
fs_id = self.fs_id_to_int(fs_id)
- return self.fs_status(fs_id)
+ return self._clients(fs_id)
- @Endpoint()
+ @RESTController.Resource('GET')
def mds_counters(self, fs_id):
"""
Result format: map of daemon name to map of counter to list of datapoints
return int(fs_id)
except ValueError:
raise DashboardException(code='invalid_cephfs_id',
- msg="Invalid cephfs id {}".format(fs_id),
+ msg="Invalid cephfs ID {}".format(fs_id),
component='cephfs')
def _get_mds_names(self, filesystem_id=None):
constructor(private http: HttpClient) {}
+ list() {
+ return this.http.get(`${this.baseURL}`);
+ }
+
getCephfs(id) {
- return this.http.get(`${this.baseURL}/data/${id}`);
+ return this.http.get(`${this.baseURL}/${id}`);
}
getClients(id) {
- return this.http.get(`${this.baseURL}/clients/${id}`);
+ return this.http.get(`${this.baseURL}/${id}/clients`);
}
getMdsCounters(id) {
- return this.http.get(`${this.baseURL}/mds_counters/${id}`);
+ return this.http.get(`${this.baseURL}/${id}/mds_counters`);
}
}