From: Günther Deschner Date: Mon, 9 May 2016 10:10:22 +0000 (+0200) Subject: s3-rpcclient: add clusapi_resume_node command. X-Git-Tag: ldb-2.1.0~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17e692a9fa6b1475855aef5e425c4e4d6b1fd3bc;p=thirdparty%2Fsamba.git s3-rpcclient: add clusapi_resume_node command. Guenther Signed-off-by: Guenther Deschner Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu Jan 9 01:15:34 UTC 2020 on sn-devel-184 --- diff --git a/source3/rpcclient/cmd_clusapi.c b/source3/rpcclient/cmd_clusapi.c index 9776a8dde65..7f208a1ca1a 100644 --- a/source3/rpcclient/cmd_clusapi.c +++ b/source3/rpcclient/cmd_clusapi.c @@ -556,6 +556,61 @@ static WERROR cmd_clusapi_pause_node(struct rpc_pipe_client *cli, return WERR_OK; } +static WERROR cmd_clusapi_resume_node(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + struct dcerpc_binding_handle *b = cli->binding_handle; + NTSTATUS status; + const char *lpszNodeName = "CTDB_NODE_0"; + WERROR Status; + struct policy_handle hNode; + WERROR rpc_status; + WERROR result, ignore; + + if (argc >= 2) { + lpszNodeName = argv[1]; + } + + status = dcerpc_clusapi_OpenNode(b, mem_ctx, + lpszNodeName, + &Status, + &rpc_status, + &hNode); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + if (!W_ERROR_IS_OK(Status)) { + printf("Failed to open node %s\n", lpszNodeName); + printf("Status: %s\n", win_errstr(Status)); + return Status; + } + + status = dcerpc_clusapi_ResumeNode(b, mem_ctx, + hNode, + &rpc_status, + &result); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + if (!W_ERROR_IS_OK(result)) { + printf("Failed to resume node %s\n", lpszNodeName); + printf("Status: %s\n", win_errstr(result)); + return result; + } + + dcerpc_clusapi_CloseNode(b, mem_ctx, + &hNode, + &ignore); + + printf("Cluster node %s has been resumed\n", lpszNodeName); + printf("rpc_status: %s\n", win_errstr(rpc_status)); + + return WERR_OK; +} + struct cmd_set clusapi_commands[] = { @@ -682,6 +737,16 @@ struct cmd_set clusapi_commands[] = { .description = "Pause cluster node", .usage = "", }, + { + .name = "clusapi_resume_node", + .returntype = RPC_RTYPE_WERROR, + .ntfn = NULL, + .wfn = cmd_clusapi_resume_node, + .table = &ndr_table_clusapi, + .rpc_pipe = NULL, + .description = "Resume cluster node", + .usage = "", + }, { .name = NULL, },