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

Function create_child_clone

lib/pengine/clone.c:98–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98resource_t *
99create_child_clone(resource_t * rsc, int sub_id, pe_working_set_t * data_set)
100{
101 gboolean as_orphan = FALSE;
102 char *inc_num = NULL;
103 char *inc_max = NULL;
104 resource_t *child_rsc = NULL;
105 xmlNode *child_copy = NULL;
106 clone_variant_data_t *clone_data = NULL;
107
108 get_clone_variant_data(clone_data, rsc);
109
110 CRM_CHECK(clone_data->xml_obj_child != NULL, return FALSE);
111
112 if (sub_id < 0) {
113 as_orphan = TRUE;
114 sub_id = clone_data->total_clones;
115 }
116 inc_num = crm_itoa(sub_id);
117 inc_max = crm_itoa(clone_data->clone_max);
118
119 child_copy = copy_xml(clone_data->xml_obj_child);
120
121 crm_xml_add(child_copy, XML_RSC_ATTR_INCARNATION, inc_num);
122
123 if (common_unpack(child_copy, &child_rsc, rsc, data_set) == FALSE) {
124 pe_err("Failed unpacking resource %s", crm_element_value(child_copy, XML_ATTR_ID));
125 child_rsc = NULL;
126 goto bail;
127 }
128/* child_rsc->globally_unique = rsc->globally_unique; */
129
130 clone_data->total_clones += 1;
131 pe_rsc_trace(child_rsc, "Setting clone attributes for: %s", child_rsc->id);
132 rsc->children = g_list_append(rsc->children, child_rsc);
133 if (as_orphan) {
134 mark_as_orphan(child_rsc);
135 }
136
137 add_hash_param(child_rsc->meta, XML_RSC_ATTR_INCARNATION_MAX, inc_max);
138
139 print_resource(LOG_DEBUG_3, "Added", child_rsc, FALSE);
140
141 bail:
142 free(inc_num);
143 free(inc_max);
144
145 return child_rsc;
146}
147
148gboolean
149master_unpack(resource_t * rsc, pe_working_set_t * data_set)

Callers 2

clone_unpackFunction · 0.85
find_anonymous_cloneFunction · 0.85

Calls 8

crm_itoaFunction · 0.85
copy_xmlFunction · 0.85
crm_xml_addFunction · 0.85
common_unpackFunction · 0.85
crm_element_valueFunction · 0.85
mark_as_orphanFunction · 0.85
add_hash_paramFunction · 0.85
print_resourceFunction · 0.85

Tested by

no test coverage detected