From: Stephan Müller Date: Wed, 20 Jun 2018 14:06:32 +0000 (+0200) Subject: Small backend changes: X-Git-Tag: v14.0.1~716^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8506f02fe1e0f6ce1bae6cae89ad98d72a4f3ff1;p=ceph.git Small backend changes: * 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 --- diff --git a/qa/tasks/mgr/dashboard/test_pool.py b/qa/tasks/mgr/dashboard/test_pool.py index 81ce3d87ca9..ba43400ddd4 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 3f82b8c0c5c..8d1cd690cd0 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