19 #define VARIANT_GROUP 1
25 xmlNode *xml_obj = rsc->
xml;
26 xmlNode *xml_native_rsc = NULL;
27 group_variant_data_t *group_data = NULL;
29 const char *group_colocated = g_hash_table_lookup(rsc->
meta,
"collocated");
30 const char *clone_id = NULL;
34 group_data = calloc(1,
sizeof(group_variant_data_t));
35 group_data->num_children = 0;
36 group_data->first_child = NULL;
37 group_data->last_child = NULL;
41 if ((group_ordered == NULL)
43 group_data->ordered = TRUE;
45 if ((group_colocated == NULL)
47 group_data->colocated = TRUE;
52 for (xml_native_rsc = pcmk__xe_first_child(xml_obj); xml_native_rsc != NULL;
53 xml_native_rsc = pcmk__xe_next(xml_native_rsc)) {
55 if (pcmk__str_eq((
const char *)xml_native_rsc->name,
60 if (
common_unpack(xml_native_rsc, &new_rsc, rsc, data_set) == FALSE) {
62 if (new_rsc != NULL && new_rsc->
fns != NULL) {
68 group_data->num_children++;
71 if (group_data->first_child == NULL) {
72 group_data->first_child = new_rsc;
74 group_data->last_child = new_rsc;
79 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(
pe_resource_t * rsc,
const char *pre_text,
long options,
void *print_data)
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);
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) {
183 PCMK__OUTPUT_ARGS(
"group",
"unsigned int",
"pe_resource_t *",
"GList *",
"GList *")
187 unsigned int options = va_arg(args,
unsigned int);
189 GList *only_node = va_arg(args, GList *);
190 GList *only_rsc = va_arg(args, GList *);
193 char *count = pcmk__itoa(g_list_length(gIter));
196 gboolean print_everything = TRUE;
206 for (; gIter != NULL; gIter = gIter->next) {
209 if (child_rsc->
fns->
is_filtered(child_rsc, only_rsc, print_everything)) {
216 ,
"number_resources", count
223 out->message(out, crm_map_element_name(child_rsc->
xml), options, child_rsc,
224 only_node, only_rsc);
234 PCMK__OUTPUT_ARGS(
"group",
"unsigned int",
"pe_resource_t *",
"GList *",
"GList *")
238 unsigned int options = va_arg(args,
unsigned int);
240 GList *only_node = va_arg(args, GList *);
241 GList *only_rsc = va_arg(args, GList *);
244 gboolean print_everything = TRUE;
257 out->begin_list(out, NULL, NULL,
"Resource Group: %s%s%s", rsc->
id,
268 for (GList *gIter = rsc->
children; gIter; gIter = gIter->next) {
271 if (child_rsc->
fns->
is_filtered(child_rsc, only_rsc, print_everything)) {
279 out->message(out, crm_map_element_name(child_rsc->
xml), options,
280 child_rsc, only_node, only_rsc);
289 PCMK__OUTPUT_ARGS(
"group",
"unsigned int",
"pe_resource_t *",
"GList *",
"GList *")
293 unsigned int options = va_arg(args,
unsigned int);
295 GList *only_node = va_arg(args, GList *);
296 GList *only_rsc = va_arg(args, GList *);
299 gboolean print_everything = TRUE;
312 out->begin_list(out, NULL, NULL,
"Resource Group: %s%s%s", rsc->
id,
323 for (GList *gIter = rsc->
children; gIter; gIter = gIter->next) {
326 if (child_rsc->
fns->
is_filtered(child_rsc, only_rsc, print_everything)) {
334 out->message(out, crm_map_element_name(child_rsc->
xml), options,
335 child_rsc, only_node, only_rsc);
351 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
356 child_rsc->
fns->
free(child_rsc);
371 for (; gIter != NULL; gIter = gIter->next) {
375 if (role > group_role) {
387 gboolean passes = FALSE;
396 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
#define CRM_CHECK(expr, failure_action)
void group_free(pe_resource_t *rsc)
void group_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
enum rsc_role_e(* state)(const pe_resource_t *, gboolean)
int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, long options, gboolean print_all)
#define pcmk__config_warn(fmt...)
gboolean pcmk__str_in_list(GList *lst, const gchar *s)
#define XML_RSC_ATTR_INCARNATION
gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
gboolean group_active(pe_resource_t *rsc, gboolean all)
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.
void print_rscs_brief(GList *rsc_list, const char *pre_text, long options, void *print_data, gboolean print_all)
int pe__group_text(pcmk__output_t *out, va_list args)
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
enum rsc_role_e group_resource_state(const pe_resource_t *rsc, gboolean current)
const char * role2text(enum rsc_role_e role)
pe_resource_t * uber_parent(pe_resource_t *rsc)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define XML_CIB_TAG_RESOURCE
#define PCMK__OUTPUT_ARGS(ARGS...)
int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name, size_t pairs_count,...)
int pe__group_html(pcmk__output_t *out, va_list args)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
void common_free(pe_resource_t *rsc)
#define XML_RSC_ATTR_ORDERED
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
void(* print)(pe_resource_t *, const char *, long, void *)
#define PCMK__OUTPUT_LIST_FOOTER(out_obj, retcode)
int crm_str_to_boolean(const char *s, int *ret)
gboolean(* is_filtered)(pe_resource_t *, GList *, gboolean)
#define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...)
Cluster status and scheduling.
const char * rsc_printable_id(pe_resource_t *rsc)
#define status_print(fmt, args...)
int pe__group_xml(pcmk__output_t *out, va_list args)
This structure contains everything that makes up a single output formatter.
void(* free)(pe_resource_t *)
rsc_role_e
Possible roles that a resource can be in.
gboolean common_unpack(xmlNode *xml_obj, pe_resource_t **rsc, pe_resource_t *parent, pe_working_set_t *data_set)
#define pe_rsc_trace(rsc, fmt, args...)
gboolean(* active)(pe_resource_t *, gboolean)
bool pe__resource_is_disabled(pe_resource_t *rsc)
gboolean group_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)