MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / cmd_finalize

Function cmd_finalize

lrmd/lrmd.c:366–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366static void
367cmd_finalize(lrmd_cmd_t * cmd, lrmd_rsc_t * rsc)
368{
369 crm_trace("Resource operation rsc:%s action:%s completed (%p %p)", cmd->rsc_id, cmd->action, rsc?rsc->active:NULL, cmd);
370
371 if (rsc && (rsc->active == cmd)) {
372 rsc->active = NULL;
373 mainloop_set_trigger(rsc->work);
374 }
375
376 if (!rsc) {
377 cmd->rsc_deleted = 1;
378 }
379
380 send_cmd_complete_notify(cmd);
381
382 /* crmd expects lrmd to automatically cancel recurring ops after rsc stops */
383 if (rsc && safe_str_eq(cmd->action, "stop")) {
384 cancel_all_recurring(rsc, NULL);
385 }
386
387 if (cmd->interval && (cmd->lrmd_op_status == PCMK_LRM_OP_CANCELLED)) {
388 if (rsc) {
389 rsc->recurring_ops = g_list_remove(rsc->recurring_ops, cmd);
390 rsc->pending_ops = g_list_remove(rsc->pending_ops, cmd);
391 }
392 free_lrmd_cmd(cmd);
393 } else if (cmd->interval == 0) {
394 if (rsc) {
395 rsc->pending_ops = g_list_remove(rsc->pending_ops, cmd);
396 }
397 free_lrmd_cmd(cmd);
398 } else {
399 /* Clear all the values pertaining just to the last iteration of a recurring op. */
400 cmd->lrmd_op_status = 0;
401 memset(&cmd->t_run, 0, sizeof(cmd->t_run));
402 memset(&cmd->t_queue, 0, sizeof(cmd->t_queue));
403 free(cmd->output);
404 cmd->output = NULL;
405 }
406}
407
408static int
409lsb2uniform_rc(const char *action, int rc)

Callers 6

action_completeFunction · 0.85
stonith_action_completeFunction · 0.85
lrmd_rsc_execute_stonithFunction · 0.85
free_rscFunction · 0.85
cancel_opFunction · 0.85

Calls 4

mainloop_set_triggerFunction · 0.85
send_cmd_complete_notifyFunction · 0.85
cancel_all_recurringFunction · 0.85
free_lrmd_cmdFunction · 0.85

Tested by

no test coverage detected