DAOS-16311 control: Add C bindings for control API#17550
Conversation
b1d5b89 to
aa22df5
Compare
|
Ticket title is 'C bindings for DAOS control API' |
|
Test stage Unit Test on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/2/testReport/ |
|
Test stage Unit Test with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/2/testReport/ |
|
Test stage Unit Test bdev with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/2/testReport/ |
|
Test stage Test RPMs on EL 8.6 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/2/execution/node/1026/log |
|
Test stage Functional on EL 8.8 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17550/2/display/redirect |
1 similar comment
|
Test stage Functional on EL 8.8 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17550/2/display/redirect |
aa22df5 to
9008458
Compare
|
Test stage Unit Test on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/3/testReport/ |
|
Test stage Unit Test with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/3/testReport/ |
|
Test stage Unit Test bdev with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/3/testReport/ |
9008458 to
249715f
Compare
|
Test stage Unit Test on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/4/testReport/ |
|
Test stage Unit Test with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/4/testReport/ |
|
Test stage Unit Test bdev with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/4/testReport/ |
|
Test stage Test RPMs on EL 8.6 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/4/execution/node/1040/log |
|
Test stage Functional on EL 8.8 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17550/4/display/redirect |
1 similar comment
|
Test stage Functional on EL 8.8 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17550/4/display/redirect |
249715f to
4b56bdd
Compare
|
Test stage Unit Test bdev with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/5/testReport/ |
|
Test stage Unit Test with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/5/testReport/ |
|
Test stage Unit Test on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/5/testReport/ |
4b56bdd to
096a1da
Compare
|
Test stage Unit Test on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/6/testReport/ |
|
Test stage Unit Test with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/6/testReport/ |
|
Test stage Unit Test bdev with memcheck on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/6/testReport/ |
|
Test stage Test RPMs on EL 8.6 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/6/execution/node/1047/log |
|
Test stage Functional on EL 8.8 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17550/6/display/redirect |
1 similar comment
|
Test stage Functional on EL 8.8 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17550/6/display/redirect |
|
Test stage Functional Hardware Medium MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/41/execution/node/1284/log |
|
Test stage Functional Hardware Medium MD on SSD completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/42/testReport/ |
|
Test stage Functional Hardware Medium Verbs Provider MD on SSD completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/42/testReport/ |
|
Test stage NLT completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/43/testReport/ |
|
Test stage Functional on EL 9 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/43/execution/node/982/log |
|
Test stage NLT completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/44/testReport/ |
kjacque
left a comment
There was a problem hiding this comment.
Overall I like the approach. I gave it a fairly superficial look over, my comments are mostly on the tests.
I don't like the callProductionCode type test wrappers if they aren't really saving us a lot of repetition--they make it harder to understand what the tests are doing, since I have to keep jumping between files to remember what the wrapper is hiding.
| if rc == 0 { | ||
| callFini(handle) | ||
| t.Fatal("expected error for non-existent config file, got success") | ||
| } |
There was a problem hiding this comment.
We can probably expect a specific error rc here, right?
In general these test cases might be a good fit for table-formatted tests.
| func recoverExport(rc *C.int) { | ||
| if r := recover(); r != nil { | ||
| fmt.Fprintf(os.Stderr, "panic in libdaos_control export: %v\n%s\n", r, debug.Stack()) | ||
| *rc = C.int(daos.MiscError) |
There was a problem hiding this comment.
Might be worth creating a new error code for this scenario.
| /** | ||
| * Arguments for daos_control_pool_create. | ||
| */ | ||
| struct daos_control_pool_create_args { |
There was a problem hiding this comment.
Wonder if this would be better to split into two structs, with in-args and out-args.
| /** | ||
| * Maximum number of interactive action choices per check report. The server | ||
| * currently caps this at CHK_INTERACT_OPTION_MAX (src/chk/chk_internal.h); | ||
| * this value must be >= the server cap. check.go truncates extra choices if | ||
| * the server ever sends more than fit here. | ||
| */ | ||
| #define DAOS_CHECK_MAX_ACT_OPTIONS 4 |
There was a problem hiding this comment.
Looks like we don't have the advantage of a file that sees both of these, if it's coming from an internal header. I don't love having to maintain something like this in both places. Is there a public file the internal definition could be moved to?
| * DAOS checker pool information. | ||
| */ | ||
| struct daos_check_pool_info { | ||
| uuid_t dcpi_uuid; |
There was a problem hiding this comment.
Some structs are using this prefix style, while others just have bare names for member variables. IMO we should stick to one or the other.
| return errorToRC(validatePoolCreateArgs(&args)) | ||
| } | ||
|
|
||
| func callPoolDestroy(handle cgo.Handle, poolUUID uuid.UUID, force bool) int { |
There was a problem hiding this comment.
I don't love how these helpers hide the function actually being tested. Can't most of these go into the body of the tests? Or at the very least, the test file where they're relevant?
| func TestSystemExcludeRank(t *testing.T) { | ||
| for name, tc := range map[string]struct { | ||
| mic *control.MockInvokerConfig | ||
| rank uint32 | ||
| expRC int | ||
| }{ | ||
| "success": { | ||
| mic: &control.MockInvokerConfig{ | ||
| UnaryResponse: control.MockMSResponse("host1", nil, &mgmtpb.SystemExcludeResp{ | ||
| Results: []*sharedpb.RankResult{ | ||
| {Rank: 0, State: "excluded"}, | ||
| }, | ||
| }), | ||
| }, | ||
| rank: 0, | ||
| expRC: 0, | ||
| }, | ||
| } { |
There was a problem hiding this comment.
Going to add an error case for this one?
| } { | ||
| t.Run(name, func(t *testing.T) { | ||
| if got := testCopyStringToCharArray(tc.input, tc.bufSize); got != tc.want { | ||
| t.Fatalf("got %q, want %q", got, tc.want) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestCopyStringToCharArrayNilDest(t *testing.T) { | ||
| testCopyStringToNil() | ||
| } |
There was a problem hiding this comment.
I like helper functions but this is a little painful to read and understand. Are these helpers even re-used anywhere else?
| rpcFn := func(rpcCtx context.Context, conn *grpc.ClientConn) (proto.Message, error) { | ||
| if mgmtSvc != 0 { | ||
| return mgmtpb.NewMgmtSvcClient(conn).FaultInjectMgmtPoolFault(rpcCtx, payload) | ||
| } | ||
| return mgmtpb.NewMgmtSvcClient(conn).FaultInjectPoolFault(rpcCtx, payload) | ||
| } | ||
| _, err = control.InvokeFaultRPC(ctx.ctx(), ctx.client, rpcFn) |
There was a problem hiding this comment.
We don't have a control endpoint for this, I guess?
|
|
||
| // propsFromC converts a daos_prop_t to Go PoolProperty values for a | ||
| // pool-create request. | ||
| func propsFromC(cProps *C.daos_prop_t) ([]*daos.PoolProperty, error) { |
There was a problem hiding this comment.
Does the daos API (going in the other direction) have an existing utility function for this that could be re-used? Or no?
|
Test stage Functional Hardware Medium Verbs Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/44/execution/node/1434/log |
|
Test stage Functional Hardware Medium MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/44/execution/node/1424/log |
|
Test stage Unit Test with memcheck completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/45/testReport/ |
|
Test stage Unit Test bdev with memcheck completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/45/testReport/ |
|
Test stage Functional Hardware Large MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/45/execution/node/1341/log |
|
Test stage Functional Hardware Medium MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/45/execution/node/1421/log |
|
Test stage Functional Hardware Medium Verbs Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/45/execution/node/1462/log |
|
Test stage Unit Test with memcheck completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17550/46/testReport/ |
|
Test stage Functional Hardware Medium Verbs Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/46/execution/node/1620/log |
|
Test stage Functional Hardware Medium MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/46/execution/node/1610/log |
|
Test stage Functional Hardware Large MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/47/execution/node/1797/log |
|
Test stage Functional Hardware Medium Verbs Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/47/execution/node/1777/log |
|
Test stage Functional Hardware Medium MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17550/47/execution/node/1787/log |
Use Go's c-shared-library mode to build a .so that exposes a C API for the Go Control API. The initial use case for this library is to replace the problematic dmg helpers test library that uses fork/exec to allow tests to drive dmg commands. Skip-hw-medium-ucx-provider: false Features: cat_recov Signed-off-by: Michael MacDonald <github@macdonald.cx>
* daos_pool: Don't escape self_heal prop value * control/server.go: Raw %v logging panics on nil; just remove it Signed-off-by: Michael MacDonald <github@macdonald.cx>
Update the cat_recov suite to work better with the new libdaos_control bindings, which operate more quickly and correctly than the old fork/exec dmg wrappers. - Check repair takes the CIA_ action value directly, where the old dmg CLI translated a selection index into the action. - The bindings answer queries in milliseconds where the fork/exec dmg helpers took 1-2s, which throws off some of the timing assumptions in the tests. Adjust to use a wall-clock budget instead of counting query iterations. - Pool-not-found now maps to DER_NONEXIST instead of DER_MISC, so cr_cleanup no longer needs to tolerate DER_MISC. Skip-hw-medium-ucx-provider: false Features: cat_recov daos_core_test_nvme Signed-off-by: Michael MacDonald <github@macdonald.cx>
Use Go's c-shared-library mode to build a .so that
exposes a C API for the Go Control API. The initial
use case for this library is to replace the problematic
dmg helpers test library that uses fork/exec to allow
tests to drive dmg commands.
Signed-off-by: Michael MacDonald github@macdonald.cx