Skip to content

Commit

Permalink
Merge pull request #975 from kgaillot/1.1
Browse files Browse the repository at this point in the history
Merge master branch into 1.1
  • Loading branch information
kgaillot committed Apr 22, 2016
2 parents 70404b0 + fa14385 commit d5cd928
Show file tree
Hide file tree
Showing 446 changed files with 9,322 additions and 4,254 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ doc/Clusters_from_Scratch.txt
doc/Pacemaker_Explained.txt
doc/acls.html
doc/crm_fencing.html
doc/publican-catalog*
fencing/stonith-test
fencing/stonith_admin
fencing/stonithd
Expand Down Expand Up @@ -163,7 +164,6 @@ compat_reports
.ABI-build
abi_dumps
logs
xsl

*.patch
*.diff
Expand Down
4 changes: 2 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@
+ crmd: If there are no nodes to finalize, start an election.
+ crmd: If there are no nodes to welcome, start an election.
+ crmd: Prevent node attribute loss by detecting attrd disconnections immediately
+ crmd: Prevent node re-probe loops by ensuring manditory actions always complete
+ crmd: Prevent node re-probe loops by ensuring mandatory actions always complete
+ pengine: Bug 2005 - Fix startup ordering of cloned stonith groups
+ pengine: Bug 2006 - Correctly reprobe cloned groups
+ pengine: Bug BNC:465484 - Fix the no-quorum-policy=suicide option
Expand Down Expand Up @@ -2092,7 +2092,7 @@
+ cib: Correctly detect configuration changes - num_updates does not count
+ pengine: Apply stickiness values to the whole group, not the individual resources
+ pengine: Bug N:385265 - Ensure groups are migrated instead of remaining partially active on the current node
+ pengine: Bug N:396293 - Enforce manditory group restarts due to ordering constraints
+ pengine: Bug N:396293 - Enforce mandatory group restarts due to ordering constraints
+ pengine: Correctly recover master instances found active on more than one node
+ pengine: Fix memory leaks reported by Valgrind
+ Medium: Admin: crm_mon - Misc improvements from Satomi Taniguchi
Expand Down
12 changes: 8 additions & 4 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PACKAGE ?= pacemaker

# Force 'make dist' to be consistent with 'make export'
distdir = $(PACKAGE)-$(TAG)
TARFILE = $(distdir).tar.gz
TARFILE = $(PACKAGE)-$(SHORTTAG).tar.gz
DIST_ARCHIVES = $(TARFILE)

RPM_ROOT = $(shell pwd)
Expand All @@ -44,6 +44,9 @@ ARCH ?= $(shell test -e /etc/fedora-release && rpm --eval %{_arch})
MOCK_CFG ?= $(shell test -e /etc/fedora-release && echo fedora-$(F)-$(ARCH))
DISTRO ?= $(shell test -e /etc/SuSE-release && echo suse; echo fedora)
TAG ?= $(shell git log --pretty="format:%H" -n 1)
lparen = (
rparen = )
SHORTTAG ?= $(shell case $(TAG) in Pacemaker-*$(rparen) echo $(TAG);; *$(rparen) git log --pretty="format:%h" -n 1;; esac)
WITH ?= --without doc
#WITH ?= --without=doc --with=gcov

