From: Ricardo Marques Date: Wed, 3 Apr 2019 07:56:27 +0000 (+0100) Subject: mgr/dashboard: Display number of sessions on iSCSI overview page X-Git-Tag: v15.1.0~3023^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c988a44f068b2697df08bf8911fa1311fca104e7;p=ceph.git mgr/dashboard: Display number of sessions on iSCSI overview page Signed-off-by: Ricardo Marques --- diff --git a/src/pybind/mgr/dashboard/controllers/iscsi.py b/src/pybind/mgr/dashboard/controllers/iscsi.py index 36a0823b75721..f8b0e3063b5ef 100644 --- a/src/pybind/mgr/dashboard/controllers/iscsi.py +++ b/src/pybind/mgr/dashboard/controllers/iscsi.py @@ -90,12 +90,19 @@ class IscsiUi(BaseController): for gateway_name in gateways_names: gateway = { 'name': gateway_name, - 'state': 'N/A', - 'num_targets': 'N/A' + 'state': '', + 'num_targets': 'n/a', + 'num_sessions': 'n/a' } try: IscsiClient.instance(gateway_name=gateway_name).ping() gateway['state'] = 'up' + if config: + gateway['num_sessions'] = 0 + if gateway_name in config['gateways']: + gatewayinfo = IscsiClient.instance( + gateway_name=gateway_name).get_gatewayinfo() + gateway['num_sessions'] = gatewayinfo['num_sessions'] except RequestException: gateway['state'] = 'down' if config: diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts index 27266f4339e87..9b771dbb268fb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts @@ -47,6 +47,10 @@ export class IscsiComponent implements OnInit { { name: this.i18n('# Targets'), prop: 'num_targets' + }, + { + name: this.i18n('# Sessions'), + prop: 'num_sessions' } ]; this.imagesColumns = [ diff --git a/src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf b/src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf index e0040aeeeaf9a..8a1f6be6909b4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf +++ b/src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf @@ -4246,6 +4246,10 @@ src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts 1 + + src/app/ceph/block/iscsi/iscsi.component.ts + 1 + State diff --git a/src/pybind/mgr/dashboard/services/iscsi_client.py b/src/pybind/mgr/dashboard/services/iscsi_client.py index 887b0ca0d68f5..58f02fdcc745f 100644 --- a/src/pybind/mgr/dashboard/services/iscsi_client.py +++ b/src/pybind/mgr/dashboard/services/iscsi_client.py @@ -102,6 +102,11 @@ class IscsiClient(RestClient): 'skipchecks': 'true' }) + @RestClient.api_get('/api/gatewayinfo') + def get_gatewayinfo(self, request=None): + logger.debug("iSCSI: Getting gatewayinfo") + return request() + @RestClient.api_put('/api/disk/{pool}/{image}') def create_disk(self, pool, image, backstore, request=None): logger.debug("iSCSI: Creating disk: %s/%s", pool, image)