Skip to content

Commit 3a54420

Browse files
authored
DAOS-18349 control: Remove unused pool target type (#17294)
Target type was never set anywhere internally, so always appeared as "unknown" in all user-facing tools. The target type field was intended to indicate the storage media, so is supplanted by the storage tier information. Signed-off-by: Kris Jacque <kris.jacque@hpe.com>
1 parent 7faa4d4 commit 3a54420

16 files changed

Lines changed: 149 additions & 410 deletions

File tree

src/control/cmd/daos/pretty/pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func PrintPoolQueryTargetInfo(pqti *daos.PoolQueryTargetInfo, out io.Writer) err
164164
w := txtfmt.NewErrWriter(out)
165165

166166
// Maintain output compatibility with the `daos pool query-targets` output.
167-
fmt.Fprintf(w, "Target: type %s, state %s\n", pqti.Type, pqti.State)
167+
fmt.Fprintf(w, "Target: state %s\n", pqti.State)
168168
if pqti.Space != nil {
169169
if pqti.MdOnSsdActive {
170170
printPoolTiersMdOnSsd(pqti.MemFileBytes, pqti.Space, w, false)

src/control/cmd/daos/pretty/pool_test.go

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ func TestPretty_PrintPoolQueryTarget(t *testing.T) {
419419
},
420420
"valid: single target (unknown, down_out)": {
421421
pqti: &daos.PoolQueryTargetInfo{
422-
Type: 0,
423422
State: daos.PoolTargetStateDownOut,
424423
Space: []*daos.StorageUsageStats{
425424
{
@@ -435,7 +434,7 @@ func TestPretty_PrintPoolQueryTarget(t *testing.T) {
435434
},
436435
},
437436
expPrintStr: `
438-
Target: type unknown, state down_out
437+
Target: state down_out
439438
- Storage tier 0 (SCM):
440439
Total size: 6.0 GB
441440
Free: 5.0 GB
@@ -446,7 +445,6 @@ Target: type unknown, state down_out
446445
},
447446
"valid: single target (unknown, down)": {
448447
pqti: &daos.PoolQueryTargetInfo{
449-
Type: 0,
450448
State: daos.PoolTargetStateDown,
451449
Space: []*daos.StorageUsageStats{
452450
{
@@ -462,7 +460,7 @@ Target: type unknown, state down_out
462460
},
463461
},
464462
expPrintStr: `
465-
Target: type unknown, state down
463+
Target: state down
466464
- Storage tier 0 (SCM):
467465
Total size: 6.0 GB
468466
Free: 5.0 GB
@@ -473,7 +471,6 @@ Target: type unknown, state down
473471
},
474472
"valid: single target (unknown, up)": {
475473
pqti: &daos.PoolQueryTargetInfo{
476-
Type: 0,
477474
State: daos.PoolTargetStateUp,
478475
Space: []*daos.StorageUsageStats{
479476
{
@@ -489,7 +486,7 @@ Target: type unknown, state down
489486
},
490487
},
491488
expPrintStr: `
492-
Target: type unknown, state up
489+
Target: state up
493490
- Storage tier 0 (SCM):
494491
Total size: 6.0 GB
495492
Free: 5.0 GB
@@ -500,7 +497,6 @@ Target: type unknown, state up
500497
},
501498
"valid: single target (unknown, up_in)": {
502499
pqti: &daos.PoolQueryTargetInfo{
503-
Type: 0,
504500
State: daos.PoolTargetStateUpIn,
505501
Space: []*daos.StorageUsageStats{
506502
{
@@ -516,7 +512,7 @@ Target: type unknown, state up
516512
},
517513
},
518514
expPrintStr: `
519-
Target: type unknown, state up_in
515+
Target: state up_in
520516
- Storage tier 0 (SCM):
521517
Total size: 6.0 GB
522518
Free: 5.0 GB
@@ -527,7 +523,6 @@ Target: type unknown, state up_in
527523
},
528524
"valid: single target (unknown, new)": {
529525
pqti: &daos.PoolQueryTargetInfo{
530-
Type: 0,
531526
State: daos.PoolTargetStateNew,
532527
Space: []*daos.StorageUsageStats{
533528
{
@@ -543,7 +538,7 @@ Target: type unknown, state up_in
543538
},
544539
},
545540
expPrintStr: `
546-
Target: type unknown, state new
541+
Target: state new
547542
- Storage tier 0 (SCM):
548543
Total size: 6.0 GB
549544
Free: 5.0 GB
@@ -554,7 +549,6 @@ Target: type unknown, state new
554549
},
555550
"valid: single target (unknown, drain)": {
556551
pqti: &daos.PoolQueryTargetInfo{
557-
Type: 0,
558552
State: daos.PoolTargetStateDrain,
559553
Space: []*daos.StorageUsageStats{
560554
{
@@ -571,7 +565,7 @@ Target: type unknown, state new
571565
MemFileBytes: 3000000000,
572566
},
573567
expPrintStr: `
574-
Target: type unknown, state drain
568+
Target: state drain
575569
- Storage tier 0 (SCM):
576570
Total size: 6.0 GB
577571
Free: 5.0 GB
@@ -582,7 +576,6 @@ Target: type unknown, state drain
582576
},
583577
"valid: single target (unknown, down_out): MD-on-SSD": {
584578
pqti: &daos.PoolQueryTargetInfo{
585-
Type: 0,
586579
State: daos.PoolTargetStateDownOut,
587580
Space: []*daos.StorageUsageStats{
588581
{
@@ -600,7 +593,7 @@ Target: type unknown, state drain
600593
MdOnSsdActive: true,
601594
},
602595
expPrintStr: `
603-
Target: type unknown, state down_out
596+
Target: state down_out
604597
- Metadata storage:
605598
Total size: 6.0 GB
606599
Free: 5.0 GB

src/control/cmd/dmg/pretty/pool_test.go

Lines changed: 12 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -54,50 +54,46 @@ func TestPretty_PrintPoolQueryTargetResponse(t *testing.T) {
5454
Status: 0,
5555
Infos: []*daos.PoolQueryTargetInfo{
5656
{
57-
Type: 0,
5857
State: daos.PoolTargetStateDown,
5958
Space: []*daos.StorageUsageStats{tier0, tier1},
6059
},
6160
{
62-
Type: 0,
6361
State: daos.PoolTargetStateUpIn,
6462
Space: []*daos.StorageUsageStats{tier0, tier1},
6563
},
6664
{
67-
Type: 0,
6865
State: daos.PoolTargetStateDownOut,
6966
Space: []*daos.StorageUsageStats{tier0, tier1},
7067
},
7168
{
72-
Type: 0,
7369
State: daos.PoolTargetStateUpIn,
7470
Space: []*daos.StorageUsageStats{tier0, tier1},
7571
},
7672
},
7773
},
7874
expPrintStr: `
79-
Target: type unknown, state down
75+
Target: state down
8076
- Storage tier 0 (SCM):
8177
Total size: 6.0 GB
8278
Free: 5.0 GB
8379
- Storage tier 1 (NVME):
8480
Total size: 100 GB
8581
Free: 90 GB
86-
Target: type unknown, state up_in
82+
Target: state up_in
8783
- Storage tier 0 (SCM):
8884
Total size: 6.0 GB
8985
Free: 5.0 GB
9086
- Storage tier 1 (NVME):
9187
Total size: 100 GB
9288
Free: 90 GB
93-
Target: type unknown, state down_out
89+
Target: state down_out
9490
- Storage tier 0 (SCM):
9591
Total size: 6.0 GB
9692
Free: 5.0 GB
9793
- Storage tier 1 (NVME):
9894
Total size: 100 GB
9995
Free: 90 GB
100-
Target: type unknown, state up_in
96+
Target: state up_in
10197
- Storage tier 0 (SCM):
10298
Total size: 6.0 GB
10399
Free: 5.0 GB
@@ -111,107 +107,46 @@ Target: type unknown, state up_in
111107
Status: 0,
112108
Infos: []*daos.PoolQueryTargetInfo{
113109
{
114-
Type: 0,
115110
State: 42,
116111
Space: []*daos.StorageUsageStats{tier0, tier1},
117112
},
118113
{
119-
Type: 0,
120114
State: daos.PoolTargetStateUpIn,
121115
Space: []*daos.StorageUsageStats{tier0, tier1},
122116
},
123117
{
124-
Type: 0,
125118
State: daos.PoolTargetStateDownOut,
126119
Space: []*daos.StorageUsageStats{tier0, tier1},
127120
},
128121
{
129-
Type: 0,
130122
State: daos.PoolTargetStateUpIn,
131123
Space: []*daos.StorageUsageStats{tier0, tier1},
132124
},
133125
},
134126
},
135127
expPrintStr: `
136-
Target: type unknown, state invalid
128+
Target: state invalid
137129
- Storage tier 0 (SCM):
138130
Total size: 6.0 GB
139131
Free: 5.0 GB
140132
- Storage tier 1 (NVME):
141133
Total size: 100 GB
142134
Free: 90 GB
143-
Target: type unknown, state up_in
135+
Target: state up_in
144136
- Storage tier 0 (SCM):
145137
Total size: 6.0 GB
146138
Free: 5.0 GB
147139
- Storage tier 1 (NVME):
148140
Total size: 100 GB
149141
Free: 90 GB
150-
Target: type unknown, state down_out
142+
Target: state down_out
151143
- Storage tier 0 (SCM):
152144
Total size: 6.0 GB
153145
Free: 5.0 GB
154146
- Storage tier 1 (NVME):
155147
Total size: 100 GB
156148
Free: 90 GB
157-
Target: type unknown, state up_in
158-
- Storage tier 0 (SCM):
159-
Total size: 6.0 GB
160-
Free: 5.0 GB
161-
- Storage tier 1 (NVME):
162-
Total size: 100 GB
163-
Free: 90 GB
164-
`,
165-
},
166-
"invalid target type": {
167-
pqtr: &control.PoolQueryTargetResp{
168-
Status: 0,
169-
Infos: []*daos.PoolQueryTargetInfo{
170-
{
171-
Type: 42,
172-
State: daos.PoolTargetStateDown,
173-
Space: []*daos.StorageUsageStats{tier0, tier1},
174-
},
175-
{
176-
Type: 0,
177-
State: daos.PoolTargetStateUpIn,
178-
Space: []*daos.StorageUsageStats{tier0, tier1},
179-
},
180-
{
181-
Type: 0,
182-
State: daos.PoolTargetStateDownOut,
183-
Space: []*daos.StorageUsageStats{tier0, tier1},
184-
},
185-
{
186-
Type: 0,
187-
State: daos.PoolTargetStateUpIn,
188-
Space: []*daos.StorageUsageStats{tier0, tier1},
189-
},
190-
},
191-
},
192-
expPrintStr: `
193-
Target: type invalid, state down
194-
- Storage tier 0 (SCM):
195-
Total size: 6.0 GB
196-
Free: 5.0 GB
197-
- Storage tier 1 (NVME):
198-
Total size: 100 GB
199-
Free: 90 GB
200-
Target: type unknown, state up_in
201-
- Storage tier 0 (SCM):
202-
Total size: 6.0 GB
203-
Free: 5.0 GB
204-
- Storage tier 1 (NVME):
205-
Total size: 100 GB
206-
Free: 90 GB
207-
Target: type unknown, state down_out
208-
- Storage tier 0 (SCM):
209-
Total size: 6.0 GB
210-
Free: 5.0 GB
211-
- Storage tier 1 (NVME):
212-
Total size: 100 GB
213-
Free: 90 GB
214-
Target: type unknown, state up_in
149+
Target: state up_in
215150
- Storage tier 0 (SCM):
216151
Total size: 6.0 GB
217152
Free: 5.0 GB
@@ -225,7 +160,6 @@ Target: type unknown, state up_in
225160
Status: 0,
226161
Infos: []*daos.PoolQueryTargetInfo{
227162
{
228-
Type: 0,
229163
State: daos.PoolTargetStateDown,
230164
Space: []*daos.StorageUsageStats{
231165
tier0, tier1,
@@ -236,7 +170,6 @@ Target: type unknown, state up_in
236170
},
237171
},
238172
{
239-
Type: 0,
240173
State: daos.PoolTargetStateUpIn,
241174
Space: []*daos.StorageUsageStats{
242175
tier0, tier1,
@@ -247,7 +180,6 @@ Target: type unknown, state up_in
247180
},
248181
},
249182
{
250-
Type: 0,
251183
State: daos.PoolTargetStateDownOut,
252184
Space: []*daos.StorageUsageStats{
253185
tier0, tier1,
@@ -259,7 +191,6 @@ Target: type unknown, state up_in
259191
},
260192
},
261193
{
262-
Type: 0,
263194
State: daos.PoolTargetStateUpIn,
264195
Space: []*daos.StorageUsageStats{
265196
tier0, tier1,
@@ -272,7 +203,7 @@ Target: type unknown, state up_in
272203
},
273204
},
274205
expPrintStr: `
275-
Target: type unknown, state down
206+
Target: state down
276207
- Storage tier 0 (SCM):
277208
Total size: 6.0 GB
278209
Free: 5.0 GB
@@ -282,7 +213,7 @@ Target: type unknown, state down
282213
- Storage tier 2 (UNKNOWN):
283214
Total size: 800 GB
284215
Free: 200 GB
285-
Target: type unknown, state up_in
216+
Target: state up_in
286217
- Storage tier 0 (SCM):
287218
Total size: 6.0 GB
288219
Free: 5.0 GB
@@ -292,7 +223,7 @@ Target: type unknown, state up_in
292223
- Storage tier 2 (UNKNOWN):
293224
Total size: 800 GB
294225
Free: 200 GB
295-
Target: type unknown, state down_out
226+
Target: state down_out
296227
- Storage tier 0 (SCM):
297228
Total size: 6.0 GB
298229
Free: 5.0 GB
@@ -302,7 +233,7 @@ Target: type unknown, state down_out
302233
- Storage tier 2 (UNKNOWN):
303234
Total size: 800 GB
304235
Free: 200 GB
305-
Target: type unknown, state up_in
236+
Target: state up_in
306237
- Storage tier 0 (SCM):
307238
Total size: 6.0 GB
308239
Free: 5.0 GB

0 commit comments

Comments
 (0)