23 typedef struct group_variant_data_s {
64 return pcmk_all_flags_set(group_data->flags,
flags);
77 set_group_flag(
pcmk_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 gboolean parent_passes, 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;
201 for (xml_native_rsc = pcmk__xe_first_child(xml_obj); xml_native_rsc != NULL;
202 xml_native_rsc = pcmk__xe_next(xml_native_rsc)) {
204 if (pcmk__str_eq((
const char *)xml_native_rsc->name,
215 group_data->last_child = new_rsc;
230 "any members", rsc->
id);
238 gboolean c_all = TRUE;
239 gboolean c_any = FALSE;
242 for (; gIter != NULL; gIter = gIter->next) {
245 if (child_rsc->
fns->
active(child_rsc, all)) {
252 if (c_any == FALSE) {
254 }
else if (all && c_all == FALSE) {
265 group_print_xml(
pcmk_resource_t *rsc,
const char *pre_text,
long options,
275 for (; gIter != NULL; gIter = gIter->next) {
278 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
293 char *child_text = NULL;
296 if (pre_text == NULL) {
301 group_print_xml(rsc, pre_text, options, print_data);
307 status_print(
"%sResource Group: %s", pre_text ? pre_text :
"", rsc->
id);
320 for (; gIter != NULL; gIter = gIter->next) {
326 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
344 uint32_t show_opts = va_arg(args, uint32_t);
346 GList *only_node = va_arg(args, GList *);
347 GList *only_rsc = va_arg(args, GList *);
349 const char *desc = NULL;
363 for (; gIter != NULL; gIter = gIter->next) {
366 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
371 char *count = pcmk__itoa(g_list_length(gIter));
378 "number_resources", count,
379 "maintenance", maint_s,
380 "managed", managed_s,
381 "disabled", disabled_s,
382 "description", desc);
387 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts, child_rsc,
388 only_node, only_rsc);
403 uint32_t show_opts = va_arg(args, uint32_t);
405 GList *only_node = va_arg(args, GList *);
406 GList *only_rsc = va_arg(args, GList *);
408 const char *desc = NULL;
414 gboolean active = rsc->
fns->
active(rsc, TRUE);
415 gboolean partially_active = rsc->
fns->
active(rsc, FALSE);
427 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
436 for (GList *gIter = rsc->
children; gIter; gIter = gIter->next) {
439 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
443 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
445 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts,
446 child_rsc, only_node, only_rsc);
462 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
467 child_rsc->
fns->
free(child_rsc);
482 for (; gIter != NULL; gIter = gIter->next) {
486 if (role > group_role) {
497 gboolean check_parent)
499 gboolean passes = FALSE;
511 for (
const GList *iter = rsc->
children;
512 iter != NULL; iter = iter->next) {
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
#define CRM_CHECK(expr, failure_action)
Control output from tools.
bool pe__group_flag_is_set(const pcmk_resource_t *group, uint32_t flags)
#define pcmk__config_warn(fmt...)
GList * children
Resource's child resources, if any.
gboolean group_unpack(pcmk_resource_t *rsc, pcmk_scheduler_t *scheduler)
xmlNode * xml
Resource configuration (possibly expanded from template)
enum rsc_role_e(* state)(const pcmk_resource_t *rsc, gboolean current)
Get resource's current or assigned role.
#define XML_RSC_ATTR_INCARNATION
int pe__group_default(pcmk__output_t *out, va_list args)
void group_free(pcmk_resource_t *rsc)
const char * pe__resource_description(const pcmk_resource_t *rsc, uint32_t show_opts)
GHashTable * meta
Resource's meta-attributes.
Whether resource, its node, or entire cluster is in maintenance mode.
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)
const char * rsc_printable_id(const pcmk_resource_t *rsc)
void(* print)(pcmk_resource_t *rsc, const char *pre_text, long options, void *print_data)
Implementation of pcmk_scheduler_t.
int pe__unpack_resource(xmlNode *xml_obj, pcmk_resource_t **rsc, pcmk_resource_t *parent, pcmk_scheduler_t *scheduler)
unsigned int pe__group_max_per_node(const pcmk_resource_t *rsc)
gboolean group_active(pcmk_resource_t *rsc, gboolean all)
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
const char * role2text(enum rsc_role_e role)
void common_free(pcmk_resource_t *rsc)
void(* free)(pcmk_resource_t *rsc)
Free all memory used by a resource.
int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int options)
Implementation of pcmk_resource_t.
PCMK__OUTPUT_ARGS("group", "uint32_t", "pcmk_resource_t *", "GList *", "GList *")
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define XML_CIB_TAG_RESOURCE
void group_print(pcmk_resource_t *rsc, const char *pre_text, long options, void *print_data)
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.
unsigned long long flags
Group of enum pcmk_rsc_flags.
#define XML_RSC_ATTR_ORDERED
enum pe_obj_types variant
Resource variant.
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
#define PCMK__OUTPUT_LIST_FOOTER(out_obj, retcode)
int crm_str_to_boolean(const char *s, int *ret)
gboolean(* active)(pcmk_resource_t *rsc, gboolean all)
Check whether a resource is active.
#define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...)
pcmk_resource_t * pe__last_group_member(const pcmk_resource_t *group)
Cluster status and scheduling.
pcmk_rsc_methods_t * fns
Resource object methods.
void * variant_opaque
Variant-specific (and private) data.
pcmk_scheduler_t * scheduler
#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.
bool pe__resource_is_disabled(const pcmk_resource_t *rsc)
#define pcmk__plural_s(i)
gboolean(* is_filtered)(const pcmk_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Check whether a given resource is in a list of resources.
struct group_variant_data_s group_variant_data_t
Resource role is unknown.
#define pe_rsc_trace(rsc, fmt, args...)
Whether resource is managed.
enum rsc_role_e group_resource_state(const pcmk_resource_t *rsc, gboolean current)
gboolean pe__group_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc, gboolean check_parent)
char * id
Resource ID in configuration.
gboolean pcmk__str_in_list(const gchar *s, const GList *lst, uint32_t flags)