From 024ef904848b70af4cf92df2132faed3b6d1c0de Mon Sep 17 00:00:00 2001 From: Kiefer Chang Date: Thu, 16 May 2019 15:53:35 +0800 Subject: [PATCH] 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 (cherry picked from commit d654e8c620537718cb85ccd4c327faedb001ad02) --- qa/tasks/mgr/dashboard/test_rbd.py | 2 ++ src/pybind/mgr/dashboard/controllers/rbd.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/qa/tasks/mgr/dashboard/test_rbd.py b/qa/tasks/mgr/dashboard/test_rbd.py index f9b7dd022fa6..b1c64bbdde5a 100644 --- a/qa/tasks/mgr/dashboard/test_rbd.py +++ b/qa/tasks/mgr/dashboard/test_rbd.py @@ -478,6 +478,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', @@ -485,6 +486,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) -- 2.47.3