Skip to content

Commit c959ae6

Browse files
authored
Merge pull request ceph#46196 from rhcs-dashboard/smart-data-scsi
mgr/dashboard: smart data for devices with scsi protocol Reviewed-by: Aashish Sharma <[email protected]> Reviewed-by: Avan Thakkar <[email protected]> Reviewed-by: Ernesto Puerta <[email protected]> Reviewed-by: Laura Flores <[email protected]>
2 parents 7752d87 + 4fab663 commit c959ae6

File tree

6 files changed

+319
-18
lines changed

6 files changed

+319
-18
lines changed

src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/fixtures/smart_data_version_1_0_hdd_response.json renamed to src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/fixtures/smart_data_version_1_0_ata_response.json

File renamed without changes.
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
{
2+
"WDC_WUH721818AL5204_012345689": {
3+
"device": {
4+
"info_name": "/dev/sdf",
5+
"name": "/dev/sdf",
6+
"protocol": "SCSI",
7+
"type": "scsi"
8+
},
9+
"device_type": {
10+
"name": "disk",
11+
"scsi_value": 0
12+
},
13+
"form_factor": {
14+
"name": "3.5 inches",
15+
"scsi_value": 2
16+
},
17+
"json_format_version": [
18+
1,
19+
0
20+
],
21+
"local_time": {
22+
"asctime": "Sun May 8 14:21:11 2022 UTC",
23+
"time_t": 1652019671
24+
},
25+
"logical_block_size": 512,
26+
"model_name": "WDC WUH721818AL5204",
27+
"nvme_smart_health_information_add_log_error": "nvme returned an error: sudo: exit status: 231",
28+
"nvme_smart_health_information_add_log_error_code": -22,
29+
"nvme_vendor": "wdc",
30+
"physical_block_size": 4096,
31+
"power_on_time": {
32+
"hours": 1719,
33+
"minutes": 55
34+
},
35+
"product": "WUH721818AL5204",
36+
"revision": "C232",
37+
"rotation_rate": 7200,
38+
"scsi_error_counter_log": {
39+
"read": {
40+
"correction_algorithm_invocations": 1001,
41+
"errors_corrected_by_eccdelayed": 0,
42+
"errors_corrected_by_eccfast": 0,
43+
"errors_corrected_by_rereads_rewrites": 0,
44+
"gigabytes_processed": "8519.006",
45+
"total_errors_corrected": 0,
46+
"total_uncorrected_errors": 0
47+
},
48+
"verify": {
49+
"correction_algorithm_invocations": 261,
50+
"errors_corrected_by_eccdelayed": 0,
51+
"errors_corrected_by_eccfast": 0,
52+
"errors_corrected_by_rereads_rewrites": 0,
53+
"gigabytes_processed": "0.000",
54+
"total_errors_corrected": 0,
55+
"total_uncorrected_errors": 0
56+
},
57+
"write": {
58+
"correction_algorithm_invocations": 25720,
59+
"errors_corrected_by_eccdelayed": 0,
60+
"errors_corrected_by_eccfast": 0,
61+
"errors_corrected_by_rereads_rewrites": 0,
62+
"gigabytes_processed": "146241.629",
63+
"total_errors_corrected": 0,
64+
"total_uncorrected_errors": 0
65+
}
66+
},
67+
"scsi_grown_defect_list": 0,
68+
"scsi_version": "SPC-5",
69+
"serial_number": "0123456789",
70+
"smart_status": {
71+
"passed": true
72+
},
73+
"smartctl": {
74+
"argv": [
75+
"smartctl",
76+
"-x",
77+
"--json=o",
78+
"/dev/sdf"
79+
],
80+
"build_info": "(local build)",
81+
"exit_status": 0,
82+
"output": [
83+
"smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-348.2.1.el8_5.x86_64] (local build)",
84+
"Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org",
85+
"",
86+
"=== START OF INFORMATION SECTION ===",
87+
"Vendor: WDC",
88+
"Product: WUH721818AL5204",
89+
"Revision: C232",
90+
"Compliance: SPC-5",
91+
"User Capacity: 18,000,207,937,536 bytes [18.0 TB]",
92+
"Logical block size: 512 bytes",
93+
"Physical block size: 4096 bytes",
94+
"LU is fully provisioned",
95+
"Rotation Rate: 7200 rpm",
96+
"Form Factor: 3.5 inches",
97+
"Logical Unit id: 0xffffffffffffffffffffffff",
98+
"Serial number: 0123456789",
99+
"Device type: disk",
100+
"Transport protocol: SAS (SPL-3)",
101+
"Local Time is: Sun May 8 14:21:11 2022 UTC",
102+
"SMART support is: Available - device has SMART capability.",
103+
"SMART support is: Enabled",
104+
"Temperature Warning: Enabled",
105+
"Read Cache is: Enabled",
106+
"Writeback Cache is: Enabled",
107+
"",
108+
"=== START OF READ SMART DATA SECTION ===",
109+
"SMART Health Status: OK",
110+
"",
111+
"Grown defects during certification <not available>",
112+
"Total blocks reassigned during format <not available>",
113+
"Total new blocks reassigned <not available>",
114+
"Power on minutes since format <not available>",
115+
"Current Drive Temperature: 38 C",
116+
"Drive Trip Temperature: 85 C",
117+
"",
118+
"Manufactured in week 43 of year 2021",
119+
"Specified cycle count over device lifetime: 50000",
120+
"Accumulated start-stop cycles: 9",
121+
"Specified load-unload count over device lifetime: 600000",
122+
"Accumulated load-unload cycles: 74",
123+
"Elements in grown defect list: 0",
124+
"",
125+
"Error counter log:",
126+
" Errors Corrected by Total Correction Gigabytes Total",
127+
" ECC rereads/ errors algorithm processed uncorrected",
128+
" fast | delayed rewrites corrected invocations [10^9 bytes] errors",
129+
"read: 0 0 0 0 1001 8519.006 0",
130+
"write: 0 0 0 0 25720 146241.629 0",
131+
"verify: 0 0 0 0 261 0.000 0",
132+
"",
133+
"Non-medium error count: 0",
134+
"",
135+
"No Self-tests have been logged",
136+
"",
137+
"Background scan results log",
138+
" Status: waiting until BMS interval timer expires",
139+
" Accumulated power on time, hours:minutes 1719:55 [103195 minutes]",
140+
" Number of background scans performed: 5, scan progress: 0.00%",
141+
" Number of background medium scans performed: 5",
142+
"",
143+
"Protocol Specific port log page for SAS SSP",
144+
"relative target port id = 1",
145+
" generation code = 3",
146+
" number of phys = 1",
147+
" phy identifier = 0",
148+
" attached device type: expander device",
149+
" attached reason: loss of dword synchronization",
150+
" reason: unknown",
151+
" negotiated logical link rate: phy enabled; 12 Gbps",
152+
" attached initiator port: ssp=0 stp=0 smp=1",
153+
" attached target port: ssp=0 stp=0 smp=1",
154+
" SAS address = 0xffffffffffffffffffffffff",
155+
" attached SAS address = 0xffffffffffffffffffffffff",
156+
" attached phy identifier = 0",
157+
" Invalid DWORD count = 0",
158+
" Running disparity error count = 0",
159+
" Loss of DWORD synchronization = 0",
160+
" Phy reset problem = 0",
161+
" Phy event descriptors:",
162+
" Invalid word count: 0",
163+
" Running disparity error count: 0",
164+
" Loss of dword synchronization count: 0",
165+
" Phy reset problem count: 0",
166+
"relative target port id = 2",
167+
" generation code = 3",
168+
" number of phys = 1",
169+
" phy identifier = 1",
170+
" attached device type: expander device",
171+
" attached reason: power on",
172+
" reason: unknown",
173+
" negotiated logical link rate: phy enabled; 12 Gbps",
174+
" attached initiator port: ssp=0 stp=0 smp=1",
175+
" attached target port: ssp=0 stp=0 smp=1",
176+
" SAS address = 0xffffffffffffffffffffffff",
177+
" attached SAS address = 0xffffffffffffffffffffffff",
178+
" attached phy identifier = 0",
179+
" Invalid DWORD count = 0",
180+
" Running disparity error count = 0",
181+
" Loss of DWORD synchronization = 0",
182+
" Phy reset problem = 0",
183+
" Phy event descriptors:",
184+
" Invalid word count: 0",
185+
" Running disparity error count: 0",
186+
" Loss of dword synchronization count: 0",
187+
" Phy reset problem count: 0",
188+
""
189+
],
190+
"platform_info": "x86_64-linux-4.18.0-348.2.1.el8_5.x86_64",
191+
"svn_revision": "5049",
192+
"version": [
193+
7,
194+
1
195+
]
196+
},
197+
"temperature": {
198+
"current": 38,
199+
"drive_trip": 85
200+
},
201+
"user_capacity": {
202+
"blocks": 35156656128,
203+
"bytes": 18000207937536
204+
},
205+
"vendor": "WDC"
206+
}
207+
}
208+

