From 8506f02fe1e0f6ce1bae6cae89ad98d72a4f3ff1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Wed, 20 Jun 2018 16:06:32 +0200 Subject: [PATCH] Small backend changes: MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * Assert `pg_placement_num` has the same value as `pg_num`. * Only set `application_metadata`, if not None. * `osd pool set` only accepts strings. * Sync `pgp_num` with `pg_num`. Signed-off-by: Stephan Müller --- qa/tasks/mgr/dashboard/test_pool.py | 2 ++ src/pybind/mgr/dashboard/controllers/pool.py | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qa/tasks/mgr/dashboard/test_pool.py b/qa/tasks/mgr/dashboard/test_pool.py index 81ce3d87ca907..ba43400ddd439 100644 --- a/qa/tasks/mgr/dashboard/test_pool.py +++ b/qa/tasks/mgr/dashboard/test_pool.py @@ -120,6 +120,8 @@ class PoolTest(DashboardTestCase): self.assertEqual(pool['type'], data['pool_type']) elif k == 'pg_num': self.assertEqual(pool[k], int(v), '{}: {} != {}'.format(k, pool[k], v)) + k = 'pg_placement_num' # Should have the same value as pg_num + self.assertEqual(pool[k], int(v), '{}: {} != {}'.format(k, pool[k], v)) elif k == 'application_metadata': self.assertIsInstance(pool[k], list) self.assertEqual(pool[k], diff --git a/src/pybind/mgr/dashboard/controllers/pool.py b/src/pybind/mgr/dashboard/controllers/pool.py index 3f82b8c0c5c04..8d1cd690cd008 100644 --- a/src/pybind/mgr/dashboard/controllers/pool.py +++ b/src/pybind/mgr/dashboard/controllers/pool.py @@ -90,7 +90,7 @@ class Pool(RESTController): if flags and 'ec_overwrites' in flags: CephService.send_command('mon', 'osd pool set', pool=pool, var='allow_ec_overwrites', val='true') - if application_metadata: + if application_metadata is not None: def set_app(what, app): CephService.send_command('mon', 'osd pool application ' + what, pool=pool, app=app, force='--yes-i-really-mean-it') @@ -107,7 +107,12 @@ class Pool(RESTController): set_app('enable', app) for key, value in kwargs.items(): - CephService.send_command('mon', 'osd pool set', pool=pool, var=key, val=value) + def set_key(key): + CephService.send_command('mon', 'osd pool set', pool=pool, var=key, val=str(value)) + + set_key(key) + if key == 'pg_num': + set_key('pgp_num') @Endpoint() @ReadPermission -- 2.39.5