]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Show iSCSI gateways status in the health page 29112/head
authorRicardo Marques <rimarques@suse.com>
Thu, 18 Jul 2019 14:37:21 +0000 (15:37 +0100)
committerRicardo Marques <rimarques@suse.com>
Fri, 19 Jul 2019 07:55:18 +0000 (08:55 +0100)
Fixes: https://tracker.ceph.com/issues/39028
Signed-off-by: Ricardo Marques <rimarques@suse.com>
src/pybind/mgr/dashboard/controllers/health.py
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html

index d2b232a6afa4292c4381ddbf9dd1105709717f1f..30d1e5285299a7718b0e790d2c2fbc036b07dfd3 100644 (file)
@@ -6,9 +6,11 @@ import json
 from . import ApiController, Endpoint, BaseController
 
 from .. import mgr
+from ..rest_client import RequestException
 from ..security import Permission, Scope
 from ..services.ceph_service import CephService
 from ..services.iscsi_cli import IscsiGatewaysConfig
+from ..services.iscsi_client import IscsiClient
 
 
 class HealthData(object):
@@ -121,8 +123,15 @@ class HealthData(object):
         return len(mgr.list_servers())
 
     def iscsi_daemons(self):
-        gateways = IscsiGatewaysConfig.get_gateways_config()['gateways']
-        return len(gateways) if gateways else 0
+        up_counter = 0
+        down_counter = 0
+        for gateway_name in IscsiGatewaysConfig.get_gateways_config()['gateways']:
+            try:
+                IscsiClient.instance(gateway_name=gateway_name).ping()
+                up_counter += 1
+            except RequestException:
+                down_counter += 1
+        return {'up': up_counter, 'down': down_counter}
 
     def mgr_map(self):
         mgr_map = mgr.get('mgr_map')
index 4ac9b3421503aa46c648899336af23f7bc74493f..8fe797e28c37cfa50e4735121f50116dee46f886 100644 (file)
                   class="cd-status-card"
                   contentClass="content-highlight"
                   *ngIf="enabledFeature.iscsi && healthData.iscsi_daemons != null">
-      {{ healthData.iscsi_daemons }} total
+      {{ healthData.iscsi_daemons.up + healthData.iscsi_daemons.down }} total
+      <span class="card-text-line-break"></span>
+      {{ healthData.iscsi_daemons.up }} up,
+      <span [ngClass]="{'card-text-error': healthData.iscsi_daemons.down > 0}">{{ healthData.iscsi_daemons.down }} down</span>
     </cd-info-card>
   </cd-info-group>