Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
532 changes: 516 additions & 16 deletions src/control/common/proto/shared/check_engine.pb.go

Large diffs are not rendered by default.

587 changes: 44 additions & 543 deletions src/control/common/proto/srv/srv.pb.go

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions src/control/server/mgmt_drpc_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"google.golang.org/protobuf/proto"

sharedpb "github.com/daos-stack/daos/src/control/common/proto/shared"
srvpb "github.com/daos-stack/daos/src/control/common/proto/srv"
"github.com/daos-stack/daos/src/control/drpc"
"github.com/daos-stack/daos/src/control/fault"
"github.com/daos-stack/daos/src/control/fault/code"
Expand All @@ -27,13 +26,13 @@ import (

func (mod *srvModule) handleCheckerListPools(_ context.Context, reqb []byte) (out []byte, outErr error) {
// TODO: Remove if we never add request fields?
req := new(srvpb.CheckListPoolReq)
req := new(sharedpb.CheckListPoolReq)
if err := proto.Unmarshal(reqb, req); err != nil {
return nil, drpc.UnmarshalingPayloadFailure()
}
mod.log.Debugf("handling CheckerListPools: %+v", req)

resp := new(srvpb.CheckListPoolResp)
resp := new(sharedpb.CheckListPoolResp)
defer func() {
mod.log.Debugf("CheckerListPools resp: %+v", resp)
out, outErr = proto.Marshal(resp)
Expand All @@ -47,7 +46,7 @@ func (mod *srvModule) handleCheckerListPools(_ context.Context, reqb []byte) (ou
}

for _, ps := range pools {
resp.Pools = append(resp.Pools, &srvpb.CheckListPoolResp_OnePool{
resp.Pools = append(resp.Pools, &sharedpb.CheckListPoolResp_OnePool{
Uuid: ps.PoolUUID.String(),
Label: ps.PoolLabel,
Svcreps: ranklist.RanksToUint32(ps.Replicas),
Expand All @@ -58,13 +57,13 @@ func (mod *srvModule) handleCheckerListPools(_ context.Context, reqb []byte) (ou
}

func (mod *srvModule) handleCheckerRegisterPool(parent context.Context, reqb []byte) (out []byte, outErr error) {
req := new(srvpb.CheckRegPoolReq)
req := new(sharedpb.CheckRegPoolReq)
if err := proto.Unmarshal(reqb, req); err != nil {
return nil, drpc.UnmarshalingPayloadFailure()
}
mod.log.Debugf("handling CheckerRegisterPool: %+v", req)

resp := new(srvpb.CheckRegPoolResp)
resp := new(sharedpb.CheckRegPoolResp)
defer func() {
mod.log.Debugf("CheckerRegisterPool resp: %+v", resp)
out, outErr = proto.Marshal(resp)
Expand Down Expand Up @@ -147,13 +146,13 @@ func (mod *srvModule) handleCheckerRegisterPool(parent context.Context, reqb []b
}

func (mod *srvModule) handleCheckerDeregisterPool(parent context.Context, reqb []byte) (out []byte, outErr error) {
req := new(srvpb.CheckDeregPoolReq)
req := new(sharedpb.CheckDeregPoolReq)
if err := proto.Unmarshal(reqb, req); err != nil {
return nil, drpc.UnmarshalingPayloadFailure()
}
mod.log.Debugf("handling CheckerDeregisterPool: %+v", req)

resp := new(srvpb.CheckDeregPoolResp)
resp := new(sharedpb.CheckDeregPoolResp)
defer func() {
mod.log.Debugf("CheckerDeregisterPool resp: %+v", resp)
out, outErr = proto.Marshal(resp)
Expand Down
51 changes: 25 additions & 26 deletions src/control/server/mgmt_drpc_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/daos-stack/daos/src/control/build"
chkpb "github.com/daos-stack/daos/src/control/common/proto/chk"
sharedpb "github.com/daos-stack/daos/src/control/common/proto/shared"
srvpb "github.com/daos-stack/daos/src/control/common/proto/srv"
"github.com/daos-stack/daos/src/control/common/test"
"github.com/daos-stack/daos/src/control/drpc"
"github.com/daos-stack/daos/src/control/lib/control"
Expand Down Expand Up @@ -53,7 +52,7 @@ func TestSrvModule_HandleCheckerListPools(t *testing.T) {
for name, tc := range map[string]struct {
req []byte
notReplica bool
expResp *srvpb.CheckListPoolResp
expResp *sharedpb.CheckListPoolResp
expErr error
}{
"bad payload": {
Expand All @@ -62,11 +61,11 @@ func TestSrvModule_HandleCheckerListPools(t *testing.T) {
},
"not replica": {
notReplica: true,
expResp: &srvpb.CheckListPoolResp{Status: int32(daos.MiscError)},
expResp: &sharedpb.CheckListPoolResp{Status: int32(daos.MiscError)},
},
"success": {
expResp: &srvpb.CheckListPoolResp{
Pools: []*srvpb.CheckListPoolResp_OnePool{
expResp: &sharedpb.CheckListPoolResp{
Pools: []*sharedpb.CheckListPoolResp_OnePool{
{
Uuid: testPool.PoolUUID.String(),
Label: testPool.PoolLabel,
Expand Down Expand Up @@ -100,7 +99,7 @@ func TestSrvModule_HandleCheckerListPools(t *testing.T) {
return
}

gotResp := new(srvpb.CheckListPoolResp)
gotResp := new(sharedpb.CheckListPoolResp)
if err := proto.Unmarshal(gotMsg, gotResp); err != nil {
t.Fatal(err)
}
Expand All @@ -123,7 +122,7 @@ func TestSrvModule_HandleCheckerRegisterPool(t *testing.T) {
Replicas: []ranklist.Rank{0, 1, 2},
}
makeReqBytes := func(id, label string, replicas []ranklist.Rank) []byte {
req := &srvpb.CheckRegPoolReq{
req := &sharedpb.CheckRegPoolReq{
Uuid: id,
Label: label,
Svcreps: ranklist.RanksToUint32(replicas),
Expand All @@ -139,7 +138,7 @@ func TestSrvModule_HandleCheckerRegisterPool(t *testing.T) {
for name, tc := range map[string]struct {
req []byte
notReplica bool
expResp *srvpb.CheckRegPoolResp
expResp *sharedpb.CheckRegPoolResp
expErr error
}{
"bad payload": {
Expand All @@ -148,45 +147,45 @@ func TestSrvModule_HandleCheckerRegisterPool(t *testing.T) {
},
"bad uuid": {
req: makeReqBytes("ow", "new", []ranklist.Rank{0}),
expResp: &srvpb.CheckRegPoolResp{Status: int32(daos.InvalidInput)},
expResp: &sharedpb.CheckRegPoolResp{Status: int32(daos.InvalidInput)},
},
"bad label": {
req: makeReqBytes(newUUID, newUUID, []ranklist.Rank{0}),
expResp: &srvpb.CheckRegPoolResp{Status: int32(daos.InvalidInput)},
expResp: &sharedpb.CheckRegPoolResp{Status: int32(daos.InvalidInput)},
},
"empty label": {
req: makeReqBytes(newUUID, "", []ranklist.Rank{0}),
expResp: &srvpb.CheckRegPoolResp{Status: int32(daos.InvalidInput)},
expResp: &sharedpb.CheckRegPoolResp{Status: int32(daos.InvalidInput)},
},
"zero svcreps": {
req: makeReqBytes(newUUID, "new", []ranklist.Rank{}),
expResp: &srvpb.CheckRegPoolResp{Status: int32(daos.InvalidInput)},
expResp: &sharedpb.CheckRegPoolResp{Status: int32(daos.InvalidInput)},
},
"not replica on update": {
req: makeReqBytes(existingPool.PoolUUID.String(), "new-label", []ranklist.Rank{1}),
notReplica: true,
expResp: &srvpb.CheckRegPoolResp{Status: int32(daos.MiscError)},
expResp: &sharedpb.CheckRegPoolResp{Status: int32(daos.MiscError)},
},
"not replica on add": {
req: makeReqBytes(newUUID, "new", []ranklist.Rank{0}),
notReplica: true,
expResp: &srvpb.CheckRegPoolResp{Status: int32(daos.MiscError)},
expResp: &sharedpb.CheckRegPoolResp{Status: int32(daos.MiscError)},
},
"duplicate label on update": {
req: makeReqBytes(existingPool.PoolUUID.String(), otherPool.PoolLabel, []ranklist.Rank{0}),
expResp: &srvpb.CheckRegPoolResp{Status: int32(daos.Exists)},
expResp: &sharedpb.CheckRegPoolResp{Status: int32(daos.Exists)},
},
"duplicate label on add": {
req: makeReqBytes(newUUID, existingPool.PoolLabel, []ranklist.Rank{0}),
expResp: &srvpb.CheckRegPoolResp{Status: int32(daos.Exists)},
expResp: &sharedpb.CheckRegPoolResp{Status: int32(daos.Exists)},
},
"successful update": {
req: makeReqBytes(existingPool.PoolUUID.String(), "new-label", []ranklist.Rank{1}),
expResp: &srvpb.CheckRegPoolResp{},
expResp: &sharedpb.CheckRegPoolResp{},
},
"successful add": {
req: makeReqBytes(newUUID, "new", []ranklist.Rank{0}),
expResp: &srvpb.CheckRegPoolResp{},
expResp: &sharedpb.CheckRegPoolResp{},
},
} {
t.Run(name, func(t *testing.T) {
Expand Down Expand Up @@ -218,7 +217,7 @@ func TestSrvModule_HandleCheckerRegisterPool(t *testing.T) {
return
}

gotResp := new(srvpb.CheckRegPoolResp)
gotResp := new(sharedpb.CheckRegPoolResp)
if err := proto.Unmarshal(gotMsg, gotResp); err != nil {
t.Fatal(err)
}
Expand All @@ -236,7 +235,7 @@ func TestSrvModule_HandleCheckerDeregisterPool(t *testing.T) {
Replicas: []ranklist.Rank{0, 1, 2},
}
makeReqBytes := func(id string) []byte {
req := &srvpb.CheckDeregPoolReq{
req := &sharedpb.CheckDeregPoolReq{
Uuid: id,
}
b, err := proto.Marshal(req)
Expand All @@ -250,7 +249,7 @@ func TestSrvModule_HandleCheckerDeregisterPool(t *testing.T) {
for name, tc := range map[string]struct {
req []byte
notReplica bool
expResp *srvpb.CheckDeregPoolResp
expResp *sharedpb.CheckDeregPoolResp
expErr error
}{
"bad payload": {
Expand All @@ -260,19 +259,19 @@ func TestSrvModule_HandleCheckerDeregisterPool(t *testing.T) {
"not replica": {
req: makeReqBytes(existingPool.PoolUUID.String()),
notReplica: true,
expResp: &srvpb.CheckDeregPoolResp{Status: int32(daos.MiscError)},
expResp: &sharedpb.CheckDeregPoolResp{Status: int32(daos.MiscError)},
},
"bad uuid": {
req: makeReqBytes("ow"),
expResp: &srvpb.CheckDeregPoolResp{Status: int32(daos.InvalidInput)},
expResp: &sharedpb.CheckDeregPoolResp{Status: int32(daos.InvalidInput)},
},
"unknown uuid": {
req: makeReqBytes(unkUUID),
expResp: &srvpb.CheckDeregPoolResp{Status: int32(daos.Nonexistent)},
expResp: &sharedpb.CheckDeregPoolResp{Status: int32(daos.Nonexistent)},
},
"success": {
req: makeReqBytes(existingPool.PoolUUID.String()),
expResp: &srvpb.CheckDeregPoolResp{},
expResp: &sharedpb.CheckDeregPoolResp{},
},
} {
t.Run(name, func(t *testing.T) {
Expand Down Expand Up @@ -300,7 +299,7 @@ func TestSrvModule_HandleCheckerDeregisterPool(t *testing.T) {
return
}

gotResp := new(srvpb.CheckDeregPoolResp)
gotResp := new(sharedpb.CheckDeregPoolResp)
if err := proto.Unmarshal(gotMsg, gotResp); err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def scons():
# Add runtime paths for daos libraries
denv.AppendUnique(RPATH_FULL=['$PREFIX/lib64/daos_srv'])

sources = ['drpc_client.c', 'drpc_ras.c',
sources = ['drpc_client.c', 'drpc_ras.c', 'drpc_chk.c',
'drpc_handler.c', 'drpc_listener.c',
'drpc_progress.c', 'init.c', 'module.c',
'srv_cli.c', 'profile.c', 'rpc.c',
Expand Down
Loading
Loading