diff --git a/src/control/cmd/dmg/pool.go b/src/control/cmd/dmg/pool.go index e6ee96db9be..98772727c81 100644 --- a/src/control/cmd/dmg/pool.go +++ b/src/control/cmd/dmg/pool.go @@ -339,6 +339,10 @@ func (cmd *PoolCreateCmd) storageManual(req *control.PoolCreateReq) error { return cmd.storageManualMdOnSsd(req) case cmd.MemRatio.IsSet(): 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 diff --git a/src/control/cmd/dmg/pool_test.go b/src/control/cmd/dmg/pool_test.go index 3f627dcd7bd..d6ce6f875ed 100644 --- a/src/control/cmd/dmg/pool_test.go +++ b/src/control/cmd/dmg/pool_test.go @@ -233,7 +233,7 @@ func TestPoolCommands(t *testing.T) { "Create pool with missing size", "pool create label", "", - errors.New("must be set"), + errors.New("at least one size parameter must be set"), }, { "Create pool with missing label", @@ -380,7 +380,7 @@ func TestPoolCommands(t *testing.T) { "Create pool with incompatible arguments (-n without -s)", fmt.Sprintf("pool create label --nvme-size %s", testSizeStr), "", - errors.New("must be set"), + errors.New("cannot be set without --scm-size"), }, { "Create pool with minimal arguments", diff --git a/src/control/cmd/dmg/pretty/pool.go b/src/control/cmd/dmg/pretty/pool.go index f6789699bdf..8e71e4518d0 100644 --- a/src/control/cmd/dmg/pretty/pool.go +++ b/src/control/cmd/dmg/pretty/pool.go @@ -118,7 +118,9 @@ func PrintPoolCreateResponse(pcr *control.PoolCreateResp, out io.Writer, opts .. fmtArgs = append(fmtArgs, txtfmt.TableRow{"Service Leader": fmt.Sprintf("%d", pcr.Leader)}) fmtArgs = append(fmtArgs, txtfmt.TableRow{"Service Ranks": pretty.PrintRanks(pcr.SvcReps)}) fmtArgs = append(fmtArgs, txtfmt.TableRow{"Storage Ranks": pretty.PrintRanks(pcr.TgtRanks)}) - fmtArgs = append(fmtArgs, txtfmt.TableRow{"Total Size": humanize.Bytes(totalSize * numRanks)}) + fmtArgs = append(fmtArgs, txtfmt.TableRow{ + "Total Size": humanize.Bytes(totalSize * uint64(numRanks)), + }) mdOnSsdEnabled := pcr.MemFileBytes > 0 diff --git a/src/control/lib/control/pool.go b/src/control/lib/control/pool.go index 0f29d445ca2..f9f54336399 100644 --- a/src/control/lib/control/pool.go +++ b/src/control/lib/control/pool.go @@ -210,19 +210,12 @@ type ( ACL *AccessControlList `json:"-"` NumSvcReps uint32 `json:"num_svc_reps"` Properties []*daos.PoolProperty `json:"-"` - // Auto-config params. - TotalBytes uint64 - TierRatio []float64 - NumRanks uint32 - // Manual params. - Ranks []ranklist.Rank - TierBytes []uint64 // Per-rank values. Metadata/Data sizes in MD-on-SSD mode. - TotalBytes uint64 `json:"total_bytes"` // Auto-sizing param - TierRatio []float64 `json:"tier_ratio"` // Auto-sizing param - NumRanks uint32 `json:"num_ranks"` // Auto-sizing param - Ranks []ranklist.Rank `json:"ranks"` // Manual-sizing param - TierBytes []uint64 `json:"tier_bytes"` // Per-rank values - MemRatio float32 `json:"mem_ratio"` // mem_file_size:meta_blob_size + TotalBytes uint64 `json:"total_bytes"` // Auto-sizing param + TierRatio []float64 `json:"tier_ratio"` // Auto-sizing param + NumRanks uint32 `json:"num_ranks"` // Auto-sizing param + Ranks []ranklist.Rank `json:"ranks"` // Manual-sizing param + TierBytes []uint64 `json:"tier_bytes"` // Per-rank values + MemRatio float32 `json:"mem_ratio"` // mem_file_size:meta_blob_size } // PoolCreateResp contains the response from a pool create request. diff --git a/src/control/server/mgmt_pool_test.go b/src/control/server/mgmt_pool_test.go index a410a162c70..24f109cf196 100644 --- a/src/control/server/mgmt_pool_test.go +++ b/src/control/server/mgmt_pool_test.go @@ -248,8 +248,8 @@ func TestServer_MgmtSvc_calculateCreateStorage(t *testing.T) { }, "auto sizing (mem-ratio but not MD-on-SSD)": { in: &mgmtpb.PoolCreateReq{ - Totalbytes: defaultTotal, - Tierratio: defaultRatios, + TotalBytes: defaultTotal, + TierRatio: defaultRatios, Ranks: []uint32{0, 1}, MemRatio: 0.2, }, @@ -276,8 +276,7 @@ func TestServer_MgmtSvc_calculateCreateStorage(t *testing.T) { }, "mem-ratio is set (mdonssd not configured)": { in: &mgmtpb.PoolCreateReq{ -<<<<<<< HEAD - Tierbytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, + TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, Ranks: []uint32{0}, MemRatio: storage.DefaultMemoryFileRatio, }, @@ -286,11 +285,11 @@ func TestServer_MgmtSvc_calculateCreateStorage(t *testing.T) { "mem-ratio is unset (mdonssd configured)": { enableMdOnSsd: true, in: &mgmtpb.PoolCreateReq{ - Tierbytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, + TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, Ranks: []uint32{0}, }, expOut: &mgmtpb.PoolCreateReq{ - Tierbytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, + TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, Ranks: []uint32{0}, MemRatio: storage.DefaultMemoryFileRatio, }, @@ -298,19 +297,14 @@ func TestServer_MgmtSvc_calculateCreateStorage(t *testing.T) { "mem-ratio is set (mdonssd configured)": { enableMdOnSsd: true, in: &mgmtpb.PoolCreateReq{ - Tierbytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, + TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, Ranks: []uint32{0}, MemRatio: 0.25, }, expOut: &mgmtpb.PoolCreateReq{ - Tierbytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, + TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, Ranks: []uint32{0}, MemRatio: 0.25, -======= - TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, - Ranks: []uint32{0}, - MetaBlobBytes: humanize.GByte, ->>>>>>> origin/feature/vos_on_blob_p2 }, }, "manual sizing": { @@ -340,19 +334,19 @@ func TestServer_MgmtSvc_calculateCreateStorage(t *testing.T) { "manual sizing (MD-on-SSD syntax used)": { enableMdOnSsd: true, in: &mgmtpb.PoolCreateReq{ - Tierbytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, + TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, Ranks: []uint32{0, 1}, MemRatio: 1, }, expOut: &mgmtpb.PoolCreateReq{ - Tierbytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, + TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, Ranks: []uint32{0, 1}, MemRatio: 1, }, }, "manual sizing (MD-on-SSD syntax used but not MD-on-SSD)": { in: &mgmtpb.PoolCreateReq{ - Tierbytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, + TierBytes: []uint64{defaultScmBytes - 1, defaultNvmeBytes - 1}, Ranks: []uint32{0, 1}, MemRatio: 1, }, @@ -496,17 +490,10 @@ func TestServer_MgmtSvc_PoolCreate(t *testing.T) { targetCount: 8, mdonssdEnabled: true, req: &mgmtpb.PoolCreateReq{ -<<<<<<< HEAD Uuid: test.MockUUID(1), - Tierbytes: []uint64{100 * humanize.GiByte, 10 * humanize.TByte}, + TierBytes: []uint64{100 * humanize.GiByte, 10 * humanize.TByte}, MemRatio: storage.DefaultMemoryFileRatio, Properties: testPoolLabelProp(), -======= - Uuid: test.MockUUID(1), - TierBytes: []uint64{100 * humanize.GiByte, 10 * humanize.TByte}, - MetaBlobBytes: 2 * humanize.GiByte, - Properties: testPoolLabelProp(), ->>>>>>> origin/feature/vos_on_blob_p2 }, drpcRet: &mgmtpb.PoolCreateResp{ TierBytes: []uint64{100 * humanize.GiByte, 10 * humanize.TByte},