From 1d8bb72683b323018692313b40488f473a1c39ff Mon Sep 17 00:00:00 2001 From: alfonsomthd Date: Wed, 19 Dec 2018 16:09:38 +0100 Subject: [PATCH] mgr/dashboard: pool stats not returned by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * 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 --- qa/tasks/mgr/dashboard/test_pool.py | 12 ++++++------ src/pybind/mgr/dashboard/controllers/pool.py | 2 +- .../frontend/src/app/shared/api/pool.service.spec.ts | 2 +- .../frontend/src/app/shared/api/pool.service.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/qa/tasks/mgr/dashboard/test_pool.py b/qa/tasks/mgr/dashboard/test_pool.py index c0330ece6f59f..9851397815e82 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 a0aaee78e16a0..cdd9a7110d45d 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 e7cf7f1e5a676..a2acdc687ceef 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 30a5c6ecaaadf..12aa43c9fab84 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 { -- 2.39.5