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)) {
117 int n_inactive,
bool show_inactive,
const char *desc)
119 GString *attrs = NULL;
121 if (n_inactive > 0 && !show_inactive) {
122 attrs = g_string_sized_new(64);
123 g_string_append_printf(attrs,
"%d member%s inactive", n_inactive,
141 (
const char *) attrs->str, desc ?
" (" :
"",
142 desc ? desc :
"", desc ?
")" :
"");
143 g_string_free(attrs, TRUE);
147 desc ?
" (" :
"", desc ? desc :
"",
154 GList *only_rsc, uint32_t show_opts)
156 bool star_list = pcmk__list_of_1(only_rsc) &&
158 bool child_filtered = child->
fns->
is_filtered(child, only_rsc, FALSE);
159 bool child_active = child->
fns->
active(child, FALSE);
165 if (!star_list && !child_filtered) {
168 }
else if (!child_filtered && (child_active || show_inactive)) {
171 }
else if (parent_passes && (child_active || show_inactive)) {
182 xmlNode *xml_obj = rsc->
xml;
183 xmlNode *xml_native_rsc = NULL;
185 const char *clone_id = NULL;
190 group_data->last_child = NULL;
200 for (xml_native_rsc = pcmk__xe_first_child(xml_obj); xml_native_rsc != NULL;
201 xml_native_rsc = pcmk__xe_next(xml_native_rsc)) {
203 if (pcmk__str_eq((
const char *)xml_native_rsc->name,
214 group_data->last_child = new_rsc;
229 "any members", rsc->
id);
237 gboolean c_all = TRUE;
238 gboolean c_any = FALSE;
241 for (; gIter != NULL; gIter = gIter->next) {
244 if (child_rsc->
fns->
active(child_rsc, all)) {
251 if (c_any == FALSE) {
253 }
else if (all && c_all == FALSE) {
264 group_print_xml(
pe_resource_t *rsc,
const char *pre_text,
long options,
274 for (; gIter != NULL; gIter = gIter->next) {
277 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
292 char *child_text = NULL;
295 if (pre_text == NULL) {
300 group_print_xml(rsc, pre_text, options, print_data);
306 status_print(
"%sResource Group: %s", pre_text ? pre_text :
"", rsc->
id);
319 for (; gIter != NULL; gIter = gIter->next) {
325 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
342 uint32_t show_opts = va_arg(args, uint32_t);
344 GList *only_node = va_arg(args, GList *);
345 GList *only_rsc = va_arg(args, GList *);
347 const char *desc = NULL;
361 for (; gIter != NULL; gIter = gIter->next) {
364 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
369 char *count = pcmk__itoa(g_list_length(gIter));
376 "number_resources", count,
377 "maintenance", maint_s,
378 "managed", managed_s,
379 "disabled", disabled_s,
380 "description", desc);
385 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts, child_rsc,
386 only_node, only_rsc);
400 uint32_t show_opts = va_arg(args, uint32_t);
402 GList *only_node = va_arg(args, GList *);
403 GList *only_rsc = va_arg(args, GList *);
405 const char *desc = NULL;
411 gboolean active = rsc->
fns->
active(rsc, TRUE);
412 gboolean partially_active = rsc->
fns->
active(rsc, FALSE);
424 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
433 for (GList *gIter = rsc->
children; gIter; gIter = gIter->next) {
436 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
440 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
442 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts,
443 child_rsc, only_node, only_rsc);
459 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
464 child_rsc->
fns->
free(child_rsc);
479 for (; gIter != NULL; gIter = gIter->next) {
483 if (role > group_role) {
494 gboolean check_parent)
496 gboolean passes = FALSE;
508 for (
const GList *iter = rsc->
children;
509 iter != NULL; iter = iter->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)
bool pe__resource_is_disabled(const pe_resource_t *rsc)
const pe_resource_t * pe__const_top_resource(const pe_resource_t *rsc, bool include_bundle)
void pcmk__add_separated_word(GString **list, size_t init_size, const char *word, const char *separator)
const char * pe__resource_description(const pe_resource_t *rsc, uint32_t show_opts)
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)
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
gboolean(* is_filtered)(const pe_resource_t *, GList *, gboolean)
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
pe_resource_t * pe__last_group_member(const pe_resource_t *group)
#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)
const char * rsc_printable_id(const pe_resource_t *rsc)
#define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...)
Cluster status and scheduling.
#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_maintenance
#define pe_rsc_trace(rsc, fmt, args...)
void group_free(pe_resource_t *rsc)
gboolean pe__group_is_filtered(const pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
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)