Skip to content

Commit

Permalink
DAOS-14422 control: Update pool query UX for MD-on-SSD phase2 (#14844)
Browse files Browse the repository at this point in the history
Display MD-on-SSD specifics on pool query including VOS index file
sizes. Tier-0 space usage reported is that of MD-on-SSD blobs and in
phase2 mode these two sizes will be distinct.
  • Loading branch information
tanabarr authored Sep 8, 2024
1 parent 16df8c9 commit aa2cba4
Show file tree
Hide file tree
Showing 19 changed files with 287 additions and 198 deletions.
8 changes: 3 additions & 5 deletions src/common/dav_v2/dav_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ dav_obj_create_v2(const char *path, int flags, size_t sz, mode_t mode, struct um
/* Open the file and obtain the size */
fd = open(path, O_RDWR|O_CLOEXEC);
if (fd == -1) {
D_ERROR("obj_create_v2 open %s to fetch size: %s (%d)\n", path,
strerror(errno), errno);
DS_ERROR(errno, "obj_create_v2 open %s to fetch size", path);
return NULL;
}

Expand All @@ -288,8 +287,7 @@ dav_obj_create_v2(const char *path, int flags, size_t sz, mode_t mode, struct um
} else {
fd = open(path, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, mode);
if (fd == -1) {
D_ERROR("obj_create_v2 open %s to alloc: %s (%d)\n", path, strerror(errno),
errno);
DS_ERROR(errno, "obj_create_v2 open %s to alloc", path);
return NULL;
}

Expand Down Expand Up @@ -326,7 +324,7 @@ dav_obj_open_v2(const char *path, int flags, struct umem_store *store)

fd = open(path, O_RDWR|O_CLOEXEC);
if (fd == -1) {
D_ERROR("obj_create_v2 open %s: %s (%d)\n", path, strerror(errno), errno);
DS_ERROR(errno, "obj_create_v2 open %s", path);
return NULL;
}

Expand Down
39 changes: 18 additions & 21 deletions src/control/cmd/daos/pretty/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,24 @@ import (

const msgNoPools = "No pools in system"

func printPoolTiers(suss []*daos.StorageUsageStats, w *txtfmt.ErrWriter, fullStats bool) {
mdOnSSD := false
func printPoolTiers(memFileBytes uint64, suss []*daos.StorageUsageStats, w *txtfmt.ErrWriter, fullStats bool) {
mdOnSSD := memFileBytes != 0
for tierIdx, tierStats := range suss {
if tierIdx >= int(daos.StorageMediaTypeMax) {
tierStats.MediaType = daos.StorageMediaTypeMax // Print unknown type tier.
}

switch {
case tierIdx == 0 && tierStats.MediaType == daos.StorageMediaTypeNvme:
// MD-on-SSD mode.
// TODO: Print VOS index aggregate file size across pool as distinct from
// Meta-blob aggregate size.
if fullStats {
fmt.Fprintf(w, "- Total memory-file size: %s\n",
humanize.Bytes(tierStats.Total))
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, "- Metadata storage:\n")
mdOnSSD = true
case mdOnSSD:
fmt.Fprintf(w, "- Data storage:\n")
default:
fmt.Fprintf(w, "- Storage tier %d (%s):\n", tierIdx,
strings.ToUpper(tierStats.MediaType.String()))
}
Expand Down Expand Up @@ -93,7 +90,7 @@ 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.TierStats, w, true)
printPoolTiers(pi.MemFileBytes, pi.TierStats, w, true)
}
return w.Err
}
Expand All @@ -109,7 +106,7 @@ 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.Space, w, false)
printPoolTiers(pqti.MemFileBytes, pqti.Space, w, false)
}

return w.Err
Expand Down
16 changes: 9 additions & 7 deletions src/control/cmd/daos/pretty/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,15 @@ Pool space info:
{
Total: 2,
Free: 1,
MediaType: daos.StorageMediaTypeNvme,
MediaType: daos.StorageMediaTypeScm,
},
{
Total: 2,
Free: 1,
Total: 4,
Free: 2,
MediaType: daos.StorageMediaTypeNvme,
},
},
MemFileBytes: 1,
},
expPrintStr: fmt.Sprintf(`
Pool %s, ntarget=2, disabled=1, leader=42, version=100, state=Degraded
Expand All @@ -305,13 +306,13 @@ Pool health info:
- Rebuild busy, 42 objs, 21 recs
Pool space info:
- Target count:1
- Total memory-file size: 2 B
- Total memory-file size: 1 B
- Metadata storage:
Total size: 2 B
Free: 1 B, min:0 B, max:0 B, mean:0 B
- Data storage:
Total size: 2 B
Free: 1 B, min:0 B, max:0 B, mean:0 B
Total size: 4 B
Free: 2 B, min:0 B, max:0 B, mean:0 B
`, poolUUID.String()),
},
} {
Expand Down Expand Up @@ -507,14 +508,15 @@ Target: type unknown, state drain
{
Total: 6000000000,
Free: 5000000000,
MediaType: daos.StorageMediaTypeNvme,
MediaType: daos.StorageMediaTypeScm,
},
{
Total: 100000000000,
Free: 90000000000,
MediaType: daos.StorageMediaTypeNvme,
},
},
MemFileBytes: 3000000000,
},
expPrintStr: `
Target: type unknown, state down_out
Expand Down
46 changes: 22 additions & 24 deletions src/control/cmd/dmg/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ type PoolCmd struct {

var (
// Default to 6% SCM:94% NVMe
defaultTierRatios = []float64{0.06, 0.94}
defaultTierRatios = []float64{0.06, 0.94}
errPoolCreateIncompatOpts = errors.New("unsupported option combination, use (--scm-size and " +
"--nvme-size) or (--meta-size and --data-size) or (--size)")
)

type tierRatioFlag struct {
Expand Down Expand Up @@ -203,7 +205,7 @@ type PoolCreateCmd struct {
NVMeSize sizeFlag `short:"n" long:"nvme-size" description:"Per-engine NVMe allocation for DAOS pool (manual)"`
MetaSize sizeFlag `long:"meta-size" description:"Per-engine Metadata-on-SSD allocation for DAOS pool (manual). Only valid in MD-on-SSD mode"`
DataSize sizeFlag `long:"data-size" description:"Per-engine Data-on-SSD allocation for DAOS pool (manual). Only valid in MD-on-SSD mode"`
MemRatio tierRatioFlag `long:"mem-ratio" description:"Percentage of the pool metadata storage size that should be used as the memory file (cache) size. An example value of 25.5 would result in a memory file size of 0.255 times the value set in --meta-size. Only valid in MD-on-SSD mode"`
MemRatio tierRatioFlag `long:"mem-ratio" description:"Percentage of the pool metadata storage size (on SSD) that should be used as the memory file size (on ram-disk). Default value is 100% and only valid in MD-on-SSD mode"`
RankList ui.RankSetFlag `short:"r" long:"ranks" description:"Storage engine unique identifiers (ranks) for DAOS pool"`

Args struct {
Expand Down Expand Up @@ -247,14 +249,10 @@ func (cmd *PoolCreateCmd) setMemRatio(req *control.PoolCreateReq, defVal float32
}

func (cmd *PoolCreateCmd) storageAutoPercentage(ctx context.Context, req *control.PoolCreateReq) error {
switch {
case cmd.ScmSize.IsSet() || cmd.NVMeSize.IsSet():
return errIncompatFlags("size", "scm-size", "nvme-size")
case cmd.MetaSize.IsSet() || cmd.DataSize.IsSet():
return errIncompatFlags("size", "meta-size", "data-size")
case cmd.NumRanks > 0:
if cmd.NumRanks > 0 {
return errIncompatFlags("size", "nranks")
case cmd.TierRatio.IsSet():
}
if cmd.TierRatio.IsSet() {
return errIncompatFlags("size=%", "tier-ratio")
}
cmd.Infof("Creating DAOS pool with %s of all storage", cmd.Size)
Expand All @@ -271,12 +269,7 @@ func (cmd *PoolCreateCmd) storageAutoPercentage(ctx context.Context, req *contro
}

func (cmd *PoolCreateCmd) storageAutoTotal(req *control.PoolCreateReq) error {
switch {
case cmd.ScmSize.IsSet() || cmd.NVMeSize.IsSet():
return errIncompatFlags("size", "scm-size", "nvme-size")
case cmd.MetaSize.IsSet() || cmd.DataSize.IsSet():
return errIncompatFlags("size", "meta-size", "data-size")
case cmd.NumRanks > 0 && !cmd.RankList.Empty():
if cmd.NumRanks > 0 && !cmd.RankList.Empty() {
return errIncompatFlags("nranks", "ranks")
}

Expand All @@ -301,13 +294,6 @@ func (cmd *PoolCreateCmd) storageAutoTotal(req *control.PoolCreateReq) error {
}

func (cmd *PoolCreateCmd) storageManualMdOnSsd(req *control.PoolCreateReq) error {
if cmd.ScmSize.IsSet() {
return errIncompatFlags("mem-size", "scm-size")
}
if cmd.NVMeSize.IsSet() {
return errIncompatFlags("data-size", "nvme-size")
}

metaBytes := cmd.MetaSize.bytes
dataBytes := cmd.DataSize.bytes
req.TierBytes = []uint64{metaBytes, dataBytes}
Expand Down Expand Up @@ -341,8 +327,6 @@ func (cmd *PoolCreateCmd) storageManual(req *control.PoolCreateReq) error {
return errIncompatFlags("mem-ratio", "scm-size", "nvme-size")
case cmd.NVMeSize.IsSet() && !cmd.ScmSize.IsSet():
return errors.New("--nvme-size cannot be set without --scm-size")
case !cmd.ScmSize.IsSet():
return errors.New("at least one size parameter must be set")
}

scmBytes := cmd.ScmSize.bytes
Expand Down Expand Up @@ -388,6 +372,20 @@ func (cmd *PoolCreateCmd) Execute(args []string) error {
}
}

// Refuse unsupported input value combinations.

pmemParams := cmd.ScmSize.IsSet() || cmd.NVMeSize.IsSet()
mdParams := cmd.MetaSize.IsSet() || cmd.DataSize.IsSet()

switch {
case (pmemParams || mdParams) && cmd.Size.IsSet():
return errPoolCreateIncompatOpts
case pmemParams && mdParams:
return errPoolCreateIncompatOpts
case !pmemParams && !mdParams && !cmd.Size.IsSet():
return errPoolCreateIncompatOpts
}

// Validate supported input values and set request fields.

switch {
Expand Down
12 changes: 6 additions & 6 deletions src/control/cmd/dmg/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestPoolCommands(t *testing.T) {
"Create pool with missing size",
"pool create label",
"",
errors.New("at least one size parameter must be set"),
errPoolCreateIncompatOpts,
},
{
"Create pool with missing label",
Expand All @@ -245,13 +245,13 @@ func TestPoolCommands(t *testing.T) {
"Create pool with incompatible arguments (auto nvme-size)",
fmt.Sprintf("pool create label --size %s --nvme-size %s", testSizeStr, testSizeStr),
"",
errors.New("may not be mixed"),
errPoolCreateIncompatOpts,
},
{
"Create pool with incompatible arguments (auto scm-size)",
fmt.Sprintf("pool create label --size %s --scm-size %s", testSizeStr, testSizeStr),
"",
errors.New("may not be mixed"),
errPoolCreateIncompatOpts,
},
{
"Create pool with incompatible arguments (% size nranks)",
Expand Down Expand Up @@ -287,19 +287,19 @@ func TestPoolCommands(t *testing.T) {
"Create pool with incompatible arguments (auto with meta-size)",
fmt.Sprintf("pool create label --size %s --meta-size 32G", testSizeStr),
"",
errors.New("may not be mixed"),
errPoolCreateIncompatOpts,
},
{
"Create pool with incompatible arguments (scm-size with meta-size)",
fmt.Sprintf("pool create label --scm-size %s --meta-size 32G", testSizeStr),
"",
errors.New("may not be mixed"),
errPoolCreateIncompatOpts,
},
{
"Create pool with incompatible arguments (scm-size with data-size)",
fmt.Sprintf("pool create label --scm-size %s --data-size 32G", testSizeStr),
"",
errors.New("may not be mixed"),
errPoolCreateIncompatOpts,
},
{
"Create pool with too-large tier-ratio (auto)",
Expand Down
4 changes: 2 additions & 2 deletions src/control/cmd/dmg/pretty/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func printTierBytesRow(fmtName string, tierBytes uint64, numRanks int) txtfmt.Ta
}
}

func getPoolRespStorageRows(mdOnSSD bool, tierBytes []uint64, tierRatios []float64, numRanks int) (title string, rows []txtfmt.TableRow) {
func getPoolCreateRespRows(mdOnSSD bool, tierBytes []uint64, tierRatios []float64, numRanks int) (title string, rows []txtfmt.TableRow) {
title = "Pool created with "
tierName := "SCM"
if mdOnSSD {
Expand Down Expand Up @@ -124,7 +124,7 @@ func PrintPoolCreateResponse(pcr *control.PoolCreateResp, out io.Writer, opts ..

mdOnSsdEnabled := pcr.MemFileBytes > 0

title, tierRows := getPoolRespStorageRows(mdOnSsdEnabled, pcr.TierBytes, tierRatios,
title, tierRows := getPoolCreateRespRows(mdOnSsdEnabled, pcr.TierBytes, tierRatios,
numRanks)

// Print memory-file to meta-blob ratio for MD-on-SSD.
Expand Down
27 changes: 27 additions & 0 deletions src/control/cmd/dmg/pretty/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,33 @@ one 6.0 TB Ready 83%% 16%% 0/16
verbose: true,
expPrintStr: msgNoPools + "\n",
},
"verbose, two pools": {
resp: &control.ListPoolsResp{
Pools: []*daos.PoolInfo{
{
UUID: test.MockPoolUUID(1),
TierStats: exampleTierStats,
TotalTargets: 16,
ActiveTargets: 16,
DisabledTargets: 0,
State: daos.PoolServiceStateReady,
PoolLayoutVer: 1,
UpgradeLayoutVer: 2,
Rebuild: &daos.PoolRebuildStatus{
State: daos.PoolRebuildStateIdle,
},
QueryMask: daos.DefaultPoolQueryMask,
},
},
},
verbose: true,
expPrintStr: `
Label UUID State SvcReps SCM Size SCM Used SCM Imbalance NVME Size NVME Used NVME Imbalance Disabled UpgradeNeeded? Rebuild State
----- ---- ----- ------- -------- -------- ------------- --------- --------- -------------- -------- -------------- -------------
- 00000001-0001-0001-0001-000000000001 Ready N/A 100 GB 80 GB 16% 6.0 TB 5.0 TB 8% 0/16 1->2 idle
`,
},
} {
t.Run(name, func(t *testing.T) {
var bld strings.Builder
Expand Down
Loading

0 comments on commit aa2cba4

Please sign in to comment.