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 " 94 "deprecated 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;
202 xml_native_rsc != NULL;
203 xml_native_rsc = pcmk__xe_next(xml_native_rsc)) {
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));
372 const char *maintenance = pcmk__flag_text(rsc->
flags,
389 out->message(out, (
const char *) child_rsc->
xml->name, show_opts,
390 child_rsc, only_node, only_rsc);
405 uint32_t show_opts = va_arg(args, uint32_t);
407 GList *only_node = va_arg(args, GList *);
408 GList *only_rsc = va_arg(args, GList *);
410 const char *desc = NULL;
416 gboolean active = rsc->
fns->
active(rsc, TRUE);
417 gboolean partially_active = rsc->
fns->
active(rsc, FALSE);
429 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
438 for (GList *gIter = rsc->
children; gIter; gIter = gIter->next) {
441 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
445 group_header(out, &rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
447 out->message(out, (
const char *) child_rsc->
xml->name, show_opts,
448 child_rsc, only_node, only_rsc);
464 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
469 child_rsc->
fns->
free(child_rsc);
484 for (; gIter != NULL; gIter = gIter->next) {
488 if (role > group_role) {
499 gboolean check_parent)
501 gboolean passes = FALSE;
513 for (
const GList *iter = rsc->
children;
514 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)
const char * pcmk_role_text(enum rsc_role_e role)
Get readable description of a resource role.
Control output from tools.
#define PCMK_XE_PRIMITIVE
bool pe__group_flag_is_set(const pcmk_resource_t *group, uint32_t flags)
#define pcmk__config_warn(fmt...)
#define pcmk__rsc_trace(rsc, fmt, args...)
gboolean group_unpack(pcmk_resource_t *rsc, pcmk_scheduler_t *scheduler)
enum rsc_role_e(* state)(const pcmk_resource_t *rsc, gboolean current)
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)
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)
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)
void common_free(pcmk_resource_t *rsc)
void(* free)(pcmk_resource_t *rsc)
int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int options)
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.
int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name,...) G_GNUC_NULL_TERMINATED
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
void group_print(pcmk_resource_t *rsc, const char *pre_text, long options, void *print_data)
#define PCMK_XA_DESCRIPTION
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.
#define PCMK_XA_NUMBER_RESOURCES
Wrappers for and extensions to libxml2.
#define pcmk__warn_once(wo_flag, fmt...)
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
#define PCMK_XA_MAINTENANCE
#define pcmk__assert(expr)
#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)
#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_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)
struct group_variant_data_s group_variant_data_t
Resource role is unknown.
#define PCMK_META_ORDERED
#define pcmk__assert_alloc(nmemb, size)
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)
gboolean pcmk__str_in_list(const gchar *s, const GList *lst, uint32_t flags)