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

Function create_action_name

tools/crm_simulate.c:628–686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628static char *
629create_action_name(action_t * action)
630{
631 char *action_name = NULL;
632 const char *prefix = NULL;
633 const char *action_host = NULL;
634 const char *task = action->task;
635
636 if (action->node) {
637 action_host = action->node->details->uname;
638 } else if(is_not_set(action->flags, pe_action_pseudo)) {
639 action_host = "<none>";
640 }
641
642 if (safe_str_eq(action->task, RSC_CANCEL)) {
643 prefix = "Cancel ";
644 task = "monitor"; /* TO-DO: Hack! */
645 }
646
647 if(action->rsc && action->rsc->clone_name) {
648 char *key = NULL;
649 const char *name = action->rsc->clone_name;
650 const char *interval_s = g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL);
651
652 int interval = crm_parse_int(interval_s, "0");
653
654 if (safe_str_eq(action->task, RSC_NOTIFY)
655 || safe_str_eq(action->task, RSC_NOTIFIED)) {
656 const char *n_type = g_hash_table_lookup(action->meta, "notify_key_type");
657 const char *n_task = g_hash_table_lookup(action->meta, "notify_key_operation");
658
659 CRM_ASSERT(n_type != NULL);
660 CRM_ASSERT(n_task != NULL);
661 key = generate_notify_key(name, n_type, n_task);
662
663 } else {
664 key = generate_op_key(name, task, interval);
665 }
666
667 if(action_host) {
668 action_name = g_strdup_printf("%s%s %s", prefix?prefix:"", key, action_host);
669 } else {
670 action_name = g_strdup_printf("%s%s", prefix?prefix:"", key);
671 }
672 free(key);
673
674 } else if(safe_str_eq(action->task, CRM_OP_FENCE)) {
675 action_name = g_strdup_printf("%s%s %s", prefix?prefix:"", action->task, action_host);
676
677 } else if(action_host) {
678 action_name = g_strdup_printf("%s%s %s", prefix?prefix:"", action->uuid, action_host);
679
680 } else {
681 action_name = g_strdup_printf("%s", action->uuid);
682 }
683
684
685 return action_name;

Callers 1

create_dotfileFunction · 0.70

Calls 4

is_not_setFunction · 0.85
crm_parse_intFunction · 0.85
generate_notify_keyFunction · 0.85
generate_op_keyFunction · 0.85

Tested by

no test coverage detected