Skip to content

Commit

Permalink
s3-rpcclient: add clusapi_resume_node command.
Browse files Browse the repository at this point in the history
Guenther

Signed-off-by: Guenther Deschner <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>

Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Thu Jan  9 01:15:34 UTC 2020 on sn-devel-184
  • Loading branch information
gd authored and jrasamba committed Jan 9, 2020
1 parent c9077f1 commit 17e692a
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions source3/rpcclient/cmd_clusapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {

Expand Down Expand Up @@ -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,
},
Expand Down

0 comments on commit 17e692a

Please sign in to comment.