From 1db73ca778242f794ae3dbbbaf8a57e6b0162f9c Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Fri, 8 Mar 2019 12:11:54 +0000 Subject: [PATCH] mgr/dashboard: Validate `ceph-iscsi` config version Signed-off-by: Ricardo Marques (cherry picked from commit b9b2b562ccf5dc6469d11912ee28dd2d932fdb48) --- src/pybind/mgr/dashboard/controllers/iscsi.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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: -- 2.39.5