Skip to content

Commit

Permalink
DAOS-16209 control: Add MD-on-SSD resp flag for display mode (#15695)
Browse files Browse the repository at this point in the history
Rather than mutating mem_file_bytes to indicate PMem/MD-on-SSD mode in
pool query and create, use an explicit flag in the response instead.
This flag is then used to trigger a display style in the presentation layer.

Signed-off-by: Tom Nabarro <[email protected]>
  • Loading branch information
tanabarr authored Jan 23, 2025
1 parent fb444f2 commit 26c2219
Show file tree
Hide file tree
Showing 22 changed files with 1,181 additions and 842 deletions.
2 changes: 1 addition & 1 deletion src/bio/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def scons():
libs += ['spdk_vmd', 'spdk_event_bdev', 'spdk_init']

# Other libs
libs += ['numa', 'dl', 'smd']
libs += ['numa', 'dl', 'smd', 'abt']

tgts = FILES + control_tgts
bio = denv.d_library("bio", tgts, install_off="../..", LIBS=libs)
Expand Down
73 changes: 45 additions & 28 deletions src/control/cmd/daos/pretty/pool.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2020-2024 Intel Corporation.
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand All @@ -20,36 +21,44 @@ import (

const msgNoPools = "No pools in system"

func printPoolTiers(memFileBytes uint64, suss []*daos.StorageUsageStats, w *txtfmt.ErrWriter, fullStats bool) {
mdOnSSD := memFileBytes != 0
func printPoolTierStats(tierStats *daos.StorageUsageStats, w *txtfmt.ErrWriter, fullStats bool) {
fmt.Fprintf(w, " Total size: %s\n", humanize.Bytes(tierStats.Total))
if fullStats {
fmt.Fprintf(w, " Free: %s, min:%s, max:%s, mean:%s\n",
humanize.Bytes(tierStats.Free), humanize.Bytes(tierStats.Min),
humanize.Bytes(tierStats.Max), humanize.Bytes(tierStats.Mean))
return
}

fmt.Fprintf(w, " Free: %s\n", humanize.Bytes(tierStats.Free))
}

func printPoolTiersPMem(suss []*daos.StorageUsageStats, w *txtfmt.ErrWriter, fullStats bool) {
for tierIdx, tierStats := range suss {
if mdOnSSD {
if tierIdx == 0 {
if fullStats {
fmt.Fprintf(w, "- Total memory-file size: %s\n",
humanize.Bytes(memFileBytes))
}
fmt.Fprintf(w, "- Metadata storage:\n")
} else {
fmt.Fprintf(w, "- Data storage:\n")
}
} else {
if tierIdx >= int(daos.StorageMediaTypeMax) {
// Print unknown type tiers.
tierStats.MediaType = daos.StorageMediaTypeMax
}
fmt.Fprintf(w, "- Storage tier %d (%s):\n", tierIdx,
strings.ToUpper(tierStats.MediaType.String()))
if tierIdx >= int(daos.StorageMediaTypeMax) {
// Print unknown type tiers.
tierStats.MediaType = daos.StorageMediaTypeMax
}
fmt.Fprintf(w, "- Storage tier %d (%s):\n", tierIdx,
strings.ToUpper(tierStats.MediaType.String()))

printPoolTierStats(tierStats, w, fullStats)
}
}

fmt.Fprintf(w, " Total size: %s\n", humanize.Bytes(tierStats.Total))
if fullStats {
fmt.Fprintf(w, " Free: %s, min:%s, max:%s, mean:%s\n",
humanize.Bytes(tierStats.Free), humanize.Bytes(tierStats.Min),
humanize.Bytes(tierStats.Max), humanize.Bytes(tierStats.Mean))
func printPoolTiersMdOnSsd(memFileBytes uint64, suss []*daos.StorageUsageStats, w *txtfmt.ErrWriter, fullStats bool) {
for tierIdx, tierStats := range suss {
if tierIdx == 0 {
if fullStats {
fmt.Fprintf(w, "- Total memory-file size: %s\n",
humanize.Bytes(memFileBytes))
}
fmt.Fprintf(w, "- Metadata storage:\n")
} else {
fmt.Fprintf(w, " Free: %s\n", humanize.Bytes(tierStats.Free))
fmt.Fprintf(w, "- Data storage:\n")
}

printPoolTierStats(tierStats, w, fullStats)
}
}

Expand Down Expand Up @@ -94,7 +103,11 @@ func PrintPoolInfo(pi *daos.PoolInfo, out io.Writer) error {
if pi.QueryMask.HasOption(daos.PoolQueryOptionSpace) && pi.TierStats != nil {
fmt.Fprintln(w, "Pool space info:")
fmt.Fprintf(w, "- Target count:%d\n", pi.ActiveTargets)
printPoolTiers(pi.MemFileBytes, pi.TierStats, w, true)
if pi.MdOnSsdActive {
printPoolTiersMdOnSsd(pi.MemFileBytes, pi.TierStats, w, true)
} else {
printPoolTiersPMem(pi.TierStats, w, true)
}
}
return w.Err
}
Expand All @@ -110,7 +123,11 @@ func PrintPoolQueryTargetInfo(pqti *daos.PoolQueryTargetInfo, out io.Writer) err
// Maintain output compatibility with the `daos pool query-targets` output.
fmt.Fprintf(w, "Target: type %s, state %s\n", pqti.Type, pqti.State)
if pqti.Space != nil {
printPoolTiers(pqti.MemFileBytes, pqti.Space, w, false)
if pqti.MdOnSsdActive {
printPoolTiersMdOnSsd(pqti.MemFileBytes, pqti.Space, w, false)
} else {
printPoolTiersPMem(pqti.Space, w, false)
}
}

return w.Err
Expand Down Expand Up @@ -291,7 +308,7 @@ func printVerbosePoolList(pools []*daos.PoolInfo, out io.Writer) error {
if pool.QueryMask.HasOption(daos.PoolQueryOptionSpace) {
hasSpaceQuery = true
// All pools will have the same PMem/MD-on-SSD mode.
hasMdOnSsd = pool.MemFileBytes != 0
hasMdOnSsd = pool.MdOnSsdActive
}
if pool.QueryMask.HasOption(daos.PoolQueryOptionRebuild) {
hasRebuildQuery = true
Expand Down
21 changes: 14 additions & 7 deletions src/control/cmd/daos/pretty/pool_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2020-2024 Intel Corporation.
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -291,6 +292,7 @@ Pool space info:
MediaType: daos.StorageMediaTypeNvme,
},
},
MemFileBytes: humanize.GiByte,
},
expPrintStr: fmt.Sprintf(`
Pool %s, ntarget=2, disabled=1, leader=42, version=100, state=Degraded
Expand Down Expand Up @@ -336,7 +338,8 @@ Pool space info:
MediaType: daos.StorageMediaTypeNvme,
},
},
MemFileBytes: 1,
MemFileBytes: humanize.GiByte,
MdOnSsdActive: true,
},
expPrintStr: fmt.Sprintf(`
Pool %s, ntarget=2, disabled=1, leader=42, version=100, state=Degraded
Expand All @@ -345,7 +348,7 @@ Pool health info:
- Rebuild busy, 42 objs, 21 recs
Pool space info:
- Target count:1
- Total memory-file size: 1 B
- Total memory-file size: 1.1 GB
- Metadata storage:
Total size: 2 B
Free: 1 B, min:0 B, max:0 B, mean:0 B
Expand Down Expand Up @@ -528,6 +531,7 @@ Target: type unknown, state new
MediaType: daos.StorageMediaTypeNvme,
},
},
MemFileBytes: 3000000000,
},
expPrintStr: `
Target: type unknown, state drain
Expand Down Expand Up @@ -555,7 +559,8 @@ Target: type unknown, state drain
MediaType: daos.StorageMediaTypeNvme,
},
},
MemFileBytes: 3000000000,
MemFileBytes: 3000000000,
MdOnSsdActive: true,
},
expPrintStr: `
Target: type unknown, state down_out
Expand Down Expand Up @@ -861,7 +866,8 @@ two 00000002-0002-0002-0002-000000000002 Destroying [3-5] 100 GB 80 GB
Rebuild: &daos.PoolRebuildStatus{
State: daos.PoolRebuildStateBusy,
},
QueryMask: daos.DefaultPoolQueryMask,
QueryMask: daos.DefaultPoolQueryMask,
MemFileBytes: 1,
},
},
verbose: true,
Expand All @@ -872,7 +878,7 @@ one 00000001-0001-0001-0001-000000000001 Degraded [0-2] 100 GB 80 GB 8%
`,
},
"verbose; one pool; mdonssd": {
"verbose; one pool; MD-on-SSD": {
pools: []*daos.PoolInfo{
{
Label: "one",
Expand All @@ -888,8 +894,9 @@ one 00000001-0001-0001-0001-000000000001 Degraded [0-2] 100 GB 80 GB 8%
Rebuild: &daos.PoolRebuildStatus{
State: daos.PoolRebuildStateDone,
},
QueryMask: daos.DefaultPoolQueryMask,
MemFileBytes: 1,
QueryMask: daos.DefaultPoolQueryMask,
MemFileBytes: 1,
MdOnSsdActive: true,
},
},
verbose: true,
Expand Down
7 changes: 4 additions & 3 deletions src/control/cmd/dmg/pretty/pool.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2020-2024 Intel Corporation.
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -76,7 +77,7 @@ func getPoolCreateRespRows(tierBytes []uint64, tierRatios []float64, numRanks in
return
}

func getPoolCreateRespRowsMDOnSSD(tierBytes []uint64, tierRatios []float64, numRanks int, memFileBytes uint64) (title string, rows []txtfmt.TableRow) {
func getPoolCreateRespRowsMdOnSsd(tierBytes []uint64, tierRatios []float64, numRanks int, memFileBytes uint64) (title string, rows []txtfmt.TableRow) {
title = "Pool created with "
tierName := "Metadata"

Expand Down Expand Up @@ -137,8 +138,8 @@ func PrintPoolCreateResponse(pcr *control.PoolCreateResp, out io.Writer, opts ..

var title string
var tierRows []txtfmt.TableRow
if pcr.MemFileBytes > 0 {
title, tierRows = getPoolCreateRespRowsMDOnSSD(pcr.TierBytes, tierRatios, numRanks,
if pcr.MdOnSsdActive {
title, tierRows = getPoolCreateRespRowsMdOnSsd(pcr.TierBytes, tierRatios, numRanks,
pcr.MemFileBytes)
} else {
title, tierRows = getPoolCreateRespRows(pcr.TierBytes, tierRatios, numRanks)
Expand Down
7 changes: 5 additions & 2 deletions src/control/cmd/dmg/pretty/pool_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2020-2024 Intel Corporation.
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -353,6 +354,7 @@ func TestPretty_PrintPoolCreateResp(t *testing.T) {
600 * humanize.MByte,
10 * humanize.GByte,
},
MemFileBytes: 300 * humanize.MByte,
},
expPrintStr: fmt.Sprintf(`
Pool created with 5.66%%,94.34%% storage tier ratio
Expand All @@ -367,7 +369,7 @@ Pool created with 5.66%%,94.34%% storage tier ratio
`, test.MockPoolUUID()),
},
"basic; md-on-ssd": {
"basic; MD-on-SSD": {
pcr: &control.PoolCreateResp{
UUID: test.MockUUID(),
SvcReps: mockRanks(0, 1, 2),
Expand All @@ -376,7 +378,8 @@ Pool created with 5.66%%,94.34%% storage tier ratio
600 * humanize.MByte,
10 * humanize.GByte,
},
MemFileBytes: 300 * humanize.MByte, // Non-zero indicates MD-on-SSD.
MemFileBytes: 300 * humanize.MByte,
MdOnSsdActive: true,
},
expPrintStr: fmt.Sprintf(`
Pool created with 5.66%%,94.34%% storage tier ratio
Expand Down
1 change: 1 addition & 0 deletions src/control/common/proto/mgmt/mgmt.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/control/common/proto/mgmt/mgmt_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 26c2219

Please sign in to comment.