From: Ricardo Marques Date: Fri, 8 Mar 2019 12:11:54 +0000 (+0000) Subject: mgr/dashboard: Validate `ceph-iscsi` config version X-Git-Tag: v15.0.0~236^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b9b2b562ccf5dc6469d11912ee28dd2d932fdb48;p=ceph-ci.git mgr/dashboard: Validate `ceph-iscsi` config version Signed-off-by: Ricardo Marques --- diff --git a/src/pybind/mgr/dashboard/controllers/iscsi.py b/src/pybind/mgr/dashboard/controllers/iscsi.py index 07f7abe846a..5342a4463b5 100644 --- a/src/pybind/mgr/dashboard/controllers/iscsi.py +++ b/src/pybind/mgr/dashboard/controllers/iscsi.py @@ -23,6 +23,8 @@ from ..tools import TaskManager @UiApiController('/iscsi', Scope.ISCSI) class IscsiUi(BaseController): + REQUIRED_CEPH_ISCSI_CONFIG_VERSION = 8 + @Endpoint() @ReadPermission def status(self): @@ -31,7 +33,12 @@ class IscsiUi(BaseController): status['message'] = 'There are no gateways defined' return status try: - IscsiClient.instance().get_config() + config = IscsiClient.instance().get_config() + if config['version'] != IscsiUi.REQUIRED_CEPH_ISCSI_CONFIG_VERSION: + status['message'] = 'Unsupported `ceph-iscsi` config version. Expected {} but ' \ + 'found {}.'.format(IscsiUi.REQUIRED_CEPH_ISCSI_CONFIG_VERSION, + config['version']) + return status status['available'] = True except RequestException as e: if e.content: