MCPcopy Create free account
hub / github.com/corosync/corosync / wd_scan_resources

Function wd_scan_resources

exec/wd.c:544–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542}
543
544static void wd_scan_resources (void)
545{
546 int res_count = 0;
547 icmap_track_t icmap_track = NULL;
548 icmap_iter_t iter;
549 const char *key_name;
550 int res;
551 char res_name[ICMAP_KEYNAME_MAXLEN];
552 char res_type[ICMAP_KEYNAME_MAXLEN];
553 char tmp_key[ICMAP_KEYNAME_MAXLEN];
554
555 ENTER();
556
557 iter = icmap_iter_init("resources.");
558 while ((key_name = icmap_iter_next(iter, NULL, NULL)) != NULL) {
559 res = sscanf(key_name, "resources.%[^.].%[^.].%[^.]", res_type, res_name, tmp_key);
560 if (res != 3) {
561 continue ;
562 }
563
564 if (strcmp(tmp_key, "state") != 0) {
565 continue ;
566 }
567
568 snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "resources.%s.%s.", res_type, res_name);
569 if (wd_resource_create (tmp_key, res_name) == 0) {
570 res_count++;
571 }
572 }
573 icmap_iter_finalize(iter);
574
575 icmap_track_add("resources.process.", ICMAP_TRACK_ADD | ICMAP_TRACK_PREFIX,
576 wd_resource_created_cb, NULL, &icmap_track);
577 icmap_track_add("resources.system.", ICMAP_TRACK_ADD | ICMAP_TRACK_PREFIX,
578 wd_resource_created_cb, NULL, &icmap_track);
579
580 if (res_count == 0) {
581 log_printf (LOGSYS_LEVEL_INFO, "no resources configured.");
582 }
583}
584
585
586static void watchdog_timeout_apply (uint32_t new)

Callers 1

wd_exec_init_fnFunction · 0.85

Calls 5

icmap_iter_initFunction · 0.85
icmap_iter_nextFunction · 0.85
wd_resource_createFunction · 0.85
icmap_iter_finalizeFunction · 0.85
icmap_track_addFunction · 0.85

Tested by

no test coverage detected