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

Function clone_create_probe

pengine/clone.c:1469–1532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1467}
1468
1469gboolean
1470clone_create_probe(resource_t * rsc, node_t * node, action_t * complete,
1471 gboolean force, pe_working_set_t * data_set)
1472{
1473 GListPtr gIter = NULL;
1474 gboolean any_created = FALSE;
1475 clone_variant_data_t *clone_data = NULL;
1476
1477 get_clone_variant_data(clone_data, rsc);
1478
1479 rsc->children = g_list_sort(rsc->children, sort_rsc_id);
1480 if (rsc->children == NULL) {
1481 pe_warn("Clone %s has no children", rsc->id);
1482 return FALSE;
1483 }
1484
1485 if (is_not_set(rsc->flags, pe_rsc_unique)
1486 && clone_data->clone_node_max == 1) {
1487 /* only look for one copy */
1488 resource_t *child = NULL;
1489
1490 /* Try whoever we probed last time */
1491 child = find_instance_on(rsc, node);
1492 if (child) {
1493 return child->cmds->create_probe(child, node, complete, force, data_set);
1494 }
1495
1496 /* Try whoever we plan on starting there */
1497 gIter = rsc->children;
1498 for (; gIter != NULL; gIter = gIter->next) {
1499 resource_t *child_rsc = (resource_t *) gIter->data;
1500 node_t *local_node = child_rsc->fns->location(child_rsc, NULL, FALSE);
1501
1502 if (local_node == NULL) {
1503 continue;
1504 }
1505
1506 if (local_node->details == node->details) {
1507 return child_rsc->cmds->create_probe(child_rsc, node, complete, force, data_set);
1508 }
1509 }
1510
1511 /* Fall back to the first clone instance */
1512 child = rsc->children->data;
1513 return child->cmds->create_probe(child, node, complete, force, data_set);
1514 }
1515
1516 gIter = rsc->children;
1517 for (; gIter != NULL; gIter = gIter->next) {
1518 resource_t *child_rsc = (resource_t *) gIter->data;
1519
1520 if (child_rsc->cmds->create_probe(child_rsc, node, complete, force, data_set)) {
1521 any_created = TRUE;
1522 }
1523
1524 if (any_created && is_not_set(rsc->flags, pe_rsc_unique)
1525 && clone_data->clone_node_max == 1) {
1526 /* only look for one copy (clone :0) */

Callers

nothing calls this directly

Calls 2

is_not_setFunction · 0.85
find_instance_onFunction · 0.85

Tested by

no test coverage detected