From de933cd3c82b6a7d5c4ddfa77804509c9fcaa3db Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Wed, 13 Nov 2019 13:16:55 +0100 Subject: [PATCH] mgr/dashboard: Fix pool renaming functionality MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The problem was that, if a pool was renamed the routine to update tried to work on the old pool name and didn't used the info that the pool got renamed, therefore an error occurred in the UI saying that the pool could not be found. Fixes: https://tracker.ceph.com/issues/42776 Signed-off-by: Stephan Müller --- qa/tasks/mgr/dashboard/test_pool.py | 10 ++++++++++ src/pybind/mgr/dashboard/controllers/pool.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/qa/tasks/mgr/dashboard/test_pool.py b/qa/tasks/mgr/dashboard/test_pool.py index af610673ba1..390572bea6d 100644 --- a/qa/tasks/mgr/dashboard/test_pool.py +++ b/qa/tasks/mgr/dashboard/test_pool.py @@ -298,6 +298,16 @@ class PoolTest(DashboardTestCase): self._validate_pool_properties(pool['pool_quotas_to_check'], self._get_pool(pool_name)) + def test_pool_update_name(self): + name = 'pool_update' + updated_name = 'pool_updated_name' + with self.__yield_pool(name, None, updated_name): + props = {'pool': updated_name} + self._task_put('/api/pool/{}'.format(name), props) + time.sleep(5) + self.assertStatus(200) + self._validate_pool_properties(props, self._get_pool(updated_name)) + def test_pool_update_metadata(self): pool_name = 'pool_update_metadata' with self.__yield_pool(pool_name): diff --git a/src/pybind/mgr/dashboard/controllers/pool.py b/src/pybind/mgr/dashboard/controllers/pool.py index 3139e1ab82f..a7a422caccd 100644 --- a/src/pybind/mgr/dashboard/controllers/pool.py +++ b/src/pybind/mgr/dashboard/controllers/pool.py @@ -83,6 +83,8 @@ class Pool(RESTController): @pool_task('edit', ['{pool_name}']) def set(self, pool_name, flags=None, application_metadata=None, configuration=None, **kwargs): self._set_pool_values(pool_name, application_metadata, flags, True, kwargs) + if kwargs.get('pool'): + pool_name = kwargs['pool'] RbdConfiguration(pool_name).set_configuration(configuration) self._wait_for_pgs(pool_name) -- 2.39.5