Expand Down Expand Up @@ -151,10 +154,11 @@ srpm-%: export $(PACKAGE)-%.spec
sed -i 's/global\ commit.*/global\ commit\ $(TAG)/' $(PACKAGE).spec
case "$(WITH)" in \
*pre_release*) \
sed -i 's/global\ pcmk_release.*/global\ pcmk_release\ 0.%{specversion}.%{shortcommit}.git/' $(PACKAGE).spec; \
sed -i 's/Version:.*/Version:\ $(shell echo $(NEXT_RELEASE) | sed -e s:Pacemaker-:: -e s:-.*::)/' $(PACKAGE).spec;; \
sed -i 's/^\(%global pcmk_release \).*/\10.%{specversion}.%{shortcommit}.git/' $(PACKAGE).spec; \
sed -i 's/^\(%global pcmkversion \).*/\1$(shell echo $(NEXT_RELEASE) | sed -e s:Pacemaker-:: -e s:-.*::)/' $(PACKAGE).spec;; \
*) \
sed -i 's/Version:.*/Version:\ $(shell git describe --tags $(TAG) | sed -e s:Pacemaker-:: -e s:-.*::)/' $(PACKAGE).spec;;\
[ "$(TAG)" = "$(SHORTTAG)" ] || sed -i 's/^\(%global pcmk_release \).*/\1%{specversion}.%{shortcommit}.git/' $(PACKAGE).spec; \
sed -i 's/^\(%global pcmkversion \).*/\1$(shell git describe --tags $(TAG) | sed -e s:Pacemaker-:: -e s:-.*::)/' $(PACKAGE).spec;;\
esac
rpmbuild -bs --define "dist .$*" $(RPM_OPTS) $(PACKAGE).spec

Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ core-clean:
install-exec-local:
$(INSTALL) -d $(DESTDIR)/$(LCRSODIR)
$(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_CONFIG_DIR)
$(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_CORE_DIR)
$(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_BLACKBOX_DIR)
-chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_CONFIG_DIR)
-chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_CORE_DIR)
-chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_BLACKBOX_DIR)
if BUILD_CS_PLUGIN
rm -f $(DESTDIR)$(LCRSODIR)/pacemaker.lcrso $(DESTDIR)$(LCRSODIR)/service_crm.so
Expand Down
8 changes: 5 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ This is not meant to be an exhaustive list:
* libtool-ltdl-devel
* libuuid-devel
* pkgconfig
* python
* python (or python-devel if that's preferred as a build dependency)
* glib2-devel
* libxml2-devel
* libxslt-devel
* python-devel
* gcc-c++
* bzip2-devel
* gnutls-devel
* pam-devel
Expand Down Expand Up @@ -72,6 +70,10 @@ This is not meant to be an exhaustive list:
## Optional testing dependencies
* valgrind (if running CTS valgrind tests)
* systemd-python (if using CTS on cluster nodes running systemd)
* rsync (if running CTS container tests)
* libvirt-daemon-driver-lxc (if running CTS container tests)
* libvirt-daemon-lxc (if running CTS container tests)
* libvirt-login-shell (if running CTS container tests)

## Source Control (GIT)

Expand Down
94 changes: 82 additions & 12 deletions attrd/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ create_attribute(xmlNode *xml)
if(dampen > 0) {
a->timeout_ms = dampen;
a->timer = mainloop_timer_add(a->id, a->timeout_ms, FALSE, attribute_timer_cb, a);
} else if (dampen < 0) {
crm_warn("Ignoring invalid delay %s for attribute %s", value, a->id);
}

g_hash_table_replace(attributes, a->id, a);
Expand Down Expand Up @@ -525,7 +527,7 @@ attrd_peer_message(crm_node_t *peer, xmlNode *xml)
}
}

