From: Kiefer Chang Date: Thu, 16 May 2019 07:53:35 +0000 (+0800) Subject: mgr/dashboard: fix backend error when updating RBD interlocked features X-Git-Tag: v15.1.0~2656^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F28147%2Fhead;p=ceph.git mgr/dashboard: fix backend error when updating RBD interlocked features Now object-map and fast-diff features are interlocked. Allow enabling/disabling these two features together without raising an already enabled/disabled error. Fixes: http://tracker.ceph.com/issues/39933 Signed-off-by: Kiefer Chang --- diff --git a/qa/tasks/mgr/dashboard/test_rbd.py b/qa/tasks/mgr/dashboard/test_rbd.py index 25725f2320e5..617e97c76b66 100644 --- a/qa/tasks/mgr/dashboard/test_rbd.py +++ b/qa/tasks/mgr/dashboard/test_rbd.py @@ -479,6 +479,7 @@ class RbdTest(DashboardTestCase): self._validate_image(img, features_name=["layering"]) self.edit_image('rbd', 'edit_img', features=["fast-diff", "object-map", "exclusive-lock"]) + self.assertStatus(200) img = self._get('/api/block/image/rbd/edit_img') self.assertStatus(200) self._validate_image(img, features_name=['exclusive-lock', @@ -486,6 +487,7 @@ class RbdTest(DashboardTestCase): 'object-map']) self.edit_image('rbd', 'edit_img', features=["journaling", "exclusive-lock"]) + self.assertStatus(200) img = self._get('/api/block/image/rbd/edit_img') self.assertStatus(200) self._validate_image(img, features_name=['exclusive-lock', diff --git a/src/pybind/mgr/dashboard/controllers/rbd.py b/src/pybind/mgr/dashboard/controllers/rbd.py index ea1f2043d7e0..24c068a7e5f6 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd.py +++ b/src/pybind/mgr/dashboard/controllers/rbd.py @@ -275,12 +275,16 @@ class Rbd(RESTController): _sort_features(curr_features, enable=False) for feature in curr_features: if feature not in features and feature in self.ALLOW_DISABLE_FEATURES: + if feature not in format_bitmask(image.features()): + continue f_bitmask = format_features([feature]) image.update_features(f_bitmask, False) # check enabled features _sort_features(features) for feature in features: if feature not in curr_features and feature in self.ALLOW_ENABLE_FEATURES: + if feature in format_bitmask(image.features()): + continue f_bitmask = format_features([feature]) image.update_features(f_bitmask, True)