]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: pool stats not returned by default 25635/head
authoralfonsomthd <almartin@redhat.com>
Wed, 19 Dec 2018 15:09:38 +0000 (16:09 +0100)
committeralfonsomthd <almartin@redhat.com>
Mon, 24 Dec 2018 07:48:38 +0000 (08:48 +0100)
* 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 <almartin@redhat.com>
qa/tasks/mgr/dashboard/test_pool.py
src/pybind/mgr/dashboard/controllers/pool.py
src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts

index c0330ece6f59f6ff2b3f727e66edfc8b963d737c..9851397815e82ede23b2da9e4c283399b47fdc44 100644 (file)
@@ -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)
 
index a0aaee78e16a0fbcf73af5748b22128c13a094e7..cdd9a7110d45d1684feb76d544fa4f35c032caf4 100644 (file)
@@ -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):
index e7cf7f1e5a676f44434b080c84fc8e6b3f8b5da0..a2acdc687ceef83325375152d7722c15b64fa7e6 100644 (file)
@@ -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');
   });
 
index 30a5c6ecaaadf62041e6f690a6d8774978ff23af..12aa43c9fab846de5aef94d3a7f92efdab37ec4e 100644 (file)
@@ -41,7 +41,7 @@ export class PoolService {
   }
 
   getList() {
-    return this.http.get(this.apiPath);
+    return this.http.get(`${this.apiPath}?stats=true`);
   }
 
   getInfo(): Observable<PoolFormInfo> {