16 #define VARIANT_GROUP 1
22 xmlNode *xml_obj = rsc->
xml;
23 xmlNode *xml_native_rsc = NULL;
24 group_variant_data_t *group_data = NULL;
26 const char *group_colocated = g_hash_table_lookup(rsc->
meta,
"collocated");
27 const char *clone_id = NULL;
31 group_data = calloc(1,
sizeof(group_variant_data_t));
32 group_data->num_children = 0;
33 group_data->first_child = NULL;
34 group_data->last_child = NULL;
37 group_data->ordered = TRUE;
38 group_data->colocated = TRUE;
40 if (group_ordered != NULL) {
43 if (group_colocated != NULL) {
49 for (xml_native_rsc = __xml_first_child(xml_obj); xml_native_rsc != NULL;
50 xml_native_rsc = __xml_next_element(xml_native_rsc)) {
55 if (
common_unpack(xml_native_rsc, &new_rsc, rsc, data_set) == FALSE) {
57 if (new_rsc != NULL && new_rsc->
fns != NULL) {
62 group_data->num_children++;
65 if (group_data->first_child == NULL) {
66 group_data->first_child = new_rsc;
68 group_data->last_child = new_rsc;
73 if (group_data->num_children == 0) {
84 pe_rsc_trace(rsc,
"Added %d children to resource %s...", group_data->num_children, rsc->
id);
92 gboolean c_all = TRUE;
93 gboolean c_any = FALSE;
96 for (; gIter != NULL; gIter = gIter->next) {
99 if (child_rsc->
fns->
active(child_rsc, all)) {
106 if (c_any == FALSE) {
108 }
else if (all && c_all == FALSE) {
115 group_print_xml(
resource_t * rsc,
const char *pre_text,
long options,
void *print_data)
118 char *child_text = crm_concat(pre_text,
" ",
' ');
124 for (; gIter != NULL; gIter = gIter->next) {
127 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
137 char *child_text = NULL;
140 if (pre_text == NULL) {
145 group_print_xml(rsc, pre_text, options, print_data);
149 child_text = crm_concat(pre_text,
" ",
' ');
151 status_print(
"%sResource Group: %s", pre_text ? pre_text :
"", rsc->
id);
164 for (; gIter != NULL; gIter = gIter->next) {
167 if (options & pe_print_html) {
170 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
171 if (options & pe_print_html) {
177 if (options & pe_print_html) {
195 child_rsc->
fns->
free(child_rsc);
210 for (; gIter != NULL; gIter = gIter->next) {
214 if (role > group_role) {
#define CRM_CHECK(expr, failure_action)
void group_free(resource_t *rsc)
enum rsc_role_e(* state)(const pe_resource_t *, gboolean)
#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 common_free(resource_t *rsc)
resource_object_functions_t * fns
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
#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)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define XML_CIB_TAG_RESOURCE
#define XML_RSC_ATTR_ORDERED
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)
void(* print)(pe_resource_t *, const char *, long, void *)
#define crm_config_warn(fmt...)
int crm_str_to_boolean(const char *s, int *ret)
Cluster status and scheduling.
gboolean group_active(resource_t *rsc, gboolean all)
void(* free)(pe_resource_t *)
#define pe_rsc_trace(rsc, fmt, args...)
gboolean(* active)(pe_resource_t *, gboolean)
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)