21 #define VARIANT_GROUP 1 29 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
32 if (!child_rsc->
fns->
active(child_rsc, TRUE)) {
46 if (n_inactive > 0 && !show_inactive) {
71 GList *only_rsc,
unsigned int show_opts)
73 bool star_list = pcmk__list_of_1(only_rsc) &&
75 bool child_filtered = child->
fns->
is_filtered(child, only_rsc, FALSE);
76 bool child_active = child->
fns->
active(child, FALSE);
82 if (!star_list && !child_filtered) {
85 }
else if (!child_filtered && (child_active || show_inactive)) {
88 }
else if (parent_passes && (child_active || show_inactive)) {
99 xmlNode *xml_obj = rsc->
xml;
100 xmlNode *xml_native_rsc = NULL;
101 group_variant_data_t *group_data = NULL;
103 const char *group_colocated = g_hash_table_lookup(rsc->
meta,
"collocated");
104 const char *clone_id = NULL;
108 group_data = calloc(1,
sizeof(group_variant_data_t));
109 group_data->num_children = 0;
110 group_data->first_child = NULL;
111 group_data->last_child = NULL;
115 if ((group_ordered == NULL)
117 group_data->ordered = TRUE;
119 if ((group_colocated == NULL)
121 group_data->colocated = TRUE;
126 for (xml_native_rsc = pcmk__xe_first_child(xml_obj); xml_native_rsc != NULL;
127 xml_native_rsc = pcmk__xe_next(xml_native_rsc)) {
129 if (pcmk__str_eq((
const char *)xml_native_rsc->name,
134 if (
common_unpack(xml_native_rsc, &new_rsc, rsc, data_set) == FALSE) {
136 if (new_rsc != NULL && new_rsc->
fns != NULL) {
142 group_data->num_children++;
145 if (group_data->first_child == NULL) {
146 group_data->first_child = new_rsc;
148 group_data->last_child = new_rsc;
153 if (group_data->num_children == 0) {
158 pe_rsc_trace(rsc,
"Added %d children to resource %s...", group_data->num_children, rsc->
id);
166 gboolean c_all = TRUE;
167 gboolean c_any = FALSE;
170 for (; gIter != NULL; gIter = gIter->next) {
173 if (child_rsc->
fns->
active(child_rsc, all)) {
180 if (c_any == FALSE) {
182 }
else if (all && c_all == FALSE) {
189 group_print_xml(
pe_resource_t * rsc,
const char *pre_text,
long options,
void *print_data)
198 for (; gIter != NULL; gIter = gIter->next) {
201 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
211 char *child_text = NULL;
214 if (pre_text == NULL) {
219 group_print_xml(rsc, pre_text, options, print_data);
225 status_print(
"%sResource Group: %s", pre_text ? pre_text :
"", rsc->
id);
238 for (; gIter != NULL; gIter = gIter->next) {
244 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
257 PCMK__OUTPUT_ARGS(
"group",
"unsigned int",
"pe_resource_t *",
"GList *",
"GList *")
261 unsigned int show_opts = va_arg(args,
unsigned int);
263 GList *only_node = va_arg(args, GList *);
264 GList *only_rsc = va_arg(args, GList *);
267 char *count = pcmk__itoa(g_list_length(gIter));
279 for (; gIter != NULL; gIter = gIter->next) {
282 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
289 ,
"number_resources", count
296 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts, child_rsc,
297 only_node, only_rsc);
307 PCMK__OUTPUT_ARGS(
"group",
"unsigned int",
"pe_resource_t *",
"GList *",
"GList *")
311 unsigned int show_opts = va_arg(args,
unsigned int);
313 GList *only_node = va_arg(args, GList *);
314 GList *only_rsc = va_arg(args, GList *);
321 gboolean active = rsc->
fns->
active(rsc, TRUE);
322 gboolean partially_active = rsc->
fns->
active(rsc, FALSE);
332 group_header(out, &
rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
341 for (GList *gIter = rsc->
children; gIter; gIter = gIter->next) {
344 if (skip_child_rsc(rsc, child_rsc, parent_passes, only_rsc, show_opts)) {
348 group_header(out, &
rc, rsc, !active && partially_active ? inactive_resources(rsc) : 0,
350 out->message(out, crm_map_element_name(child_rsc->
xml), show_opts,
351 child_rsc, only_node, only_rsc);
367 for (GList *gIter = rsc->
children; gIter != NULL; gIter = gIter->next) {
372 child_rsc->
fns->
free(child_rsc);
387 for (; gIter != NULL; gIter = gIter->next) {
391 if (role > group_role) {
403 gboolean passes = FALSE;
412 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
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)