23 #define VARIANT_GROUP 1 31 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
34 if (!child_rsc->
fns->
active(child_rsc, TRUE)) {
48 if (n_inactive > 0 && !show_inactive) {
73 GList *only_rsc, uint32_t show_opts)
75 bool star_list = pcmk__list_of_1(only_rsc) &&
77 bool child_filtered = child->
fns->
is_filtered(child, only_rsc, FALSE);
78 bool child_active = child->
fns->
active(child, FALSE);
84 if (!star_list && !child_filtered) {
87 }
else if (!child_filtered && (child_active || show_inactive)) {
90 }
else if (parent_passes && (child_active || show_inactive)) {
101 xmlNode *xml_obj = rsc->
xml;
102 xmlNode *xml_native_rsc = NULL;
103 group_variant_data_t *group_data = NULL;
105 const char *group_colocated = g_hash_table_lookup(rsc->
meta,
"collocated");
106 const char *clone_id = NULL;
110 group_data = calloc(1,
sizeof(group_variant_data_t));
111 group_data->num_children = 0;
112 group_data->first_child = NULL;
113 group_data->last_child = NULL;
117 if ((group_ordered == NULL)
119 group_data->ordered = TRUE;
121 if ((group_colocated == NULL)
123 group_data->colocated = TRUE;
128 for (xml_native_rsc = pcmk__xe_first_child(xml_obj); xml_native_rsc != NULL;
129 xml_native_rsc = pcmk__xe_next(xml_native_rsc)) {
131 if (pcmk__str_eq((
const char *)xml_native_rsc->name,
138 if (new_rsc != NULL && new_rsc->
fns != NULL) {
144 group_data->num_children++;
147 if (group_data->first_child == NULL) {
148 group_data->first_child = new_rsc;
150 group_data->last_child = new_rsc;
155 if (group_data->num_children == 0) {
160 pe_rsc_trace(rsc,
"Added %d children to resource %s...", group_data->num_children, rsc->
id);
168 gboolean c_all = TRUE;
169 gboolean c_any = FALSE;
172 for (; gIter != NULL; gIter = gIter->next) {
175 if (child_rsc->
fns->
active(child_rsc, all)) {
182 if (c_any == FALSE) {
184 }
else if (all && c_all == FALSE) {
191 group_print_xml(
pe_resource_t * rsc,
const char *pre_text,
long options,
void *print_data)
200 for (; gIter != NULL; gIter = gIter->next) {
203 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
213 char *child_text = NULL;
216 if (pre_text == NULL) {
221 group_print_xml(rsc, pre_text, options, print_data);
227 status_print(
"%sResource Group: %s", pre_text ? pre_text :
"", rsc->
id);
240 for (; gIter != NULL; gIter = gIter->next) {
246 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
263 uint32_t show_opts = va_arg(args, uint32_t);
265 GList *only_node = va_arg(args, GList *);
266 GList *only_rsc = va_arg(args, GList *);
269 char *count = pcmk__itoa(g_list_length(gIter));
281 for (; gIter != NULL; gIter = gIter->next) {
284 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
291 ,
"number_resources", count
298 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts, child_rsc,
299 only_node, only_rsc);
313 uint32_t show_opts = va_arg(args, uint32_t);
315 GList *only_node = va_arg(args, GList *);
316 GList *only_rsc = va_arg(args, GList *);
323 gboolean active = rsc->
fns->
active(rsc, TRUE);
324 gboolean partially_active = rsc->
fns->
active(rsc, FALSE);
334 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
343 for (GList *gIter = rsc->
children; gIter; gIter = gIter->next) {
346 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
350 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
352 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts,
353 child_rsc, only_node, only_rsc);
369 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
374 child_rsc->
fns->
free(child_rsc);
389 for (; gIter != NULL; gIter = gIter->next) {
393 if (role > group_role) {
405 gboolean passes = FALSE;
414 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
#define CRM_CHECK(expr, failure_action)
void pcmk__add_separated_word(char **list, size_t *len, const char *word, const char *separator)
int pe__group_xml(pcmk__output_t *out, va_list args)
Control output from tools.
#define pcmk__config_warn(fmt...)
#define XML_RSC_ATTR_INCARNATION
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)
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
const char * role2text(enum rsc_role_e role)
int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int options)
gboolean group_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
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,...)
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)
int pe__group_default(pcmk__output_t *out, va_list args)
#define XML_RSC_ATTR_ORDERED
pe_working_set_t * data_set
gboolean pcmk__str_in_list(const gchar *s, GList *lst, uint32_t flags)
void(* print)(pe_resource_t *, const char *, long, void *)
void(* free)(pe_resource_t *)
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
#define PCMK__OUTPUT_LIST_FOOTER(out_obj, retcode)
enum rsc_role_e(* state)(const pe_resource_t *, gboolean)
int crm_str_to_boolean(const char *s, int *ret)
void group_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
#define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...)
Cluster status and scheduling.
gboolean(* is_filtered)(pe_resource_t *, GList *, gboolean)
const char * rsc_printable_id(pe_resource_t *rsc)
#define status_print(fmt, args...)
enum rsc_role_e group_resource_state(const pe_resource_t *rsc, gboolean current)
This structure contains everything that makes up a single output formatter.
#define pcmk__plural_s(i)
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...)
bool pe__resource_is_disabled(pe_resource_t *rsc)
void group_free(pe_resource_t *rsc)
gboolean group_active(pe_resource_t *rsc, gboolean all)
gboolean(* active)(pe_resource_t *, gboolean)