27 #define VARIANT_GROUP 1
33 xmlNode *xml_obj = rsc->
xml;
34 xmlNode *xml_native_rsc = NULL;
35 group_variant_data_t *group_data = NULL;
37 const char *group_colocated = g_hash_table_lookup(rsc->
meta,
"collocated");
38 const char *clone_id = NULL;
42 group_data = calloc(1,
sizeof(group_variant_data_t));
43 group_data->num_children = 0;
44 group_data->first_child = NULL;
45 group_data->last_child = NULL;
48 group_data->ordered = TRUE;
49 group_data->colocated = TRUE;
51 if (group_ordered != NULL) {
54 if (group_colocated != NULL) {
60 for (xml_native_rsc = __xml_first_child(xml_obj); xml_native_rsc != NULL;
61 xml_native_rsc = __xml_next_element(xml_native_rsc)) {
66 if (
common_unpack(xml_native_rsc, &new_rsc, rsc, data_set) == FALSE) {
68 if (new_rsc != NULL && new_rsc->
fns != NULL) {
73 group_data->num_children++;
76 if (group_data->first_child == NULL) {
77 group_data->first_child = new_rsc;
79 group_data->last_child = new_rsc;
84 if (group_data->num_children == 0) {
95 pe_rsc_trace(rsc,
"Added %d children to resource %s...", group_data->num_children, rsc->
id);
103 gboolean c_all = TRUE;
104 gboolean c_any = FALSE;
107 for (; gIter != NULL; gIter = gIter->next) {
110 if (child_rsc->
fns->
active(child_rsc, all)) {
117 if (c_any == FALSE) {
119 }
else if (all && c_all == FALSE) {
126 group_print_xml(
resource_t * rsc,
const char *pre_text,
long options,
void *print_data)
129 char *child_text =
crm_concat(pre_text,
" ",
' ');
135 for (; gIter != NULL; gIter = gIter->next) {
138 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
148 char *child_text = NULL;
151 if (pre_text == NULL) {
156 group_print_xml(rsc, pre_text, options, print_data);
162 status_print(
"%sResource Group: %s", pre_text ? pre_text :
"", rsc->
id);
175 for (; gIter != NULL; gIter = gIter->next) {
178 if (options & pe_print_html) {
181 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
182 if (options & pe_print_html) {
188 if (options & pe_print_html) {
203 for (; gIter != NULL; gIter = gIter->next) {
208 child_rsc->
fns->
free(child_rsc);
223 for (; gIter != NULL; gIter = gIter->next) {
227 if (role > group_role) {
#define CRM_CHECK(expr, failure_action)
void group_free(resource_t *rsc)
#define crm_config_err(fmt...)
#define XML_RSC_ATTR_INCARNATION
gboolean common_unpack(xmlNode *xml_obj, resource_t **rsc, resource_t *parent, pe_working_set_t *data_set)
void(* free)(resource_t *)
void common_free(resource_t *rsc)
#define status_print(fmt, args...)
void print_rscs_brief(GListPtr rsc_list, const char *pre_text, long options, void *print_data, gboolean print_all)
enum rsc_role_e group_resource_state(const resource_t *rsc, gboolean current)
const char * role2text(enum rsc_role_e role)
gboolean(* active)(resource_t *, gboolean)
#define XML_CIB_TAG_RESOURCE
resource_object_functions_t * fns
#define XML_RSC_ATTR_ORDERED
const char * crm_element_value(xmlNode *data, const char *name)
void group_print(resource_t *rsc, const char *pre_text, long options, void *print_data)
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
#define crm_config_warn(fmt...)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
int crm_str_to_boolean(const char *s, int *ret)
void(* print)(resource_t *, const char *, long, void *)
enum rsc_role_e(* state)(const resource_t *, gboolean)
gboolean group_active(resource_t *rsc, gboolean all)
#define pe_rsc_trace(rsc, fmt, args...)
char * crm_concat(const char *prefix, const char *suffix, char join)
void print_resource(int log_level, const char *pre_text, resource_t *rsc, gboolean details)
gboolean group_unpack(resource_t *rsc, pe_working_set_t *data_set)