29 #define VARIANT_CONTAINER 1
35 next_ip(
const char *last_ip)
37 unsigned int oct1 = 0;
38 unsigned int oct2 = 0;
39 unsigned int oct3 = 0;
40 unsigned int oct4 = 0;
41 int rc = sscanf(last_ip,
"%u.%u.%u.%u", &oct1, &oct2, &oct3, &oct4);
47 }
else if (oct3 > 253) {
50 }
else if (oct4 > 253) {
62 allocate_ip(container_variant_data_t *
data, container_grouping_t *tuple,
char *buffer,
int max)
64 if(data->ip_range_start == NULL) {
67 }
else if(data->ip_last) {
68 tuple->ipaddr = next_ip(data->ip_last);
71 tuple->ipaddr = strdup(data->ip_range_start);
74 data->ip_last = tuple->ipaddr;
76 return snprintf(buffer, max,
" --add-host=%s-%d:%s --link %s-docker-%d:%s-link-%d",
77 data->prefix, tuple->offset, tuple->ipaddr,
78 data->prefix, tuple->offset, data->prefix, tuple->offset);
80 if (data->type == PE_CONTAINER_TYPE_DOCKER) {
81 return snprintf(buffer, max,
" --add-host=%s-%d:%s",
82 data->prefix, tuple->offset, tuple->ipaddr);
83 }
else if (data->type == PE_CONTAINER_TYPE_RKT) {
84 return snprintf(buffer, max,
" --hosts-entry=%s=%s-%d",
85 tuple->ipaddr, data->prefix, tuple->offset);
93 create_resource(
const char *name,
const char *provider,
const char *kind)
118 valid_network(container_variant_data_t *data)
120 if(data->ip_range_start) {
123 if(data->control_port) {
124 if(data->replicas_per_host > 1) {
125 pe_err(
"Specifying the 'control-port' for %s requires 'replicas-per-host=1'", data->prefix);
126 data->replicas_per_host = 1;
136 resource_t *parent, container_variant_data_t *data, container_grouping_t *tuple,
139 if(data->ip_range_start) {
141 xmlNode *xml_ip = NULL;
142 xmlNode *xml_obj = NULL;
146 xml_ip = create_resource(
id,
"heartbeat",
"IPaddr2");
150 crm_xml_set_id(xml_obj,
"%s-attributes-%d", data->prefix, tuple->offset);
153 if(data->host_network) {
157 if(data->host_netmask) {
159 "cidr_netmask", data->host_netmask);
171 if (
common_unpack(xml_ip, &tuple->ip, parent, data_set) ==
false) {
181 create_docker_resource(
182 resource_t *parent, container_variant_data_t *data, container_grouping_t *tuple,
185 int offset = 0, max = 4096;
186 char *buffer = calloc(1, max+1);
188 int doffset = 0, dmax = 1024;
189 char *dbuffer = calloc(1, dmax+1);
192 xmlNode *xml_docker = NULL;
193 xmlNode *xml_obj = NULL;
197 xml_docker = create_resource(
id,
"heartbeat",
"docker");
201 crm_xml_set_id(xml_obj,
"%s-attributes-%d", data->prefix, tuple->offset);
208 offset += snprintf(buffer+offset, max-offset,
" --restart=no");
215 if (data->ip_range_start != NULL) {
216 offset += snprintf(buffer+offset, max-offset,
" -h %s-%d",
217 data->prefix, tuple->offset);
220 offset += snprintf(buffer+offset, max-offset,
" -e PCMK_stderr=1");
222 if(data->docker_network) {
224 offset += snprintf(buffer+offset, max-offset,
" --net=%s", data->docker_network);
227 if(data->control_port) {
228 offset += snprintf(buffer+offset, max-offset,
" -e PCMK_remote_port=%s", data->control_port);
230 offset += snprintf(buffer+offset, max-offset,
" -e PCMK_remote_port=%d",
DEFAULT_REMOTE_PORT);
233 for(
GListPtr pIter = data->mounts; pIter != NULL; pIter = pIter->next) {
234 container_mount_t *mount = pIter->data;
238 "%s/%s-%d", mount->source, data->prefix, tuple->offset);
241 doffset += snprintf(dbuffer+doffset, dmax-doffset,
",");
243 doffset += snprintf(dbuffer+doffset, dmax-doffset,
"%s", source);
244 offset += snprintf(buffer+offset, max-offset,
" -v %s:%s", source, mount->target);
248 offset += snprintf(buffer+offset, max-offset,
" -v %s:%s", mount->source, mount->target);
251 offset += snprintf(buffer+offset, max-offset,
":%s", mount->options);
255 for(
GListPtr pIter = data->ports; pIter != NULL; pIter = pIter->next) {
256 container_port_t *port = pIter->data;
259 offset += snprintf(buffer+offset, max-offset,
" -p %s:%s:%s",
260 tuple->ipaddr, port->source, port->target);
263 offset += snprintf(buffer+offset, max-offset,
" -p %s:%s", port->source, port->target);
267 if(data->docker_run_options) {
268 offset += snprintf(buffer+offset, max-offset,
" %s", data->docker_run_options);
271 if(data->docker_host_options) {
272 offset += snprintf(buffer+offset, max-offset,
" %s", data->docker_host_options);
282 if(data->docker_run_command) {
284 "run_cmd", data->docker_run_command);
287 "run_cmd",
SBIN_DIR "/pacemaker_remoted");
311 if(data->docker_run_command) {
313 "run_cmd", data->docker_run_command);
330 if (
common_unpack(xml_docker, &tuple->docker, parent, data_set) == FALSE) {
339 resource_t *parent, container_variant_data_t *data, container_grouping_t *tuple,
342 int offset = 0, max = 4096;
343 char *buffer = calloc(1, max+1);
345 int doffset = 0, dmax = 1024;
346 char *dbuffer = calloc(1, dmax+1);
349 xmlNode *xml_docker = NULL;
350 xmlNode *xml_obj = NULL;
356 xml_docker = create_resource(
id,
"heartbeat",
"rkt");
360 crm_xml_set_id(xml_obj,
"%s-attributes-%d", data->prefix, tuple->offset);
372 if (data->ip_range_start != NULL) {
373 offset += snprintf(buffer+offset, max-offset,
" --hostname=%s-%d",
374 data->prefix, tuple->offset);
377 offset += snprintf(buffer+offset, max-offset,
" --environment=PCMK_stderr=1");
379 if(data->docker_network) {
381 offset += snprintf(buffer+offset, max-offset,
" --net=%s", data->docker_network);
384 if(data->control_port) {
385 offset += snprintf(buffer+offset, max-offset,
" --environment=PCMK_remote_port=%s", data->control_port);
387 offset += snprintf(buffer+offset, max-offset,
" --environment=PCMK_remote_port=%d",
DEFAULT_REMOTE_PORT);
390 for(
GListPtr pIter = data->mounts; pIter != NULL; pIter = pIter->next) {
391 container_mount_t *mount = pIter->data;
395 "%s/%s-%d", mount->source, data->prefix, tuple->offset);
398 doffset += snprintf(dbuffer+doffset, dmax-doffset,
",");
400 doffset += snprintf(dbuffer+doffset, dmax-doffset,
"%s", source);
401 offset += snprintf(buffer+offset, max-offset,
" --volume vol%d,kind=host,source=%s", volid, source);
403 offset += snprintf(buffer+offset, max-offset,
",%s", mount->options);
405 offset += snprintf(buffer+offset, max-offset,
" --mount volume=vol%d,target=%s", volid, mount->target);
409 offset += snprintf(buffer+offset, max-offset,
" --volume vol%d,kind=host,source=%s", volid, mount->source);
411 offset += snprintf(buffer+offset, max-offset,
",%s", mount->options);
413 offset += snprintf(buffer+offset, max-offset,
" --mount volume=vol%d,target=%s", volid, mount->target);
418 for(
GListPtr pIter = data->ports; pIter != NULL; pIter = pIter->next) {
419 container_port_t *port = pIter->data;
422 offset += snprintf(buffer+offset, max-offset,
" --port=%s:%s:%s",
423 port->target, tuple->ipaddr, port->source);
425 offset += snprintf(buffer+offset, max-offset,
" --port=%s:%s", port->target, port->source);
429 if(data->docker_run_options) {
430 offset += snprintf(buffer+offset, max-offset,
" %s", data->docker_run_options);
433 if(data->docker_host_options) {
434 offset += snprintf(buffer+offset, max-offset,
" %s", data->docker_host_options);
444 if(data->docker_run_command) {
471 if(data->docker_run_command) {
473 data->docker_run_command);
491 if (
common_unpack(xml_docker, &tuple->docker, parent, data_set) == FALSE) {
507 gpointer match = g_hash_table_lookup(rsc->
allowed_nodes, uname);
516 for (child = rsc->
children; child != NULL; child = child->next) {
517 disallow_node((
resource_t *) (child->data), uname);
523 create_remote_resource(
524 resource_t *parent, container_variant_data_t *data, container_grouping_t *tuple,
527 if (tuple->child && valid_network(data)) {
531 xmlNode *xml_remote = NULL;
534 const char *uname = NULL;
535 const char *connect_name = NULL;
540 id =
crm_strdup_printf(
"pcmk-internal-%s-remote-%d", tuple->child->id, tuple->offset);
548 connect_name = (tuple->ipaddr? tuple->ipaddr :
"#uname");
550 if (data->control_port == NULL) {
563 data->control_port : port_s));
572 uname =
ID(xml_remote);
604 for (rsc_iter = data_set->
resources; rsc_iter; rsc_iter = rsc_iter->next) {
605 disallow_node((
resource_t *) (rsc_iter->data), uname);
609 tuple->node->weight = 500;
613 g_hash_table_destroy(tuple->child->allowed_nodes);
615 g_hash_table_insert(tuple->child->allowed_nodes, (gpointer) tuple->node->details->id,
node_copy(tuple->node));
620 g_hash_table_insert(tuple->child->parent->allowed_nodes, (gpointer) tuple->node->details->id, copy);
623 if (
common_unpack(xml_remote, &tuple->remote, parent, data_set) == FALSE) {
627 g_hash_table_iter_init(&gIter, tuple->remote->allowed_nodes);
628 while (g_hash_table_iter_next(&gIter, NULL, (
void **)&node)) {
635 tuple->node->details->remote_rsc = tuple->remote;
636 tuple->remote->container = tuple->docker;
641 g_hash_table_insert(tuple->node->details->attrs,
660 resource_t *parent, container_variant_data_t *data, container_grouping_t *tuple,
664 if (data->type == PE_CONTAINER_TYPE_DOCKER &&
665 create_docker_resource(parent, data, tuple, data_set) == FALSE) {
668 if (data->type == PE_CONTAINER_TYPE_RKT &&
669 create_rkt_resource(parent, data, tuple, data_set) == FALSE) {
673 if(create_ip_resource(parent, data, tuple, data_set) == FALSE) {
676 if(create_remote_resource(parent, data, tuple, data_set) == FALSE) {
679 if(tuple->child && tuple->ipaddr) {
700 mount_add(container_variant_data_t *container_data,
const char *source,
701 const char *target,
const char *options,
int flags)
703 container_mount_t *mount = calloc(1,
sizeof(container_mount_t));
705 mount->source = strdup(source);
706 mount->target = strdup(target);
708 mount->options = strdup(options);
710 mount->flags =
flags;
711 container_data->mounts = g_list_append(container_data->mounts, mount);
714 static void mount_free(container_mount_t *mount)
718 free(mount->options);
722 static void port_free(container_port_t *port)
729 static container_grouping_t *
733 container_variant_data_t *container_data = NULL;
739 while (top->
parent != NULL) {
743 get_container_variant_data(container_data, top);
744 for (
GListPtr gIter = container_data->tuples; gIter != NULL; gIter = gIter->next) {
745 container_grouping_t *tuple = (container_grouping_t *)gIter->data;
746 if(tuple->remote == remote) {
759 const char *attr_list[] = {
764 const char *value_list[] = {
775 value = g_hash_table_lookup(rsc->
parameters, name);
780 for (
int lpc = 0; lpc <
DIMOF(attr_list); lpc++) {
781 name = attr_list[lpc];
783 if (
safe_str_eq(value, value_list[lpc]) == FALSE) {
796 container_grouping_t *tuple = NULL;
802 tuple = tuple_for_remote(rsc);
807 node = tuple->docker->allocated_to;
808 if(node == NULL && tuple->docker->running_on) {
812 node = tuple->docker->running_on->data;
816 crm_trace(
"Cannot fix address for %s", tuple->remote->id);
821 if(xml != NULL && field != NULL) {
831 const char *value = NULL;
832 xmlNode *xml_obj = NULL;
833 xmlNode *xml_resource = NULL;
834 container_variant_data_t *container_data = NULL;
839 container_data = calloc(1,
sizeof(container_variant_data_t));
841 container_data->prefix = strdup(rsc->
id);
844 if (xml_obj != NULL) {
845 container_data->type = PE_CONTAINER_TYPE_DOCKER;
848 if (xml_obj != NULL) {
849 container_data->type = PE_CONTAINER_TYPE_RKT;
857 if (container_data->masters < 0) {
858 pe_err(
"'masters' for %s must be nonnegative integer, using 0",
860 container_data->masters = 0;
864 if ((value == NULL) && (container_data->masters > 0)) {
865 container_data->replicas = container_data->masters;
869 if (container_data->replicas < 1) {
870 pe_err(
"'replicas' for %s must be positive integer, using 1", rsc->
id);
871 container_data->replicas = 1;
880 container_data->replicas_per_host =
crm_parse_int(value,
"1");
881 if (container_data->replicas_per_host < 1) {
882 pe_err(
"'replicas-per-host' for %s must be positive integer, using 1",
884 container_data->replicas_per_host = 1;
886 if (container_data->replicas_per_host == 1) {
903 for (xmlNode *xml_child = __xml_first_child_element(xml_obj); xml_child != NULL;
904 xml_child = __xml_next_element(xml_child)) {
906 container_port_t *port = calloc(1,
sizeof(container_port_t));
909 if(port->source == NULL) {
915 if(port->source != NULL && strlen(port->source) > 0) {
916 if(port->target == NULL) {
917 port->target = strdup(port->source);
919 container_data->ports = g_list_append(container_data->ports, port);
922 pe_err(
"Invalid port directive %s",
ID(xml_child));
929 for (xmlNode *xml_child = __xml_first_child_element(xml_obj); xml_child != NULL;
930 xml_child = __xml_next_element(xml_child)) {
937 if (source == NULL) {
942 if (source && target) {
943 mount_add(container_data, source, target, options, flags);
945 pe_err(
"Invalid mount directive %s",
ID(xml_child));
950 if (xml_obj && valid_network(container_data)) {
952 xmlNode *xml_set = NULL;
954 if(container_data->masters > 0) {
961 crm_xml_set_id(xml_resource,
"%s-%s", container_data->prefix, xml_resource->name);
964 crm_xml_set_id(xml_set,
"%s-%s-meta", container_data->prefix, xml_resource->name);
969 value =
crm_itoa(container_data->replicas);
974 value =
crm_itoa(container_data->replicas_per_host);
980 (container_data->replicas_per_host > 1)?
983 if(container_data->masters) {
984 value =
crm_itoa(container_data->masters);
994 pe_err(
"Cannot control %s inside %s without either ip-range-start or control-port",
995 rsc->
id,
ID(xml_obj));
1003 container_port_t *port = NULL;
1005 int offset = 0, max = 1024;
1006 char *buffer = NULL;
1008 if (
common_unpack(xml_resource, &new_rsc, rsc, data_set) == FALSE) {
1009 pe_err(
"Failed unpacking resource %s",
ID(rsc->
xml));
1010 if (new_rsc != NULL && new_rsc->
fns != NULL) {
1016 container_data->child = new_rsc;
1042 mount_add(container_data,
CRM_LOG_DIR "/bundles",
"/var/log", NULL, 1);
1044 port = calloc(1,
sizeof(container_port_t));
1045 if(container_data->control_port) {
1046 port->source = strdup(container_data->control_port);
1058 port->target = strdup(port->source);
1059 container_data->ports = g_list_append(container_data->ports, port);
1061 buffer = calloc(1, max+1);
1062 for(childIter = container_data->child->children; childIter != NULL; childIter = childIter->next) {
1063 container_grouping_t *tuple = calloc(1,
sizeof(container_grouping_t));
1064 tuple->child = childIter->data;
1065 tuple->child->exclusive_discover = TRUE;
1066 tuple->offset = lpc++;
1073 offset += allocate_ip(container_data, tuple, buffer+offset, max-offset);
1074 container_data->tuples = g_list_append(container_data->tuples, tuple);
1075 container_data->attribute_target = g_hash_table_lookup(tuple->child->meta,
XML_RSC_ATTR_TARGET);
1077 container_data->docker_host_options = buffer;
1078 if(container_data->attribute_target) {
1080 g_hash_table_replace(container_data->child->meta, strdup(
XML_RSC_ATTR_TARGET), strdup(container_data->attribute_target));
1085 int offset = 0, max = 1024;
1086 char *buffer = calloc(1, max+1);
1088 for(
int lpc = 0; lpc < container_data->replicas; lpc++) {
1089 container_grouping_t *tuple = calloc(1,
sizeof(container_grouping_t));
1090 tuple->offset = lpc;
1091 offset += allocate_ip(container_data, tuple, buffer+offset, max-offset);
1092 container_data->tuples = g_list_append(container_data->tuples, tuple);
1095 container_data->docker_host_options = buffer;
1098 for (
GListPtr gIter = container_data->tuples; gIter != NULL; gIter = gIter->next) {
1099 container_grouping_t *tuple = (container_grouping_t *)gIter->data;
1100 if (create_container(rsc, container_data, tuple, data_set) == FALSE) {
1101 pe_err(
"Failed unpacking resource %s", rsc->
id);
1107 if(container_data->child) {
1114 tuple_rsc_active(
resource_t *rsc, gboolean all)
1117 gboolean child_active = rsc->
fns->
active(rsc, all);
1119 if (child_active && !all) {
1121 }
else if (!child_active && all) {
1131 container_variant_data_t *container_data = NULL;
1134 get_container_variant_data(container_data, rsc);
1135 for (iter = container_data->tuples; iter != NULL; iter = iter->next) {
1136 container_grouping_t *tuple = (container_grouping_t *)(iter->data);
1139 rsc_active = tuple_rsc_active(tuple->ip, all);
1140 if (rsc_active >= 0) {
1141 return (gboolean) rsc_active;
1144 rsc_active = tuple_rsc_active(tuple->child, all);
1145 if (rsc_active >= 0) {
1146 return (gboolean) rsc_active;
1149 rsc_active = tuple_rsc_active(tuple->docker, all);
1150 if (rsc_active >= 0) {
1151 return (gboolean) rsc_active;
1154 rsc_active = tuple_rsc_active(tuple->remote, all);
1155 if (rsc_active >= 0) {
1156 return (gboolean) rsc_active;
1170 container_variant_data_t *container_data = NULL;
1175 get_container_variant_data(container_data, parent);
1178 for (
GListPtr gIter = container_data->tuples; gIter != NULL; gIter = gIter->next) {
1179 container_grouping_t *tuple = (container_grouping_t *)gIter->data;
1182 if(tuple->node->details == node->
details) {
1198 print_rsc_in_list(
resource_t *rsc,
const char *pre_text,
long options,
1205 rsc->
fns->
print(rsc, pre_text, options, print_data);
1206 if (options & pe_print_html) {
1213 container_type_as_string(
enum container_type t)
1215 if (t == PE_CONTAINER_TYPE_DOCKER) {
1216 return PE_CONTAINER_TYPE_DOCKER_S;
1217 }
else if (t == PE_CONTAINER_TYPE_RKT) {
1218 return PE_CONTAINER_TYPE_RKT_S;
1220 return PE_CONTAINER_TYPE_UNKNOWN_S;
1225 container_print_xml(
resource_t * rsc,
const char *pre_text,
long options,
void *print_data)
1227 container_variant_data_t *container_data = NULL;
1228 char *child_text = NULL;
1231 if (pre_text == NULL) {
1236 get_container_variant_data(container_data, rsc);
1243 for (
const char *c = container_type_as_string(container_data->type);
1255 for (
GListPtr gIter = container_data->tuples; gIter != NULL; gIter = gIter->next) {
1256 container_grouping_t *tuple = (container_grouping_t *)gIter->data;
1259 status_print(
"%s <replica id=\"%d\">\n", pre_text, tuple->offset);
1260 print_rsc_in_list(tuple->ip, child_text, options, print_data);
1261 print_rsc_in_list(tuple->child, child_text, options, print_data);
1262 print_rsc_in_list(tuple->docker, child_text, options, print_data);
1263 print_rsc_in_list(tuple->remote, child_text, options, print_data);
1271 tuple_print(container_grouping_t * tuple,
const char *pre_text,
long options,
void *print_data)
1277 char buffer[LINE_MAX];
1280 rsc = tuple->docker;
1284 offset += snprintf(buffer + offset, LINE_MAX - offset,
"%s",
rsc_printable_id(tuple->remote));
1286 offset += snprintf(buffer + offset, LINE_MAX - offset,
"%s",
rsc_printable_id(tuple->docker));
1289 offset += snprintf(buffer + offset, LINE_MAX - offset,
" (%s)", tuple->ipaddr);
1292 if (tuple->docker->running_on) {
1293 node = tuple->docker->running_on->data;
1295 common_print(rsc, pre_text, buffer, node, options, print_data);
1301 container_variant_data_t *container_data = NULL;
1302 char *child_text = NULL;
1306 container_print_xml(rsc, pre_text, options, print_data);
1310 get_container_variant_data(container_data, rsc);
1312 if (pre_text == NULL) {
1317 pre_text, container_type_as_string(container_data->type),
1318 container_data->replicas>1?
" set":
"", rsc->
id, container_data->image,
1321 if (options & pe_print_html) {
1326 for (
GListPtr gIter = container_data->tuples; gIter != NULL; gIter = gIter->next) {
1327 container_grouping_t *tuple = (container_grouping_t *)gIter->data;
1330 if (options & pe_print_html) {
1336 if(g_list_length(container_data->tuples) > 1) {
1337 status_print(
" %sReplica[%d]\n", pre_text, tuple->offset);
1339 if (options & pe_print_html) {
1342 print_rsc_in_list(tuple->ip, child_text, options, print_data);
1343 print_rsc_in_list(tuple->docker, child_text, options, print_data);
1344 print_rsc_in_list(tuple->remote, child_text, options, print_data);
1345 print_rsc_in_list(tuple->child, child_text, options, print_data);
1346 if (options & pe_print_html) {
1351 tuple_print(tuple, child_text, options, print_data);
1355 if (options & pe_print_html) {
1359 if (options & pe_print_html) {
1378 tuple->ip->xml = NULL;
1379 tuple->ip->fns->free(tuple->ip);
1384 tuple->docker->xml = NULL;
1385 tuple->docker->fns->free(tuple->docker);
1386 tuple->docker = NULL;
1390 tuple->remote->xml = NULL;
1391 tuple->remote->fns->free(tuple->remote);
1392 tuple->remote = NULL;
1394 free(tuple->ipaddr);
1401 container_variant_data_t *container_data = NULL;
1404 get_container_variant_data(container_data, rsc);
1407 free(container_data->prefix);
1408 free(container_data->image);
1409 free(container_data->control_port);
1410 free(container_data->host_network);
1411 free(container_data->host_netmask);
1412 free(container_data->ip_range_start);
1413 free(container_data->docker_network);
1414 free(container_data->docker_run_options);
1415 free(container_data->docker_run_command);
1416 free(container_data->docker_host_options);
1418 g_list_free_full(container_data->tuples, (GDestroyNotify)
tuple_free);
1419 g_list_free_full(container_data->mounts, (GDestroyNotify)mount_free);
1420 g_list_free_full(container_data->ports, (GDestroyNotify)port_free);
1423 if(container_data->child) {
1424 free_xml(container_data->child->xml);
1425 container_data->child->xml = NULL;
1426 container_data->child->fns->free(container_data->child);
1435 return container_role;
1451 container_variant_data_t *container_data = NULL;
1453 get_container_variant_data(container_data, rsc);
1454 return container_data->replicas;
bool remote_id_conflict(const char *remote_name, pe_working_set_t *data)
#define CRM_CHECK(expr, failure_action)
void container_free(resource_t *rsc)
gboolean safe_str_neq(const char *a, const char *b)
node_t * node_copy(const node_t *this_node)
node_t * pe_create_node(const char *id, const char *uname, const char *type, const char *score, pe_working_set_t *data_set)
bool container_fix_remote_addr(resource_t *rsc)
#define XML_BOOLEAN_FALSE
gboolean common_unpack(xmlNode *xml_obj, resource_t **rsc, resource_t *parent, pe_working_set_t *data_set)
enum pe_obj_types variant
void(* free)(resource_t *)
void common_free(resource_t *rsc)
#define status_print(fmt, args...)
int crm_parse_int(const char *text, const char *default_text)
char * crm_element_value_copy(xmlNode *data, const char *name)
node_t * pe_find_node(GListPtr node_list, const char *uname)
#define CRM_LOG_ASSERT(expr)
resource_t * uber_parent(resource_t *rsc)
#define clear_bit(word, bit)
#define XML_RSC_ATTR_INCARNATION_MAX
#define XML_RSC_ATTR_TARGET
#define pe_rsc_allow_remote_remotes
void crm_xml_sanitize_id(char *id)
Sanitize a string so it is usable as an XML ID.
#define DEFAULT_REMOTE_PORT
#define DEFAULT_REMOTE_KEY_LOCATION
#define XML_TAG_ATTR_SETS
gboolean container_unpack(resource_t *rsc, pe_working_set_t *data_set)
gboolean is_remote_node(node_t *node)
gboolean(* active)(resource_t *, gboolean)
struct node_shared_s * details
resource_t * find_container_child(const char *stem, resource_t *rsc, node_t *node)
#define set_bit(word, bit)
#define PCMK_RESOURCE_CLASS_OCF
xmlNode * pe_create_remote_xml(xmlNode *parent, const char *uname, const char *container_id, const char *migrateable, const char *is_managed, const char *interval, const char *monitor_timeout, const char *start_timeout, const char *server, const char *port)
#define XML_CIB_TAG_RESOURCE
resource_object_functions_t * fns
GHashTable * allowed_nodes
#define crm_trace(fmt, args...)
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
xmlNode * crm_create_op_xml(xmlNode *parent, const char *prefix, const char *task, const char *interval, const char *timeout)
Create a CIB XML element for an operation.
#define XML_AGENT_ATTR_PROVIDER
#define XML_RSC_ATTR_ORDERED
#define XML_TAG_META_SETS
const char * container_fix_remote_addr_in(resource_t *rsc, xmlNode *xml, const char *field)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
const char * crm_element_value(xmlNode *data, const char *name)
#define XML_RSC_ATTR_INCARNATION_NODEMAX
void free_xml(xmlNode *child)
int pe_bundle_replicas(const resource_t *rsc)
Get the number of configured replicas in a bundle.
#define XML_RSC_ATTR_UNIQUE
void common_print(resource_t *rsc, const char *pre_text, const char *name, node_t *node, long options, void *print_data)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
#define XML_RSC_ATTR_MASTER_MAX
void tuple_free(container_grouping_t *tuple)
#define XML_CIB_TAG_INCARNATION
void add_hash_param(GHashTable *hash, const char *name, const char *value)
void(* print)(resource_t *, const char *, long, void *)
void crm_xml_set_id(xmlNode *xml, const char *format,...) __attribute__((__format__(__printf__
enum rsc_role_e container_resource_state(const resource_t *rsc, gboolean current)
xmlNode * crm_create_nvpair_xml(xmlNode *parent, const char *id, const char *name, const char *value)
Create an XML name/value pair.
void container_print(resource_t *rsc, const char *pre_text, long options, void *print_data)
gboolean container_active(resource_t *rsc, gboolean all)
#define XML_CIB_TAG_MASTER
xmlNode * first_named_child(xmlNode *parent, const char *name)
#define crm_log_xml_trace(xml, text)
#define pe_rsc_trace(rsc, fmt, args...)
char * crm_concat(const char *prefix, const char *suffix, char join)
char * crm_itoa(int an_int)
#define safe_str_eq(a, b)
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
void g_hash_destroy_str(gpointer data)
const char * rsc_printable_id(resource_t *rsc)
#define XML_AGENT_ATTR_CLASS