src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@
7979
[data]="device.value.smart.attributes.table"
8080
updateSelectionOnRefresh="never"
8181
[columns]="smartDataColumns"></cd-table>
82+
<cd-table-key-value *ngIf="device.value.smart?.scsi_error_counter_log"
83+
[renderObjects]="true"
84+
[data]="device.value.smart"
85+
updateSelectionOnRefresh="never"></cd-table-key-value>
8286
<cd-table-key-value *ngIf="device.value.smart?.nvmeData"
8387
[renderObjects]="true"
8488
[data]="device.value.smart.nvmeData"
8589
updateSelectionOnRefresh="never"></cd-table-key-value>
86-
<cd-alert-panel *ngIf="!device.value.smart?.attributes && !device.value.smart?.nvmeData"
90+
<cd-alert-panel *ngIf="!device.value.smart?.attributes && !device.value.smart?.nvmeData && !device.value.smart?.scsi_error_counter_log"
8791
id="alert-device-smart-data-unavailable"
8892
type="info"
8993
i18n>No SMART data available for this device.</cd-alert-panel>

src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ import { NgxPipeFunctionModule } from 'ngx-pipe-function';
1010
import { of } from 'rxjs';
1111

1212
import { OsdService } from '~/app/shared/api/osd.service';
13-
import { HddSmartDataV1, NvmeSmartDataV1, SmartDataResult } from '~/app/shared/models/smart';
13+
import {
14+
AtaSmartDataV1,
15+
IscsiSmartDataV1,
16+
NvmeSmartDataV1,
17+
SmartDataResult
18+
} from '~/app/shared/models/smart';
1419
import { SharedModule } from '~/app/shared/shared.module';
1520
import { configureTestBed } from '~/testing/unit-test-helper';
1621
import { SmartListComponent } from './smart-list.component';
@@ -20,8 +25,9 @@ describe('OsdSmartListComponent', () => {
2025
let fixture: ComponentFixture<SmartListComponent>;
2126
let osdService: OsdService;
2227

23-
const SMART_DATA_HDD_VERSION_1_0: HddSmartDataV1 = require('./fixtures/smart_data_version_1_0_hdd_response.json');
28+
const SMART_DATA_ATA_VERSION_1_0: AtaSmartDataV1 = require('./fixtures/smart_data_version_1_0_ata_response.json');
2429
const SMART_DATA_NVME_VERSION_1_0: NvmeSmartDataV1 = require('./fixtures/smart_data_version_1_0_nvme_response.json');
30+
const SMART_DATA_SCSI_VERSION_1_0: IscsiSmartDataV1 = require('./fixtures/smart_data_version_1_0_scsi_response.json');
2531

2632
/**
2733
* Sets attributes for _all_ returned devices according to the given path. The syntax is the same
@@ -38,7 +44,7 @@ describe('OsdSmartListComponent', () => {
3844
*/
3945
const patchData = (path: string, newValue: any): any => {
4046
return _.reduce(
41-
_.cloneDeep(SMART_DATA_HDD_VERSION_1_0),
47+
_.cloneDeep(SMART_DATA_ATA_VERSION_1_0),
4248
(result: object, dataObj, deviceId) => {
4349
result[deviceId] = _.set<any>(dataObj, path, newValue);
4450
return result;
@@ -52,18 +58,21 @@ describe('OsdSmartListComponent', () => {
5258
* of `OsdService`. Determines which data is returned.
5359
*/
5460
const initializeComponentWithData = (
55-
dataType: 'hdd_v1' | 'nvme_v1',
61+
dataType: 'hdd_v1' | 'nvme_v1' | 'hdd_v1_scsi',
5662
patch: { [path: string]: any } = null,
5763
simpleChanges?: SimpleChanges
5864
) => {
59-
let data: HddSmartDataV1 | NvmeSmartDataV1;
65+
let data: AtaSmartDataV1 | NvmeSmartDataV1 | IscsiSmartDataV1;
6066
switch (dataType) {
6167
case 'hdd_v1':
62-
data = SMART_DATA_HDD_VERSION_1_0;
68+
data = SMART_DATA_ATA_VERSION_1_0;
6369
break;
6470
case 'nvme_v1':
6571
data = SMART_DATA_NVME_VERSION_1_0;
6672
break;
73+
case 'hdd_v1_scsi':
74+
data = SMART_DATA_SCSI_VERSION_1_0;
75+
break;
6776
}
6877

6978
if (_.isObject(patch)) {
@@ -131,7 +140,7 @@ describe('OsdSmartListComponent', () => {
131140
expect(component).toBeTruthy();
132141
});
133142

134-
describe('tests HDD version 1.x', () => {
143+
describe('tests ATA version 1.x', () => {
135144
beforeEach(() => initializeComponentWithData('hdd_v1'));
136145

137146
it('should return with proper keys', () => {
@@ -169,6 +178,23 @@ describe('OsdSmartListComponent', () => {
169178
});
170179
});
171180

181+
describe('tests SCSI version 1.x', () => {
182+
beforeEach(() => initializeComponentWithData('hdd_v1_scsi'));
183+
184+
it('should return with proper keys', () => {
185+
_.each(component.data, (smartData, _deviceId) => {
186+
expect(_.keys(smartData)).toEqual(['info', 'smart', 'device', 'identifier']);
187+
});
188+
});
189+
190+
it('should not contain excluded keys in `info`', () => {
191+
const excludes = ['scsi_error_counter_log', 'scsi_grown_defect_list'];
192+
_.each(component.data, (smartData: SmartDataResult, _deviceId) => {
193+
_.each(excludes, (exclude) => expect(smartData.info[exclude]).toBeUndefined());
194+
});
195+
});
196+
});
197+
172198
it('should not work for version 2.x', () => {
173199
initializeComponentWithData('nvme_v1', { json_format_version: [2, 0] });
174200
expect(component.data).toEqual({});

0 commit comments

Comments
 (0)