Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ClusterLabs/pacemaker
Browse files Browse the repository at this point in the history
  • Loading branch information
beekhof committed Nov 21, 2013
2 parents a269ba8 + cff0269 commit de716cb
Show file tree
Hide file tree
Showing 50 changed files with 555 additions and 1,801 deletions.
22 changes: 0 additions & 22 deletions cib/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,28 +116,6 @@ cib_notify_send_one(gpointer key, gpointer value, gpointer user_data)
if (do_send) {
switch (client->kind) {
case CRM_CLIENT_IPC:
#ifdef HAVE_IPCS_GET_BUFFER_SIZE
{
int max_send_size = qb_ipcs_connection_get_buffer_size(client->ipcs);
if (max_send_size < update->iov_size) {
struct iovec *iov;
int new_size = crm_ipc_prepare(0, update->msg, &iov, max_send_size);

if (new_size > 0) {
free(update->iov[0].iov_base);
free(update->iov[1].iov_base);
free(update->iov);

update->iov = iov;
update->iov_size = new_size;
} else {
crm_warn("Preparing notification for client %s/%s failed", client->name, client->id);
return FALSE;
}
}
}
#endif

if (crm_ipcs_sendv(client, update->iov, crm_ipc_server_event) < 0) {
crm_warn("Notification of client %s/%s failed", client->name, client->id);
}
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ AC_CHECK_LIB(qb, qb_ipcs_connection_auth_set)
LIBQB_LOG=1
PCMK_FEATURES="$PCMK_FEATURES libqb-logging libqb-ipc"

AC_CHECK_FUNCS(qb_ipcs_connection_get_buffer_size, AC_DEFINE(HAVE_IPCS_GET_BUFFER_SIZE, 1, [Have qb_ipcs_connection_get_buffer_size function]))
AC_CHECK_FUNCS(qb_ipcs_connection_get_buffer_size, AC_DEFINE(HAVE_IPCS_GET_BUFFER_SIZE, 1, [Have qb_ipcc_get_buffer_size function]))

if
! pkg-config --atleast-version 0.13 libqb
Expand Down
1 change: 1 addition & 0 deletions include/crm/common/ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ int crm_ipc_ready(crm_ipc_t * client);
long crm_ipc_read(crm_ipc_t * client);
const char *crm_ipc_buffer(crm_ipc_t * client);
const char *crm_ipc_name(crm_ipc_t * client);
int crm_ipc_default_buffer_size(void);

/* Utils */
xmlNode *create_hello_message(const char *uuid, const char *client_name,
Expand Down
2 changes: 1 addition & 1 deletion include/crm/pengine/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,5 @@ gboolean xml_contains_remote_node(xmlNode *xml);
gboolean is_baremetal_remote_node(node_t *node);
gboolean is_container_remote_node(node_t *node);
gboolean is_remote_node(node_t *node);
gboolean rsc_contains_remote_node(pe_working_set_t * data_set, resource_t *rsc);
resource_t * rsc_contains_remote_node(pe_working_set_t * data_set, resource_t *rsc);
#endif
2 changes: 1 addition & 1 deletion include/crm/pengine/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ enum pe_find {
# define pe_flag_startup_probes 0x00010000ULL
# define pe_flag_have_status 0x00020000ULL
# define pe_flag_have_remote_nodes 0x00040000ULL
# define pe_flag_container_probes 0x00080000ULL

# define pe_flag_quick_location 0x00100000ULL

Expand Down Expand Up @@ -186,6 +185,7 @@ struct node_s {
# define pe_rsc_migrating 0x00400000ULL

# define pe_rsc_failure_ignored 0x01000000ULL
# define pe_rsc_unexpectedly_running 0x02000000ULL

# define pe_rsc_needs_quorum 0x10000000ULL
# define pe_rsc_needs_fencing 0x20000000ULL
Expand Down
25 changes: 16 additions & 9 deletions lib/common/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ crm_ipc_init(void)
}
}

int
crm_ipc_default_buffer_size(void)
{
return pick_ipc_buffer(0);
}

static char *
generateReference(const char *custom1, const char *custom2)
{
Expand Down Expand Up @@ -668,21 +674,13 @@ crm_ipcs_send(crm_client_t * c, uint32_t request, xmlNode * message,
{
struct iovec *iov = NULL;
ssize_t rc = 0;
int32_t max_msg_size = 0;

if(c == NULL) {
return -EDESTADDRREQ;
}
crm_ipc_init();

/* when sending from server to client, we need to use the client's
* max buffer size if possible */
max_msg_size = ipc_buffer_max;
#ifdef HAVE_IPCS_GET_BUFFER_SIZE
max_msg_size = qb_ipcs_connection_get_buffer_size(c->ipcs);
#endif

rc = crm_ipc_prepare(request, message, &iov, max_msg_size);
rc = crm_ipc_prepare(request, message, &iov, ipc_buffer_max);
if (rc > 0) {
rc = crm_ipcs_sendv(c, iov, flags | crm_ipc_server_free);

Expand Down Expand Up @@ -790,6 +788,15 @@ crm_ipc_connect(crm_ipc_t * client)

qb_ipcc_context_set(client->ipc, client);

#ifdef HAVE_IPCS_GET_BUFFER_SIZE
client->max_buf_size = qb_ipcc_get_buffer_size(client->ipc);
if (client->max_buf_size < client->buf_size) {
free(client->buffer);
client->buffer = calloc(1, client->max_buf_size);
client->buf_size = client->max_buf_size;
}
#endif

return TRUE;
}

Expand Down
6 changes: 6 additions & 0 deletions lib/common/mainloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,12 @@ mainloop_add_ipc_server(const char *name, enum qb_ipc_type type,

crm_client_init();
server = qb_ipcs_create(name, 0, pick_ipc_type(type), callbacks);

#ifdef HAVE_IPCS_GET_BUFFER_SIZE
/* All clients should use at least ipc_buffer_max as their buffer size */
qb_ipcs_enforce_buffer_size(server, crm_ipc_default_buffer_size());
#endif

qb_ipcs_poll_handlers_set(server, &gio_poll_funcs);

rc = qb_ipcs_run(server);
Expand Down
2 changes: 0 additions & 2 deletions lib/pengine/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ pe_cluster_option pe_opts[] = {
"This was the old default. However when set to FALSE, the cluster will instead use the resource's failcount and value for resource-failure-stickiness" },
{ "enable-startup-probes", NULL, "boolean", NULL, "true", &check_boolean,
"Should the cluster check for active resources during startup", NULL },
{ "enable-container-probes", NULL, "boolean", NULL, "true", &check_boolean,
"Should the cluster check for active resources on container nodes during startup", NULL },

/* Stonith Options */
{ "stonith-enabled", "stonith_enabled", "boolean", NULL, "true", &check_boolean,
Expand Down
33 changes: 26 additions & 7 deletions lib/pengine/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ unpack_config(xmlNode * config, pe_working_set_t * data_set)
crm_info("Startup probes: disabled (dangerous)");
}

set_config_flag(data_set, "enable-container-probes", pe_flag_container_probes);
if(is_not_set(data_set->flags, pe_flag_container_probes)) {
crm_info("Container probes: disabled");
}

value = pe_pref(data_set->config_hash, "stonith-timeout");
data_set->stonith_timeout = crm_get_msec(value);
crm_debug("STONITH timeout: %d", data_set->stonith_timeout);
Expand Down Expand Up @@ -2062,6 +2057,9 @@ unpack_lrm_resources(node_t * node, xmlNode * lrm_rsc_list, pe_working_set_t * d
{
xmlNode *rsc_entry = NULL;
gboolean found_orphaned_container_filler = FALSE;
GListPtr unexpected_containers = NULL;
GListPtr gIter = NULL;
resource_t *remote = NULL;

CRM_CHECK(node != NULL, return FALSE);

Expand All @@ -2073,9 +2071,29 @@ unpack_lrm_resources(node_t * node, xmlNode * lrm_rsc_list, pe_working_set_t * d
if (crm_str_eq((const char *)rsc_entry->name, XML_LRM_TAG_RESOURCE, TRUE)) {
resource_t *rsc;
rsc = unpack_lrm_rsc_state(node, rsc_entry, data_set);
if (rsc && is_set(rsc->flags, pe_rsc_orphan_container_filler)) {
if (!rsc) {
continue;
}
if (is_set(rsc->flags, pe_rsc_orphan_container_filler)) {
found_orphaned_container_filler = TRUE;
}
if (is_set(rsc->flags, pe_rsc_unexpectedly_running)) {
remote = rsc_contains_remote_node(data_set, rsc);
if (remote) {
unexpected_containers = g_list_append(unexpected_containers, remote);
}
}
}
}

/* If a container resource is unexpectedly up... and the remote-node
* connection resource for that container is not up, the entire container
* must be recovered. */
for (gIter = unexpected_containers; gIter != NULL; gIter = gIter->next) {
remote = (resource_t *) gIter->data;
if (remote->role != RSC_ROLE_STARTED) {
crm_warn("Recovering container resource %s. Resource is unexpectedly running and involves a remote-node.");
set_bit(remote->container->flags, pe_rsc_failed);
}
}

Expand All @@ -2085,7 +2103,7 @@ unpack_lrm_resources(node_t * node, xmlNode * lrm_rsc_list, pe_working_set_t * d
if (found_orphaned_container_filler) {
handle_orphaned_container_fillers(lrm_rsc_list, data_set);
}

g_list_free(unexpected_containers);
return TRUE;
}

Expand Down Expand Up @@ -2469,6 +2487,7 @@ determine_op_status(
result = PCMK_LRM_OP_DONE;
pe_rsc_info(rsc, "Operation %s found resource %s active on %s",
task, rsc->id, node->details->uname);
set_bit(rsc->flags, pe_rsc_unexpectedly_running);

/* legacy code for pre-0.6.5 operations */
} else if (target_rc < 0 && interval > 0 && rsc->role == RSC_ROLE_MASTER) {
Expand Down
8 changes: 4 additions & 4 deletions lib/pengine/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1805,11 +1805,11 @@ is_remote_node(node_t *node)
return FALSE;
}

gboolean
resource_t *
rsc_contains_remote_node(pe_working_set_t * data_set, resource_t *rsc)
{
if (is_set(data_set->flags, pe_flag_have_remote_nodes) == FALSE) {
return FALSE;
return NULL;
}

if (rsc->fillers) {
Expand All @@ -1818,11 +1818,11 @@ rsc_contains_remote_node(pe_working_set_t * data_set, resource_t *rsc)
resource_t *filler = (resource_t *) gIter->data;

if (filler->is_remote_node) {
return TRUE;
return filler;
}
}
}
return FALSE;
return NULL;
}

gboolean
Expand Down
4 changes: 2 additions & 2 deletions pengine/allocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,8 @@ probe_resources(pe_working_set_t * data_set)
* it is being shutdown. */
continue;

} else if (is_container_remote_node(node) && is_not_set(data_set->flags, pe_flag_container_probes)) {
/* skip container nodes if container node probes are disabled */
} else if (is_container_remote_node(node)) {
/* TODO enable container node probes once ordered probing is implemented. */
continue;

} else if (probe_complete == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion pengine/native.c
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,7 @@ native_create_probe(resource_t * rsc, node_t * node, action_t * complete,
if (force == FALSE && is_not_set(data_set->flags, pe_flag_startup_probes)) {
pe_rsc_trace(rsc, "Skipping active resource detection for %s", rsc->id);
return FALSE;
} else if (force == FALSE && is_container_remote_node(node) && is_not_set(data_set->flags, pe_flag_container_probes)) {
} else if (force == FALSE && is_container_remote_node(node)) {
pe_rsc_trace(rsc, "Skipping active resource detection for %s on container %s",
rsc->id, node->details->id);
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion pengine/regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ do_test whitebox-ms-ordering "Verify promote/demote can not occur before connect
do_test whitebox-ms-ordering "Verify promote/demote can not occur before connection is established"
do_test whitebox-orphaned "Properly shutdown orphaned whitebox container"
do_test whitebox-orphan-ms "Properly tear down orphan ms resources on remote-nodes"
do_test whitebox-disable-probes "Verify probes are not executed when container probes are disabled"
do_test whitebox-unexpectedly-running "Recover container nodes the cluster did not start."

echo ""
do_test remote-startup-probes "Baremetal remote-node startup probes"
Expand Down
1 change: 0 additions & 1 deletion pengine/test10/master-partially-demoted-group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<nvpair name="election-timeout" value="2m" id="cib-bootstrap-options-election-timeout"/>
<nvpair name="enable-acl" value="false" id="cib-bootstrap-options-enable-acl"/>
<nvpair name="enable-startup-probes" value="true" id="cib-bootstrap-options-enable-startup-probes"/>
<nvpair name="enable-container-probes" value="true" id="cib-bootstrap-options-enable-container-probes"/>
<nvpair name="migration-limit" value="4" id="cib-bootstrap-options-migration-limit"/>
<nvpair name="node-health-green" value="0" id="cib-bootstrap-options-node-health-green"/>
<nvpair name="node-health-red" value="-INFINITY" id="cib-bootstrap-options-node-health-red"/>
Expand Down
16 changes: 0 additions & 16 deletions pengine/test10/whitebox-asymmetric.dot
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
digraph "g" {
"18node2_monitor_30000 18builder" [ style=bold color="green" fontcolor="black"]
"18node2_start_0 18builder" -> "18node2_monitor_30000 18builder" [ style = bold]
"18node2_start_0 18builder" -> "nfs_mount_monitor_0 18node2" [ style = bold]
"18node2_start_0 18builder" -> "nfs_mount_monitor_10000 18node2" [ style = bold]
"18node2_start_0 18builder" -> "nfs_mount_start_0 18node2" [ style = bold]
"18node2_start_0 18builder" -> "vg_tags_dup_monitor_0 18node2" [ style = bold]
"18node2_start_0 18builder" -> "vg_tags_monitor_0 18node2" [ style = bold]
"18node2_start_0 18builder" -> "webserver_monitor_0 18node2" [ style = bold]
"18node2_start_0 18builder" [ style=bold color="green" fontcolor="black"]
"nfs_mount_monitor_0 18node2" -> "probe_complete 18node2" [ style = bold]
"nfs_mount_monitor_0 18node2" [ style=bold color="green" fontcolor="black"]
"nfs_mount_monitor_10000 18node2" [ style=bold color="green" fontcolor="black"]
"nfs_mount_start_0 18node2" -> "nfs_mount_monitor_10000 18node2" [ style = bold]
"nfs_mount_start_0 18node2" [ style=bold color="green" fontcolor="black"]
"probe_complete 18node2" -> "probe_complete" [ style = bold]
"probe_complete 18node2" [ style=bold color="green" fontcolor="black"]
"probe_complete" -> "nfs_mount_start_0 18node2" [ style = bold]
"probe_complete" [ style=bold color="green" fontcolor="orange"]
"vg_tags_dup_monitor_0 18node2" -> "probe_complete 18node2" [ style = bold]
"vg_tags_dup_monitor_0 18node2" [ style=bold color="green" fontcolor="black"]
"vg_tags_monitor_0 18node2" -> "probe_complete 18node2" [ style = bold]
"vg_tags_monitor_0 18node2" [ style=bold color="green" fontcolor="black"]
"webserver_monitor_0 18node2" -> "probe_complete 18node2" [ style = bold]
"webserver_monitor_0 18node2" [ style=bold color="green" fontcolor="black"]
}
Loading

0 comments on commit de716cb

Please sign in to comment.