Skip to content

Commit

Permalink
resolve merge conflicts and fix unit tests
Browse files Browse the repository at this point in the history
Features: control pool
Required-githooks: true

Signed-off-by: Tom Nabarro <[email protected]>
  • Loading branch information
tanabarr committed Aug 7, 2024
1 parent 2f1853a commit d38ca61
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 40 deletions.
4 changes: 4 additions & 0 deletions src/control/cmd/dmg/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 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("must be set"),
errors.New("at least one size parameter must be set"),
},
{
"Create pool with missing label",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/control/cmd/dmg/pretty/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 6 additions & 13 deletions src/control/lib/control/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
35 changes: 11 additions & 24 deletions src/control/server/mgmt_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -286,31 +285,26 @@ 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,
},
},
"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": {
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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},
Expand Down

0 comments on commit d38ca61

Please sign in to comment.