19 #define VARIANT_GROUP 1 25 xmlNode *xml_obj = rsc->
xml;
26 xmlNode *xml_native_rsc = NULL;
27 group_variant_data_t *group_data = NULL;
29 const char *group_colocated = g_hash_table_lookup(rsc->
meta,
"collocated");
30 const char *clone_id = NULL;
34 group_data = calloc(1,
sizeof(group_variant_data_t));
35 group_data->num_children = 0;
36 group_data->first_child = NULL;
37 group_data->last_child = NULL;
41 if ((group_ordered == NULL)
43 group_data->ordered = TRUE;
45 if ((group_colocated == NULL)
47 group_data->colocated = TRUE;
52 for (xml_native_rsc = pcmk__xe_first_child(xml_obj); xml_native_rsc != NULL;
53 xml_native_rsc = pcmk__xe_next(xml_native_rsc)) {
55 if (pcmk__str_eq((
const char *)xml_native_rsc->name,
60 if (
common_unpack(xml_native_rsc, &new_rsc, rsc, data_set) == FALSE) {
62 if (new_rsc != NULL && new_rsc->
fns != NULL) {
68 group_data->num_children++;
71 if (group_data->first_child == NULL) {
72 group_data->first_child = new_rsc;
74 group_data->last_child = new_rsc;
79 if (group_data->num_children == 0) {
84 pe_rsc_trace(rsc,
"Added %d children to resource %s...", group_data->num_children, rsc->
id);
92 gboolean c_all = TRUE;
93 gboolean c_any = FALSE;
96 for (; gIter != NULL; gIter = gIter->next) {
99 if (child_rsc->
fns->
active(child_rsc, all)) {
106 if (c_any == FALSE) {
108 }
else if (all && c_all == FALSE) {
115 group_print_xml(
pe_resource_t * rsc,
const char *pre_text,
long options,
void *print_data)
124 for (; gIter != NULL; gIter = gIter->next) {
127 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
137 char *child_text = NULL;
140 if (pre_text == NULL) {
145 group_print_xml(rsc, pre_text, options, print_data);
151 status_print(
"%sResource Group: %s", pre_text ? pre_text :
"", rsc->
id);
164 for (; gIter != NULL; gIter = gIter->next) {
170 child_rsc->
fns->
print(child_rsc, child_text, options, print_data);
183 PCMK__OUTPUT_ARGS(
"group",
"unsigned int",
"pe_resource_t *",
"GListPtr",
"GListPtr")
187 unsigned int options = va_arg(args,
unsigned int);
193 char *count = crm_itoa(g_list_length(gIter));
196 gboolean print_everything = TRUE;
206 for (; gIter != NULL; gIter = gIter->next) {
209 if (child_rsc->
fns->
is_filtered(child_rsc, only_rsc, print_everything)) {
216 ,
"number_resources", count
223 out->message(out, crm_map_element_name(child_rsc->
xml), options, child_rsc,
224 only_node, only_rsc);
234 PCMK__OUTPUT_ARGS(
"group",
"unsigned int",
"pe_resource_t *",
"GListPtr",
"GListPtr")
238 unsigned int options = va_arg(args,
unsigned int);
244 gboolean print_everything = TRUE;
257 out->begin_list(out, NULL, NULL,
"Resource Group: %s%s%s", rsc->
id,
271 if (child_rsc->
fns->
is_filtered(child_rsc, only_rsc, print_everything)) {
279 out->message(out, crm_map_element_name(child_rsc->
xml), options,
280 child_rsc, only_node, only_rsc);
289 PCMK__OUTPUT_ARGS(
"group",
"unsigned int",
"pe_resource_t *",
"GListPtr",
"GListPtr")
293 unsigned int options = va_arg(args,
unsigned int);
299 gboolean print_everything = TRUE;
312 out->begin_list(out, NULL, NULL,
"Resource Group: %s%s%s", rsc->
id,
326 if (child_rsc->
fns->
is_filtered(child_rsc, only_rsc, print_everything)) {
334 out->message(out, crm_map_element_name(child_rsc->
xml), options,
335 child_rsc, only_node, only_rsc);
356 child_rsc->
fns->
free(child_rsc);
371 for (; gIter != NULL; gIter = gIter->next) {
375 if (role > group_role) {
387 gboolean passes = FALSE;
#define CRM_CHECK(expr, failure_action)
int pe__group_xml(pcmk__output_t *out, va_list args)
gboolean pcmk__str_in_list(GList *lst, const gchar *s)
#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.
gboolean(* is_filtered)(pe_resource_t *, GListPtr, gboolean)
void print_rscs_brief(GListPtr rsc_list, const char *pre_text, long options, void *print_data, gboolean print_all)
const char * role2text(enum rsc_role_e role)
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 pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
void common_free(pe_resource_t *rsc)
#define XML_RSC_ATTR_ORDERED
void(* print)(pe_resource_t *, const char *, long, void *)
void(* free)(pe_resource_t *)
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
#define PCMK__OUTPUT_LIST_FOOTER(out_obj, retcode)
int pe__group_html(pcmk__output_t *out, va_list args)
gboolean pe__group_is_filtered(pe_resource_t *rsc, GListPtr only_rsc, gboolean check_parent)
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.
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)
int pe__group_text(pcmk__output_t *out, va_list args)
This structure contains everything that makes up a single output formatter.
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)
int pe__rscs_brief_output(pcmk__output_t *out, GListPtr rsc_list, long options, gboolean print_all)
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
void group_free(pe_resource_t *rsc)
#define pcmk__config_warn(fmt...)
gboolean group_active(pe_resource_t *rsc, gboolean all)
gboolean(* active)(pe_resource_t *, gboolean)
GListPtr pe__filter_rsc_list(GListPtr rscs, GListPtr filter)