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

Function ticket_new

lib/pengine/utils.c:1511–1547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1509}
1510
1511ticket_t *
1512ticket_new(const char *ticket_id, pe_working_set_t * data_set)
1513{
1514 ticket_t *ticket = NULL;
1515
1516 if (ticket_id == NULL || strlen(ticket_id) == 0) {
1517 return NULL;
1518 }
1519
1520 if (data_set->tickets == NULL) {
1521 data_set->tickets =
1522 g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, destroy_ticket);
1523 }
1524
1525 ticket = g_hash_table_lookup(data_set->tickets, ticket_id);
1526 if (ticket == NULL) {
1527
1528 ticket = calloc(1, sizeof(ticket_t));
1529 if (ticket == NULL) {
1530 crm_err("Cannot allocate ticket '%s'", ticket_id);
1531 return NULL;
1532 }
1533
1534 crm_trace("Creaing ticket entry for %s", ticket_id);
1535
1536 ticket->id = strdup(ticket_id);
1537 ticket->granted = FALSE;
1538 ticket->last_granted = -1;
1539 ticket->standby = FALSE;
1540 ticket->state = g_hash_table_new_full(crm_str_hash, g_str_equal,
1541 g_hash_destroy_str, g_hash_destroy_str);
1542
1543 g_hash_table_insert(data_set->tickets, strdup(ticket->id), ticket);
1544 }
1545
1546 return ticket;
1547}

Callers 3

unpack_ticket_stateFunction · 0.85
get_ticket_state_legacyFunction · 0.85
unpack_rsc_ticketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected