From db786a8a2ab4f90716461c20fcb206d198d7187c Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Thu, 16 May 2019 16:48:39 +0100 Subject: [PATCH] mgr/dashboard: Fix tcmu-runner perf counters page Fixes: https://tracker.ceph.com/issues/39954 Signed-off-by: Ricardo Marques --- src/pybind/mgr/dashboard/controllers/perf_counters.py | 5 +++++ .../frontend/src/app/ceph/cluster/hosts/hosts.component.ts | 2 +- .../performance-counter/performance-counter.component.ts | 2 +- .../src/app/shared/api/performance-counter.service.ts | 5 +++-- src/pybind/mgr/mgr_module.py | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/perf_counters.py b/src/pybind/mgr/dashboard/controllers/perf_counters.py index bfe495619cc..158641ca156 100644 --- a/src/pybind/mgr/dashboard/controllers/perf_counters.py +++ b/src/pybind/mgr/dashboard/controllers/perf_counters.py @@ -74,6 +74,11 @@ class MgrPerfCounter(PerfCounter): service_type = 'mgr' +@ApiController('perf_counters/tcmu-runner', Scope.ISCSI) +class TcmuRunnerPerfCounter(PerfCounter): + service_type = 'tcmu-runner' + + @ApiController('perf_counters') class PerfCounters(RESTController): def list(self): diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts index 61c74f47680..fa107253fd7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts @@ -80,7 +80,7 @@ export class HostsComponent implements OnInit { .then((resp) => { resp.map((host) => { host.services.map((service) => { - service.cdLink = `/perf_counters/${service.type}/${service.id}`; + service.cdLink = `/perf_counters/${service.type}/${encodeURIComponent(service.id)}`; const permission = this.permissions[typeToPermissionKey[service.type]]; service.canRead = permission ? permission.read : false; return service; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts index e6eaf5db410..9321e0e9aae 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts @@ -18,7 +18,7 @@ export class PerformanceCounterComponent { this.fromLink = params.fromLink || PerformanceCounterComponent.defaultFromLink; }); this.route.params.subscribe((params: { type: string; id: string }) => { - this.serviceId = params.id; + this.serviceId = decodeURIComponent(params.id); this.serviceType = params.type; }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/performance-counter.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/performance-counter.service.ts index 6cd54dfdad1..5cf4207a05b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/performance-counter.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/performance-counter.service.ts @@ -4,8 +4,10 @@ import { Injectable } from '@angular/core'; import { of as observableOf } from 'rxjs'; import { mergeMap } from 'rxjs/operators'; +import { cdEncode } from '../decorators/cd-encode'; import { ApiModule } from './api.module'; +@cdEncode @Injectable({ providedIn: ApiModule }) @@ -19,8 +21,7 @@ export class PerformanceCounterService { } get(service_type: string, service_id: string) { - const serviceType = service_type.replace('-', '_'); - return this.http.get(`${this.url}/${serviceType}/${service_id}`).pipe( + return this.http.get(`${this.url}/${service_type}/${service_id}`).pipe( mergeMap((resp) => { return observableOf(resp['counters']); }) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 1fda163ba38..854f7c871d3 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -1098,7 +1098,7 @@ class MgrModule(ceph_module.BaseMgrModule): def get_all_perf_counters(self, prio_limit=PRIO_USEFUL, services=("mds", "mon", "osd", - "rbd-mirror", "rgw")): + "rbd-mirror", "rgw", "tcmu-runner")): """ Return the perf counters currently known to this ceph-mgr instance, filtered by priority equal to or greater than `prio_limit`. -- 2.39.5