From: alfonsomthd Date: Wed, 19 Dec 2018 15:09:38 +0000 (+0100) Subject: mgr/dashboard: pool stats not returned by default X-Git-Tag: v14.1.0~507^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25635%2Fhead;p=ceph.git mgr/dashboard: pool stats not returned by default * All pool controller methods with same default value for stats flag. * Stats requested explicitly by frontend service. * Updated API tests accordingly. Fixes: https://tracker.ceph.com/issues/36740 Signed-off-by: Alfonso Martínez --- diff --git a/qa/tasks/mgr/dashboard/test_pool.py b/qa/tasks/mgr/dashboard/test_pool.py index c0330ece6f59..9851397815e8 100644 --- a/qa/tasks/mgr/dashboard/test_pool.py +++ b/qa/tasks/mgr/dashboard/test_pool.py @@ -127,8 +127,8 @@ class PoolTest(DashboardTestCase): self.assertEqual(len(cluster_pools), len(data)) self.assertSchemaBody(JList(self.pool_schema)) for pool in data: - self.assertIn('pg_status', pool) - self.assertIn('stats', pool) + self.assertNotIn('pg_status', pool) + self.assertNotIn('stats', pool) self.assertIn(pool['pool_name'], cluster_pools) def test_pool_list_attrs(self): @@ -146,8 +146,8 @@ class PoolTest(DashboardTestCase): self.assertNotIn('stats', pool) self.assertIn(pool['pool_name'], cluster_pools) - def test_pool_list_without_stats(self): - data = self._get("/api/pool?stats=false") + def test_pool_list_stats(self): + data = self._get("/api/pool?stats=true") self.assertStatus(200) cluster_pools = self.ceph_cluster.mon_manager.list_pools() @@ -157,8 +157,8 @@ class PoolTest(DashboardTestCase): self.assertIn('type', pool) self.assertIn('application_metadata', pool) self.assertIn('flags', pool) - self.assertNotIn('pg_status', pool) - self.assertNotIn('stats', pool) + self.assertIn('pg_status', pool) + self.assertIn('stats', pool) self.assertIn('flags_names', pool) self.assertIn(pool['pool_name'], cluster_pools) diff --git a/src/pybind/mgr/dashboard/controllers/pool.py b/src/pybind/mgr/dashboard/controllers/pool.py index a0aaee78e16a..cdd9a7110d45 100644 --- a/src/pybind/mgr/dashboard/controllers/pool.py +++ b/src/pybind/mgr/dashboard/controllers/pool.py @@ -54,7 +54,7 @@ class Pool(RESTController): return [self._serialize_pool(pool, attrs) for pool in pools] - def list(self, attrs=None, stats=True): + def list(self, attrs=None, stats=False): return self._pool_list(attrs, stats) def _get(self, pool_name, attrs=None, stats=False): diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts index e7cf7f1e5a67..a2acdc687cee 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts @@ -29,7 +29,7 @@ describe('PoolService', () => { it('should call getList', () => { service.getList().subscribe(); - const req = httpTesting.expectOne(apiPath); + const req = httpTesting.expectOne(`${apiPath}?stats=true`); expect(req.request.method).toBe('GET'); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts index 30a5c6ecaaad..12aa43c9fab8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts @@ -41,7 +41,7 @@ export class PoolService { } getList() { - return this.http.get(this.apiPath); + return this.http.get(`${this.apiPath}?stats=true`); } getInfo(): Observable {