Skip to content

Commit

Permalink
add rank to scan output and remove ID from title names
Browse files Browse the repository at this point in the history
Required-githooks: true

Signed-off-by: Tom Nabarro <[email protected]>
  • Loading branch information
tanabarr committed Dec 11, 2023
1 parent 5ed1e71 commit 3e04a2b
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 123 deletions.
16 changes: 12 additions & 4 deletions src/control/cmd/dmg/pretty/storage_nvme.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/daos-stack/daos/src/control/common"
"github.com/daos-stack/daos/src/control/lib/control"
"github.com/daos-stack/daos/src/control/lib/ranklist"
"github.com/daos-stack/daos/src/control/lib/txtfmt"
"github.com/daos-stack/daos/src/control/server/storage"
)
Expand Down Expand Up @@ -216,12 +217,13 @@ func PrintNvmeControllers(controllers storage.NvmeControllers, out io.Writer, op
pciTitle := "NVMe PCI"
modelTitle := "Model"
fwTitle := "FW Revision"
socketTitle := "Socket ID"
socketTitle := "Socket"
capacityTitle := "Capacity"
rolesTitle := "Role(s)"
rankTitle := "Rank"

formatter := txtfmt.NewTableFormatter(
pciTitle, modelTitle, fwTitle, socketTitle, capacityTitle, rolesTitle,
pciTitle, modelTitle, fwTitle, socketTitle, capacityTitle, rolesTitle, rankTitle,
)
formatter.InitWriter(out)
var table []txtfmt.TableRow
Expand All @@ -235,11 +237,17 @@ func PrintNvmeControllers(controllers storage.NvmeControllers, out io.Writer, op
row[socketTitle] = fmt.Sprint(ctrlr.SocketID)
row[capacityTitle] = humanize.Bytes(ctrlr.Capacity())
roles := "???"
// Assumes that all SMD devices on a controller have the same roles.
rank := "None"
// Assumes that all SMD devices on a controller have the same roles and rank.
if len(ctrlr.SmdDevices) > 0 {
roles = fmt.Sprintf("%s", &ctrlr.SmdDevices[0].Roles)
sd := ctrlr.SmdDevices[0]
roles = fmt.Sprintf("%s", &sd.Roles)
if sd.Rank != ranklist.NilRank {
rank = sd.Rank.String()
}
}
row[rolesTitle] = roles
row[rankTitle] = rank

table = append(table, row)
}
Expand Down
26 changes: 14 additions & 12 deletions src/control/cmd/dmg/pretty/storage_nvme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/google/go-cmp/cmp"

"github.com/daos-stack/daos/src/control/lib/control"
"github.com/daos-stack/daos/src/control/lib/ranklist"
"github.com/daos-stack/daos/src/control/server/storage"
)