if (safe_str_eq(op, ATTRD_OP_UPDATE)) {
if (safe_str_eq(op, ATTRD_OP_UPDATE) || safe_str_eq(op, ATTRD_OP_UPDATE_BOTH) || safe_str_eq(op, ATTRD_OP_UPDATE_DELAY)) {
attrd_peer_update(peer, xml, host, FALSE);

} else if (safe_str_eq(op, ATTRD_OP_SYNC)) {
Expand All @@ -541,8 +543,9 @@ attrd_peer_message(crm_node_t *peer, xmlNode *xml)
} else {
host = NULL;
}
attrd_peer_remove(host_id, host, TRUE, peer->uname);

crm_notice("Processing %s from %s: %s %u", op, peer->uname, host, host_id);
attrd_peer_remove(host_id, host, TRUE, peer->uname);

} else if (safe_str_eq(op, ATTRD_OP_SYNC_RESPONSE)
&& safe_str_neq(peer->uname, attrd_cluster->uname)) {
Expand Down Expand Up @@ -589,15 +592,27 @@ attrd_peer_remove(uint32_t nodeid, const char *host, gboolean uncache, const cha
attribute_t *a = NULL;
GHashTableIter aIter;

crm_notice("Removing all %s attributes for %s", host, source);
crm_notice("Removing all %s (%u) attributes for %s", host, nodeid, source);
if(host == NULL) {
return;
}

g_hash_table_iter_init(&aIter, attributes);
while (g_hash_table_iter_next(&aIter, NULL, (gpointer *) & a)) {
if(g_hash_table_remove(a->values, host)) {
crm_debug("Removed %s[%s] for %s", a->id, host, source);
attribute_value_t *v = g_hash_table_lookup(a->values, host);

if(v && v->current) {
free(v->current);
v->current = NULL;
a->changed = TRUE;

crm_debug("Removed %s[%s]=%s for %s", a->id, host, v->current, source);
if(a->timer) {
crm_trace("Delayed write out (%dms) for %s", a->timeout_ms, a->id);
mainloop_timer_start(a->timer);
} else {
write_or_elect_attribute(a);
}
}
}

Expand All @@ -621,6 +636,22 @@ static attribute_value_t *
attrd_lookup_or_create_value(GHashTable *values, const char *host, xmlNode *xml)
{
attribute_value_t *v = g_hash_table_lookup(values, host);
int is_remote = 0;

crm_element_value_int(xml, F_ATTRD_IS_REMOTE, &is_remote);
if (is_remote) {
/* If we previously assumed this node was an unseen cluster node,
* remove its entry from the cluster peer cache.
*/
crm_node_t *dup = crm_find_peer(0, host);

if (dup && (dup->uuid == NULL)) {
reap_crm_member(0, host);
}

/* Ensure this host is in the remote peer cache */
crm_remote_peer_cache_add(host);
}

if (v == NULL) {
v = calloc(1, sizeof(attribute_value_t));
Expand All @@ -629,11 +660,7 @@ attrd_lookup_or_create_value(GHashTable *values, const char *host, xmlNode *xml)
v->nodename = strdup(host);
CRM_ASSERT(v->nodename != NULL);

crm_element_value_int(xml, F_ATTRD_IS_REMOTE, &v->is_remote);
if (v->is_remote == TRUE) {
crm_remote_peer_cache_add(host);
}

v->is_remote = is_remote;
g_hash_table_replace(values, v->nodename, v);
}
return(v);
Expand All @@ -644,14 +671,58 @@ attrd_peer_update(crm_node_t *peer, xmlNode *xml, const char *host, bool filter)
{
bool changed = FALSE;
attribute_value_t *v = NULL;
int dampen = 0;

const char *op = crm_element_value(xml, F_ATTRD_TASK);
const char *attr = crm_element_value(xml, F_ATTRD_ATTRIBUTE);
const char *value = crm_element_value(xml, F_ATTRD_VALUE);
const char *dvalue = crm_element_value(xml, F_ATTRD_DAMPEN);

attribute_t *a = g_hash_table_lookup(attributes, attr);

if(a == NULL) {
a = create_attribute(xml);
if (safe_str_eq(op, ATTRD_OP_UPDATE) || safe_str_eq(op, ATTRD_OP_UPDATE_BOTH)) {
a = create_attribute(xml);
} else {
crm_warn("Update error (attribute %s not found)", attr);
return;
}
}

if (safe_str_eq(op, ATTRD_OP_UPDATE_BOTH) || safe_str_eq(op, ATTRD_OP_UPDATE_DELAY)) {
if (dvalue) {
dampen = crm_get_msec(dvalue);
if (dampen >= 0) {
if (a->timeout_ms != dampen) {
mainloop_timer_stop(a->timer);
mainloop_timer_del(a->timer);
a->timeout_ms = dampen;
if (dampen > 0) {
a->timer = mainloop_timer_add(a->id, a->timeout_ms, FALSE, attribute_timer_cb, a);
crm_info("Update attribute %s with delay %dms (%s)", a->id, dampen, dvalue);
} else {
a->timer = NULL;
crm_info("Update attribute %s with not delay", a->id);
}
//if dampen is changed, attrd writes in a current value immediately.
write_or_elect_attribute(a);
if (safe_str_eq(op, ATTRD_OP_UPDATE_DELAY)) {
return;
}
} else {
if (safe_str_eq(op, ATTRD_OP_UPDATE_DELAY)) {
crm_trace("Unchanged attribute %s with delay %dms (%s).(ATTRD_OP_UPDATE_DELAY)", a->id, dampen, dvalue);
return;
}
}
} else {
crm_warn("Update error (A positive number is necessary for delay parameter. attribute %s : %dms (%s))", a->id, dampen, dvalue);
return;
}
} else {
crm_warn("Update error (delay parameter is necessary for the update of the attribute %s)", a->id);
return;
}
}

if(host == NULL) {
Expand Down Expand Up @@ -694,7 +765,6 @@ attrd_peer_update(crm_node_t *peer, xmlNode *xml, const char *host, bool filter)
v->current = NULL;
}
changed = TRUE;

} else {
crm_trace("Unchanged %s[%s] from %s is %s", attr, host, peer->uname, value);
}
Expand Down
4 changes: 2 additions & 2 deletions attrd/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) 2013 Andrew Beekhof <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
Expand All @@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
Expand Down
19 changes: 17 additions & 2 deletions attrd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ attrd_ipc_dispatch(qb_ipcs_connection_t * c, void *data, size_t size)

op = crm_element_value(xml, F_ATTRD_TASK);

if (client->name == NULL) {
const char *value = crm_element_value(xml, F_ORIG);
client->name = crm_strdup_printf("%s.%d", value?value:"unknown", client->pid);
}

if (safe_str_eq(op, ATTRD_OP_PEER_REMOVE)) {
attrd_send_ack(client, id, flags);
attrd_client_peer_remove(client->name, xml);
Expand All @@ -234,6 +239,14 @@ attrd_ipc_dispatch(qb_ipcs_connection_t * c, void *data, size_t size)
attrd_send_ack(client, id, flags);
attrd_client_update(xml);

} else if (safe_str_eq(op, ATTRD_OP_UPDATE_BOTH)) {
attrd_send_ack(client, id, flags);
attrd_client_update(xml);

} else if (safe_str_eq(op, ATTRD_OP_UPDATE_DELAY)) {
attrd_send_ack(client, id, flags);
attrd_client_update(xml);

} else if (safe_str_eq(op, ATTRD_OP_REFRESH)) {
attrd_send_ack(client, id, flags);
attrd_client_refresh();
Expand Down Expand Up @@ -369,8 +382,10 @@ main(int argc, char **argv)

election_fini(writer);
crm_client_disconnect_all(ipcs);
qb_ipcs_destroy(ipcs);
g_hash_table_destroy(attributes);
if (ipcs) {
qb_ipcs_destroy(ipcs);
g_hash_table_destroy(attributes);
}

if (the_cib) {
the_cib->cmds->signoff(the_cib);
Expand Down
13 changes: 9 additions & 4 deletions cib/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ cib_process_request(xmlNode * request, gboolean force_synchronous, gboolean priv
"Forwarding %s operation for section %s to %s (origin=%s/%s/%s)",
op,
section ? section : "'all'",
host ? host : "master",
host ? host : cib_legacy_mode() ? "master" : "all",
originator ? originator : "local",
client_name, call_id);

Expand Down Expand Up @@ -1088,7 +1088,7 @@ cib_process_request(xmlNode * request, gboolean force_synchronous, gboolean priv

finished = time(NULL);
if (finished - now > 3) {
crm_trace("%s operation took %ds to complete", op, finished - now);
crm_trace("%s operation took %lds to complete", op, (long)(finished - now));
crm_write_blackbox(0, NULL);
}

Expand Down Expand Up @@ -1286,8 +1286,12 @@ cib_process_command(xmlNode * request, xmlNode ** reply, xmlNode ** cib_diff, gb
}

if (rc == pcmk_ok && is_not_set(call_options, cib_dryrun)) {
crm_trace("Activating %d %s %s", is_set(call_options, cib_zero_copy),
crm_element_value(current_cib, XML_ATTR_NUMUPDATES),
crm_element_value(result_cib, XML_ATTR_NUMUPDATES));
if(is_not_set(call_options, cib_zero_copy)) {
rc = activateCibXml(result_cib, config_changed, op);
crm_trace("Activated %d %s", rc, crm_element_value(current_cib, XML_ATTR_NUMUPDATES));
}

if (rc == pcmk_ok && cib_internal_config_changed(*cib_diff)) {
Expand Down Expand Up @@ -1326,15 +1330,16 @@ cib_process_command(xmlNode * request, xmlNode ** reply, xmlNode ** cib_diff, gb
output = result_cib;

} else {
crm_trace("Not activating %d %d %s", rc, is_set(call_options, cib_dryrun), crm_element_value(result_cib, XML_ATTR_NUMUPDATES));
if(is_not_set(call_options, cib_zero_copy)) {
free_xml(result_cib);
}
}

if ((call_options & cib_inhibit_notify) == 0) {
if ((call_options & (cib_inhibit_notify|cib_dryrun)) == 0) {
const char *client = crm_element_value(request, F_CIB_CLIENTNAME);

crm_trace("Sending notifications");
crm_trace("Sending notifications %d", is_set(call_options, cib_dryrun));
cib_diff_notify(call_options, client, call_id, op, input, rc, *cib_diff);
}

Expand Down
4 changes: 2 additions & 2 deletions cib/callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) 2004 Andrew Beekhof <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
Expand All @@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
Expand Down
Loading

0 comments on commit d5cd928

Please sign in to comment.