23 typedef struct group_variant_data_s {
64 return pcmk_all_flags_set(group_data->flags,
flags);
77 set_group_flag(
pe_resource_t *group,
const char *option, uint32_t flag,
80 const char *value_s = NULL;
83 value_s = g_hash_table_lookup(group->
meta, option);
93 "Support for the '%s' group meta-attribute is deprecated " 94 "and will be removed in a future release " 95 "(use a resource set instead)", option);
104 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
107 if (!child_rsc->
fns->
active(child_rsc, TRUE)) {
118 GString *attrs = NULL;
120 if (n_inactive > 0 && !show_inactive) {
121 attrs = g_string_sized_new(64);
122 g_string_append_printf(attrs,
"%d member%s inactive", n_inactive,
136 rsc->
id, (
const char *) attrs->str);
137 g_string_free(attrs, TRUE);
145 GList *only_rsc, uint32_t show_opts)
147 bool star_list = pcmk__list_of_1(only_rsc) &&
149 bool child_filtered = child->
fns->
is_filtered(child, only_rsc, FALSE);
150 bool child_active = child->
fns->
active(child, FALSE);
156 if (!star_list && !child_filtered) {
159 }
else if (!child_filtered && (child_active || show_inactive)) {
162 }
else if (parent_passes && (child_active || show_inactive)) {
173 xmlNode *xml_obj = rsc->
xml;
174 xmlNode *xml_native_rsc = NULL;
176 const char *clone_id = NULL;
181 group_data->last_child = NULL;
191 for (xml_native_rsc = pcmk__xe_first_child(xml_obj); xml_native_rsc != NULL;
192 xml_native_rsc = pcmk__xe_next(xml_native_rsc)) {
194 if (pcmk__str_eq((
const char *)xml_native_rsc->name,
205 group_data->last_child = new_rsc;
220 "any members", rsc->
id);
228 gboolean c_all = TRUE;
229 gboolean c_any = FALSE;
232 for (; gIter != NULL; gIter = gIter->next) {
235 if (child_rsc->
fns->
active(child_rsc, all)) {
242 if (c_any == FALSE) {
244 }
else if (all && c_all == FALSE) {
255 group_print_xml(
pe_resource_t *rsc,
const char *pre_text,
long options,
265 for (; gIter != NULL; gIter = gIter->next) {
268 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
283 char *child_text = NULL;
286 if (pre_text == NULL) {
291 group_print_xml(rsc, pre_text, options, print_data);
297 status_print(
"%sResource Group: %s", pre_text ? pre_text :
"", rsc->
id);
310 for (; gIter != NULL; gIter = gIter->next) {
316 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
333 uint32_t show_opts = va_arg(args, uint32_t);
335 GList *only_node = va_arg(args, GList *);
336 GList *only_rsc = va_arg(args, GList *);
339 char *count = pcmk__itoa(g_list_length(gIter));
351 for (; gIter != NULL; gIter = gIter->next) {
354 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
361 ,
"number_resources", count
368 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts, child_rsc,
369 only_node, only_rsc);
383 uint32_t show_opts = va_arg(args, uint32_t);
385 GList *only_node = va_arg(args, GList *);
386 GList *only_rsc = va_arg(args, GList *);
393 gboolean active = rsc->
fns->
active(rsc, TRUE);
394 gboolean partially_active = rsc->
fns->
active(rsc, FALSE);
404 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
413 for (GList *gIter = rsc->
children; gIter; gIter = gIter->next) {
416 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
420 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
422 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts,
423 child_rsc, only_node, only_rsc);
439 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
444 child_rsc->
fns->
free(child_rsc);
459 for (; gIter != NULL; gIter = gIter->next) {
463 if (role > group_role) {
475 gboolean passes = FALSE;
484 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
#define CRM_CHECK(expr, failure_action)
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)
void pcmk__add_separated_word(GString **list, size_t init_size, const char *word, const char *separator)
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
const char * role2text(enum rsc_role_e role)
bool pe__group_flag_is_set(const pe_resource_t *group, uint32_t flags)
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,...)
#define pe_warn_once(pe_wo_bit, fmt...)
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
void(* print)(pe_resource_t *, const char *, long, void *)
void(* free)(pe_resource_t *)
enum pe_obj_types variant
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
pe_resource_t * pe__last_group_member(const pe_resource_t *group)
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.
struct group_variant_data_s group_variant_data_t
#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)
int pe__unpack_resource(xmlNode *xml_obj, pe_resource_t **rsc, pe_resource_t *parent, pe_working_set_t *data_set)
gboolean(* active)(pe_resource_t *, gboolean)
gboolean pcmk__str_in_list(const gchar *s, const GList *lst, uint32_t flags)