Expand All @@ -25,6 +26,7 @@ func TestPretty_PrintNVMeController(t *testing.T) {
c := storage.MockNvmeController(idx)
sd := storage.MockSmdDevice(nil, idx)
sd.Roles = storage.BdevRoles{storage.OptionBits(roleBits)}
sd.Rank = ranklist.Rank(idx)
c.SmdDevices = []*storage.SmdDevice{sd}
return c
}
Expand All @@ -38,10 +40,10 @@ func TestPretty_PrintNVMeController(t *testing.T) {
storage.MockNvmeController(2),
},
expPrintStr: `
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB ???
0000:02:00.0 model-2 fwRev-2 0 2.0 TB ???
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB ??? None
0000:02:00.0 model-2 fwRev-2 0 2.0 TB ??? None
`,
},
"vmd backing devices": {
Expand All @@ -50,10 +52,10 @@ NVMe PCI Model FW Revision Socket ID Capacity Role(s)
&storage.NvmeController{PciAddr: "050505:03:00.0"},
},
expPrintStr: `
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
050505:01:00.0 0 0 B ???
050505:03:00.0 0 0 B ???
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
050505:01:00.0 0 0 B ??? None
050505:03:00.0 0 0 B ??? None
`,
},
"controllers with roles": {
Expand All @@ -62,10 +64,10 @@ NVMe PCI Model FW Revision Socket ID Capacity Role(s)
ctrlrWithSmd(2, 6),
},
expPrintStr: `
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB data
0000:02:00.0 model-2 fwRev-2 0 2.0 TB meta,wal
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB data 1
0000:02:00.0 model-2 fwRev-2 0 2.0 TB meta,wal 2
`,
},
} {
Expand Down
10 changes: 5 additions & 5 deletions src/control/cmd/dmg/pretty/storage_scm.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ func PrintScmModules(modules storage.ScmModules, out io.Writer, opts ...PrintCon
return w.Err
}

physicalIdTitle := "SCM Module ID"
socketTitle := "Socket ID"
memCtrlrTitle := "Memory Ctrlr ID"
channelTitle := "Channel ID"
physicalIdTitle := "SCM Module"
socketTitle := "Socket"
memCtrlrTitle := "Memory Ctrlr"
channelTitle := "Channel"
slotTitle := "Channel Slot"
capacityTitle := "Capacity"

Expand Down Expand Up @@ -96,7 +96,7 @@ func PrintScmNamespaces(namespaces storage.ScmNamespaces, out io.Writer, opts ..
}

deviceTitle := "SCM Namespace"
socketTitle := "Socket ID"
socketTitle := "Socket"
capacityTitle := "Capacity"

formatter := txtfmt.NewTableFormatter(deviceTitle, socketTitle, capacityTitle)
Expand Down
118 changes: 59 additions & 59 deletions src/control/cmd/dmg/pretty/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ host1
HugePage Size: 2048 KB
No SCM modules found
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A 0
`,
},
Expand All @@ -501,9 +501,9 @@ Errors:
host1
-----
HugePage Size: 2048 KB
SCM Module ID Socket ID Memory Ctrlr ID Channel ID Channel Slot Capacity
------------- --------- --------------- ---------- ------------ --------
1 1 1 1 1 954 MiB
SCM Module Socket Memory Ctrlr Channel Channel Slot Capacity
---------- ------ ------------ ------- ------------ --------
1 1 1 1 1 954 MiB
No NVMe devices found
Expand Down Expand Up @@ -583,13 +583,13 @@ HugePage Size: 2048 KB
host1
-----
HugePage Size: 2048 KB
SCM Module ID Socket ID Memory Ctrlr ID Channel ID Channel Slot Capacity
------------- --------- --------------- ---------- ------------ --------
1 1 1 1 1 954 MiB
SCM Module Socket Memory Ctrlr Channel Channel Slot Capacity
---------- ------ ------------ ------- ------------ --------
1 1 1 1 1 954 MiB
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A 0
`,
},
Expand All @@ -609,13 +609,13 @@ NVMe PCI Model FW Revision Socket ID Capacity Role(s)
host1
-----
HugePage Size: 2048 KB
SCM Namespace Socket ID Capacity
------------- --------- --------
pmem0 0 1.0 TB
SCM Namespace Socket Capacity
------------- ------ --------
pmem0 0 1.0 TB
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A 0
`,
},
Expand All @@ -639,13 +639,13 @@ NVMe PCI Model FW Revision Socket ID Capacity Role(s)
host[1-2]
---------
HugePage Size: 2048 KB
SCM Module ID Socket ID Memory Ctrlr ID Channel ID Channel Slot Capacity
------------- --------- --------------- ---------- ------------ --------
1 1 1 1 1 954 MiB
SCM Module Socket Memory Ctrlr Channel Channel Slot Capacity
---------- ------ ------------ ------- ------------ --------
1 1 1 1 1 954 MiB
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A 0
`,
},
Expand All @@ -669,9 +669,9 @@ NVMe PCI Model FW Revision Socket ID Capacity Role(s)
host1
-----
HugePage Size: 2048 KB
SCM Module ID Socket ID Memory Ctrlr ID Channel ID Channel Slot Capacity
------------- --------- --------------- ---------- ------------ --------
1 1 1 1 1 954 MiB
SCM Module Socket Memory Ctrlr Channel Channel Slot Capacity
---------- ------ ------------ ------- ------------ --------
1 1 1 1 1 954 MiB
No NVMe devices found
Expand All @@ -681,9 +681,9 @@ host2
HugePage Size: 2048 KB
No SCM modules found
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A 0
`,
},
Expand All @@ -699,13 +699,13 @@ NVMe PCI Model FW Revision Socket ID Capacity Role(s)
host[0-1023]
------------
HugePage Size: 2048 KB
SCM Module ID Socket ID Memory Ctrlr ID Channel ID Channel Slot Capacity
------------- --------- --------------- ---------- ------------ --------
1 1 1 1 1 954 MiB
SCM Module Socket Memory Ctrlr Channel Channel Slot Capacity
---------- ------ ------------ ------- ------------ --------
1 1 1 1 1 954 MiB
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A 0
`,
},
Expand Down Expand Up @@ -739,9 +739,9 @@ host-[0001-0004]
HugePage Size: 2048 KB
No SCM modules found
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A 0
`,
},
Expand Down Expand Up @@ -775,9 +775,9 @@ host-j-[0001-0004]
HugePage Size: 2048 KB
No SCM modules found
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 model-1 fwRev-1 1 2.0 TB N/A 0
`,
},
Expand Down Expand Up @@ -809,29 +809,29 @@ NVMe PCI Model FW Revision Socket ID Capacity Role(s)
host[1,3]
---------
HugePage Size: 2048 KB
SCM Namespace Socket ID Capacity
------------- --------- --------
pmem0 0 1.0 TB
pmem1 1 2.0 TB
SCM Namespace Socket Capacity
------------- ------ --------
pmem0 0 1.0 TB
pmem1 1 2.0 TB
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 1 2.0 TB data,meta,wal
0000:04:00.0 0 2.0 TB data,meta,wal
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 1 2.0 TB data,meta,wal 0
0000:04:00.0 0 2.0 TB data,meta,wal 0
---------
host[2,4]
---------
HugePage Size: 2048 KB
SCM Namespace Socket ID Capacity
------------- --------- --------
pmem0 0 1.0 TB
pmem1 1 2.0 TB
NVMe PCI Model FW Revision Socket ID Capacity Role(s)
-------- ----- ----------- --------- -------- -------
0000:01:00.0 1 2.1 TB data,meta,wal
0000:04:00.0 0 2.1 TB data,meta,wal
SCM Namespace Socket Capacity
------------- ------ --------
pmem0 0 1.0 TB
pmem1 1 2.0 TB
NVMe PCI Model FW Revision Socket Capacity Role(s) Rank
-------- ----- ----------- ------ -------- ------- ----
0000:01:00.0 1 2.1 TB data,meta,wal 0
0000:04:00.0 0 2.1 TB data,meta,wal 0
`,
},
Expand Down
Loading

0 comments on commit 3e04a2b

Please sign in to comment.