From 559483a5279c98b67879b940662841b1d4de4a7af78f802938728aeca8bebe70 Mon Sep 17 00:00:00 2001
From: Yan Gao <ygao@suse.com>
Date: Tue, 7 Mar 2017 00:32:46 +0000
Subject: [PATCH] Accepting request 477365 from
 home:yan_gao:branches:network:ha-clustering:Factory:Test

- Build: lrmd: Include libxml/tree.h in lrmd.h
  * pacemaker-lrmd.h-include-libxml.patch

- libfencing,fencing: properly remap "action" in configuration
- libservices: ensure recurring actions table is created before using
- libservices: improve error messages when creating operation
- libservices: properly detect in-flight systemd/upstart ops when kicking
- libservices: properly cancel in-flight systemd/upstart op
- libservices: handle in-flight case first when cancelling an operation
- libservices: prevent use-after-free when freeing an operation
- libservices: ensure completed ops aren't on blocked ops list
- libcrmcommon: assert if can't generate operation key
- libcrmcommon: improve remote connection polling messages
- crmd: clear failure only for requested node
- crmd: improve message when clearing failures
- pengine,libpe_status: make failcount clearing messages more helpful
- pengine,libpe_status: don't clear same fail-count twice
- cib: properly mark variable as volatile
- libcib: avoid memory leak in query_node_uuid()
- tools: avoid NULL dereference in crm_resource debug message
- cib,libcrmcommon,lrmd: handle IP addresses better in messages
- tools: crm_attribute should prefer node name from environment
- libcrmcommon: Correctly delete XML comments according to their positions (bsc#1024037)
- libcrmcommon: Correctly compare XML comments to prevent crmd from getting into infinite election loop (bsc#1024037)
- crmd,libcrmcluster: minor log message improvements
- tools: avoid deprecated function in notifyServicelogEvent
- libcrmcommon,pengine,tools: pass local node name to resource agents
- use callback instead of sync call
- libcib: make querying node uuid more efficient
- tools: allow regular expression with crm_attribute

OBS-URL: https://build.opensuse.org/request/show/477365
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=260
---
 _service                                      |   6 +-
 ...1015842_pacemaker-NodeUtilization-RA.patch | 177 +++++++++---------
 pacemaker-1.1.15+git20161104.b6f251a.tar.bz2  |   3 -
 pacemaker-1.1.16+git20170302.a7825f4.tar.bz2  |   3 +
 pacemaker-configure-systemd-detection.patch   | 106 -----------
 pacemaker-lrmd.h-include-libxml.patch         |  29 +++
 pacemaker.changes                             | 110 +++++++++++
 pacemaker.spec                                |  26 ++-
 8 files changed, 251 insertions(+), 209 deletions(-)
 rename pacemaker-NodeUtilization-RA.patch => bug-1015842_pacemaker-NodeUtilization-RA.patch (54%)
 delete mode 100644 pacemaker-1.1.15+git20161104.b6f251a.tar.bz2
 create mode 100644 pacemaker-1.1.16+git20170302.a7825f4.tar.bz2
 delete mode 100644 pacemaker-configure-systemd-detection.patch
 create mode 100644 pacemaker-lrmd.h-include-libxml.patch

diff --git a/_service b/_service
index 71f396f..b6ec5f4 100644
--- a/_service
+++ b/_service
@@ -8,10 +8,10 @@
     To update to a new release, change "revision" to the desired
     git commit hash and bump "version" if necessary
 
-    <param name="version">1.1.15</param>
+    <param name="version">1.1.16</param>
 -->
-    <param name="versionformat">1.1.15+git%cd.%h</param>
-    <param name="revision">b6f251a13fadca0cb74702b0c007a55275c8ea09</param>
+    <param name="versionformat">1.1.16+git%cd.%h</param>
+    <param name="revision">a7825f4f0a8db272d1ce0b1f93e8044cbcaa5144</param>
   </service>
 
   <service name="recompress" mode="disabled">
diff --git a/pacemaker-NodeUtilization-RA.patch b/bug-1015842_pacemaker-NodeUtilization-RA.patch
similarity index 54%
rename from pacemaker-NodeUtilization-RA.patch
rename to bug-1015842_pacemaker-NodeUtilization-RA.patch
index c7eebd6..94bc464 100644
--- a/pacemaker-NodeUtilization-RA.patch
+++ b/bug-1015842_pacemaker-NodeUtilization-RA.patch
@@ -1,13 +1,17 @@
-commit 41ae609accd114bc5d4a05a74a80d3213d217373
-Author: Dejan Muhamedagic <dejan@suse.de>
-Date:   Fri Nov 25 13:11:15 2011 +0100
+From ab4df57e195486ee651f56793470d421233a0896 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
+Date: Thu, 2 Feb 2017 09:06:00 +0100
+Subject: [PATCH] Medium: NodeUtilization: Add NodeUtilization agent
 
-    Medium: RA: add NodeUtilization RA
+---
+ extra/resources/Makefile.am     |   1 +
+ extra/resources/NodeUtilization | 224 ++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 225 insertions(+)
+ create mode 100644 extra/resources/NodeUtilization
 
-Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/Makefile.am
-===================================================================
---- pacemaker-1.1.15+git20161018.722276c.orig/extra/resources/Makefile.am
-+++ pacemaker-1.1.15+git20161018.722276c/extra/resources/Makefile.am
+diff --git a/extra/resources/Makefile.am b/extra/resources/Makefile.am
+--- a/extra/resources/Makefile.am
++++ b/extra/resources/Makefile.am
 @@ -38,7 +38,8 @@ ocf_SCRIPTS	     =  ClusterMon 	\
  			SysInfo		\
  			SystemHealth \
@@ -18,17 +22,19 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/Makefile.am
  
  isolationtech_SCRIPTS	= docker-wrapper
  
-Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
-===================================================================
+diff --git a/extra/resources/NodeUtilization b/extra/resources/NodeUtilization
+new file mode 100644
+index 0000000..da5fb56
 --- /dev/null
-+++ pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
-@@ -0,0 +1,230 @@
++++ b/extra/resources/NodeUtilization
+@@ -0,0 +1,224 @@
 +#!/bin/sh
 +#
 +#
 +#	NodeUtilization OCF Resource Agent
 +#
 +# Copyright (c) 2011 SUSE LINUX, John Shi
++# Copyright (c) 2016 SUSE LINUX, Kristoffer Gronlund
 +#                    All Rights Reserved.
 +#
 +# This program is free software; you can redistribute it and/or modify
@@ -53,13 +59,12 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
 +#######################################################################
 +# Initialization:
 +
-+: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
-+. ${OCF_FUNCTIONS}
-+: ${__OCF_ACTION=$1}
++: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
++. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
 +
 +#######################################################################
 +
-+meta_data() {
++NodeUtilization_meta_data() {
 +	cat <<END
 +<?xml version="1.0"?>
 +<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
@@ -67,56 +72,59 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
 +<version>1.0</version>
 +
 +<longdesc lang="en">
-+This is an NodeUtilization Resource Agent.
-+This agent detects system parameters and put them into CIB by crm_attribute,
-+and it runs on every node as clone resource.
++The Node Utilization agent detects system parameters like available CPU, host
++memory and hypervisor memory availability, and adds them into the CIB for each
++node using crm_attribute. Run the agent as a clone resource to have it populate
++these parameters on each node.
++Note: Setting hv_memory only works with Xen at the moment, using the xl or xm
++command line tools.
 +</longdesc>
-+<shortdesc lang="en">NodeUtilization resource agent</shortdesc>
++<shortdesc lang="en">Node Utilization</shortdesc>
 +
 +<parameters>
 +<parameter name="dynamic" unique="0" required="0">
 +<longdesc lang="en">
-+If set, some of the HA parameters will be reset if there are
-+difference between HA parameters and system parameters when HA monitor.
-+Otherwise, the HA parameters will be set once when the resource instance starts.
++If set, parameters will be updated if there are differences between the HA
++parameters and the system values when running the monitor action.
++If not set, the parameters will be set once when the resource instance starts.
 +</longdesc>
-+<shortdesc lang="en">Set HA parameters when start or monitor</shortdesc>
++<shortdesc lang="en">Dynamically update parameters in monitor</shortdesc>
 +<content type="boolean" default="true" />
 +</parameter>
 +
 +<parameter name="utilization_cpu" unique="0" required="0">
-+<longdesc lang="en">Enable setting cpu utilization.</longdesc>
-+<shortdesc lang="en">Enable setting cpu utilization.</shortdesc>
++<longdesc lang="en">Enable setting node CPU utilization limit.</longdesc>
++<shortdesc lang="en">Set node CPU utilization limit.</shortdesc>
 +<content type="boolean" default="true" />
 +</parameter>
 +
 +<parameter name="utilization_cpu_reservation" unique="0" required="0">
-+<longdesc lang="en">CPU reserved for non-HA related usage.</longdesc>
-+<shortdesc lang="en">CPU reserved for non-HA related usage.</shortdesc>
++<longdesc lang="en">Subtract this value when setting the CPU utilization parameter.</longdesc>
++<shortdesc lang="en">CPU reservation.</shortdesc>
 +<content type="integer" default="1" />
 +</parameter>
 +
 +<parameter name="utilization_host_memory" unique="0" required="0">
-+<longdesc lang="en">Enable setting memory utilization of host.</longdesc>
-+<shortdesc lang="en">Enable setting memory utilization of host.</shortdesc>
++<longdesc lang="en">Enable setting available host memory.</longdesc>
++<shortdesc lang="en">Set available host memory.</shortdesc>
 +<content type="boolean" default="true" />
 +</parameter>
 +
 +<parameter name="utilization_host_memory_reservation" unique="0" required="0">
-+<longdesc lang="en">Memory reserved for other services inside host, in MB.</longdesc>
-+<shortdesc lang="en">Memory reserved for other services inside host, in MB.</shortdesc>
++<longdesc lang="en">Subtract this value when setting host memory utilization, in MB.</longdesc>
++<shortdesc lang="en">Host memory reservation, in MB.</shortdesc>
 +<content type="integer" default="512" />
 +</parameter>
 +
 +<parameter name="utilization_hv_memory" unique="0" required="0">
-+<longdesc lang="en">Enable setting the memory utilization of hypervisor.</longdesc>
-+<shortdesc lang="en">Enable setting the memory utilization of hypervisor.</shortdesc>
++<longdesc lang="en">Enable setting available hypervisor memory.</longdesc>
++<shortdesc lang="en">Set available hypervisor memory.</shortdesc>
 +<content type="boolean" default="true" />
 +</parameter>
 +
 +<parameter name="utilization_hv_memory_reservation" unique="0" required="0">
-+<longdesc lang="en">Memory reserved for the hypervisor, in MB.</longdesc>
-+<shortdesc lang="en">Memory reserved for the hypervisor, in MB.</shortdesc>
++<longdesc lang="en">Subtract this value when setting hypervisor memory utilization, in MB.</longdesc>
++<shortdesc lang="en">Hypervisor memory reservation, in MB.</shortdesc>
 +<content type="integer" default="512" />
 +</parameter>
 +</parameters>
@@ -132,8 +140,22 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
 +END
 +}
 +
++Host_Total_Memory() {
++    local xentool
++
++    xentool=$(which xl 2> /dev/null || which xm 2> /dev/null)
++
++    if [ -x $xentool ]; then
++        $xentool info | awk '/total_memory/{printf("%d\n",$3);exit(0)}'
++    else
++        ocf_log warn "Can only set hv_memory for Xen hypervisor"
++        echo "0"
++    fi
++}
++
++
 +set_utilization() {
-+    host_name="$(hostname)"
++    host_name="$(ocf_local_nodename)"
 +
 +    if ocf_is_true "$OCF_RESKEY_utilization_cpu"; then
 +        sys_cpu=$(( $(grep -c processor /proc/cpuinfo) - $OCF_RESKEY_utilization_cpu_reservation ))
@@ -141,7 +163,7 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
 +
 +        if [ "$sys_cpu" != "$uti_cpu" ]; then
 +            if ! crm_attribute -t nodes -U "$host_name" -z -n cpu -v $sys_cpu; then
-+                ocf_log err "Failed to set cpu of utilization by crm_attribute."
++                ocf_log err "Failed to set the cpu utilization attribute for $host_name using crm_attribute."
 +                return 1
 +            fi
 +        fi
@@ -153,29 +175,27 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
 +
 +        if [ "$sys_mem" != "$uti_mem" ]; then
 +            if ! crm_attribute -t nodes -U "$host_name" -z -n host_memory -v $sys_mem; then
-+                ocf_log err "Failed to set host_memory of utilization by crm_attribute."
++                ocf_log err "Failed to set the host_memory utilization attribute for $host_name using crm_attribute."
 +                return 1
 +            fi
 +        fi
 +    fi
 +
-+    if [ -x /usr/sbin/xm ]; then
-+        if ocf_is_true "$OCF_RESKEY_utilization_hv_memory"; then
-+            hv_mem=$(( $(xm info | awk '/total_memory/{printf("%d\n",$3);exit(0)}') - $OCF_RESKEY_utilization_hv_memory_reservation ))
-+            uti_mem=$(crm_attribute -Q -t nodes -U "$host_name" -z -n hv_memory 2>/dev/null)
++    if ocf_is_true "$OCF_RESKEY_utilization_hv_memory"; then
++        hv_mem=$(( $(Host_Total_Memory) - OCF_RESKEY_utilization_hv_memory_reservation ))
++        uti_mem=$(crm_attribute -Q -t nodes -U "$host_name" -z -n hv_memory 2>/dev/null)
 +
-+            if [ "$hv_mem" != "$uti_mem" ]; then
-+                if ! crm_attribute -t nodes -U "$host_name" -z -n hv_memory -v $hv_mem; then
-+                    ocf_log err "Failed to set hv_memory of utilization by crm_attribute."
-+                    return 1
-+                fi
++        if [ "$hv_mem" != "$uti_mem" ]; then
++            if ! crm_attribute -t nodes -U "$host_name" -z -n hv_memory -v $hv_mem; then
++                ocf_log err "Failed to set the hv_memory utilization attribute for $host_name using crm_attribute."
++                return 1
 +            fi
 +        fi
 +    fi
 +}
 +
 +NodeUtilization_usage() {
-+	cat <<END
++    cat <<END
 +usage: $0 {start|stop|monitor|validate-all|meta-data}
 +
 +Expects to have a fully populated OCF RA-compliant environment set.
@@ -183,10 +203,7 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
 +}
 +
 +NodeUtilization_start() {
-+    if ! touch "$OCF_RESKEY_pidfile"; then
-+        ocf_log err "Failed to touch pidfile: ${OCF_RESKEY_pidfile}."
-+        exit $OCF_ERR_GENERIC
-+    fi
++	ha_pseudo_resource $statefile start
 +    if ! ocf_is_true "$OCF_RESKEY_dynamic"; then
 +        if ! set_utilization; then
 +            exit $OCF_ERR_GENERIC
@@ -196,27 +213,32 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
 +}
 +
 +NodeUtilization_stop() {
-+    rm -f $OCF_RESKEY_pidfile
++	ha_pseudo_resource $statefile stop
 +    exit $OCF_SUCCESS
 +}
 +
 +NodeUtilization_monitor() {
-+    if [ ! -f $OCF_RESKEY_pidfile ]; then
-+        exit $OCF_NOT_RUNNING
-+    fi
++	local rc
++	ha_pseudo_resource $statefile monitor
++	rc=$?
 +
-+    if ocf_is_true "$OCF_RESKEY_dynamic"; then
-+        if ! set_utilization; then
-+            exit $OCF_ERR_GENERIC
-+        fi
-+    fi
-+    exit $OCF_SUCCESS
++	case $rc in
++		$OCF_SUCCESS)
++			if ocf_is_true "$OCF_RESKEY_dynamic"; then
++				if ! set_utilization; then
++					exit $OCF_ERR_GENERIC
++				fi
++			fi
++			;;
++		*) exit $rc;;
++	esac
 +}
 +
 +NodeUtilization_validate() {
 +    exit $OCF_SUCCESS
 +}
 +
++statefile=$OCF_RESOURCE_TYPE.$(echo $OCF_RESOURCE_INSTANCE | sed -e 's/^.*://')
 +
 +: ${OCF_RESKEY_pidfile:="$HA_VARRUN/NodeUtilization-${OCF_RESOURCE_INSTANCE}"}
 +: ${OCF_RESKEY_dynamic:="true"}
@@ -227,29 +249,6 @@ Index: pacemaker-1.1.15+git20161018.722276c/extra/resources/NodeUtilization
 +: ${OCF_RESKEY_utilization_host_memory:="true"}
 +: ${OCF_RESKEY_utilization_host_memory_reservation="512"}
 +
-+if [ $# -ne 1 ]; then
-+    NodeUtilization_usage
-+    exit $OCF_ERR_ARGS
-+fi
-+
-+case $__OCF_ACTION in
-+meta-data)	meta_data
-+		exit $OCF_SUCCESS
-+		;;
-+start)		NodeUtilization_start
-+		;;
-+stop)		NodeUtilization_stop
-+		;;
-+monitor)	NodeUtilization_monitor
-+		;;
-+validate-all)	NodeUtilization_validate
-+		;;
-+usage|help)	NodeUtilization_usage
-+		exit $OCF_SUCCESS
-+		;;
-+*)		NodeUtilization_usage
-+		exit $OCF_ERR_UNIMPLEMENTED
-+		;;
-+esac
-+
-+exit $?
++OCF_REQUIRED_PARAMS=""
++OCF_REQUIRED_BINARIES=""
++ocf_rarun $*
diff --git a/pacemaker-1.1.15+git20161104.b6f251a.tar.bz2 b/pacemaker-1.1.15+git20161104.b6f251a.tar.bz2
deleted file mode 100644
index 2bb826d..0000000
--- a/pacemaker-1.1.15+git20161104.b6f251a.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f3476a30b0e6b832497b383e32182ecb0a16e66cd7689e1c1f7f98a5ec9d2f26
-size 3584199
diff --git a/pacemaker-1.1.16+git20170302.a7825f4.tar.bz2 b/pacemaker-1.1.16+git20170302.a7825f4.tar.bz2
new file mode 100644
index 0000000..0462e85
--- /dev/null
+++ b/pacemaker-1.1.16+git20170302.a7825f4.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d30636bdece960e43b562392b4f461adbd2c213c83bc6fc88aed7c7217121994
+size 3602760
diff --git a/pacemaker-configure-systemd-detection.patch b/pacemaker-configure-systemd-detection.patch
deleted file mode 100644
index 15e3973..0000000
--- a/pacemaker-configure-systemd-detection.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-Index: pacemaker-1.1.15+git20161104.b6f251a/configure.ac
-===================================================================
---- pacemaker-1.1.15+git20161104.b6f251a.orig/configure.ac
-+++ pacemaker-1.1.15+git20161104.b6f251a/configure.ac
-@@ -1214,58 +1214,6 @@ AC_SUBST(DBUS_LIBS)
- 
- AC_CHECK_TYPES([DBusBasicValue],,,[[#include <dbus/dbus.h>]])
- 
--if test "x${enable_systemd}" != xno; then
--	if test $HAVE_dbus = 0; then
--		if test "x${enable_systemd}" = xyes; then
--			AC_MSG_FAILURE([cannot enable systemd without DBus])
--		else
--			enable_systemd=no
--		fi
--	fi
--	if test "x${enable_systemd}" = xtry; then
--		AC_MSG_CHECKING([for systemd version query result via dbus-send])
--		ret=$({ dbus-send --system --print-reply \
--		        --dest=org.freedesktop.systemd1 \
--		        /org/freedesktop/systemd1 \
--		        org.freedesktop.DBus.Properties.Get \
--		        string:org.freedesktop.systemd1.Manager \
--		        string:Version 2>/dev/null \
--		        || echo "this borked"; } | tail -n1)
--		# sanitize output a bit (interested just in value, not type),
--		# ret is intentionally unenquoted so as to normalize whitespace
--		ret=$(echo ${ret} | cut -d' ' -f2-)
--		AC_MSG_RESULT([${ret}])
--		if test "x${ret}" != xborked \
--		   || systemctl --version 2>/dev/null | grep -q systemd; then
--			enable_systemd=yes
--		else
--			enable_systemd=no
--		fi
--	fi
--fi
--
--AC_MSG_CHECKING([whether to enable support for managing resources via systemd])
--AC_MSG_RESULT([${enable_systemd}])
--if test "x${enable_systemd}" = xyes; then
--	HAVE_systemd=1
--	PCMK_FEATURES="$PCMK_FEATURES systemd"
--
--	AC_MSG_CHECKING([for systemd path for system unit files])
--	systemdunitdir="${systemdunitdir:}"
--	PKG_CHECK_VAR([systemdunitdir], [systemd],
--		      [systemdsystemunitdir], [],[
--	   systemdunitdir=no
--	])
--	AC_MSG_RESULT([${systemdunitdir}])
--	if test "x${systemdunitdir}" = xno; then
--		AC_MSG_FAILURE([cannot enable systemd when systemdunitdir unresolved])
--	fi
--fi
--
--AC_DEFINE_UNQUOTED(SUPPORT_SYSTEMD, $HAVE_systemd, Support systemd based system services)
--AM_CONDITIONAL(BUILD_SYSTEMD, test $HAVE_systemd = 1)
--AC_SUBST(SUPPORT_SYSTEMD)
--
- if test "x${enable_upstart}" != xno; then
- 	if test $HAVE_dbus = 0; then
- 		if test "x${enable_upstart}" = xyes; then
-@@ -1303,6 +1251,42 @@ AC_DEFINE_UNQUOTED(SUPPORT_UPSTART, $HAV
- AM_CONDITIONAL(BUILD_UPSTART, test $HAVE_upstart = 1)
- AC_SUBST(SUPPORT_UPSTART)
- 
-+if test "x${enable_systemd}" != xno; then
-+	if test $HAVE_dbus = 0; then
-+		if test "x${enable_systemd}" = xyes; then
-+			AC_MSG_FAILURE([cannot enable systemd without DBus])
-+		else
-+			enable_systemd=no
-+		fi
-+	else
-+		AC_MSG_CHECKING([for systemd path for system unit files])
-+		PKG_CHECK_VAR([systemdunitdir], [systemd], [systemdsystemunitdir], [
-+		   AC_MSG_RESULT([${systemdunitdir}])
-+		],[
-+		   AC_MSG_RESULT([not found])
-+		   systemdunitdir=no
-+		])
-+		if test "x${systemdunitdir}" = xno; then
-+			if test "x${enable_systemd}" = xyes; then
-+				AC_MSG_FAILURE([cannot enable systemd when systemdunitdir unresolved])
-+			fi
-+		        enable_systemd=no
-+		else
-+		        enable_systemd=yes
-+		fi
-+	fi
-+fi
-+
-+AC_MSG_CHECKING([whether to enable support for managing resources via systemd])
-+AC_MSG_RESULT([${enable_systemd}])
-+if test "x${enable_systemd}" = xyes; then
-+	HAVE_systemd=1
-+	PCMK_FEATURES="$PCMK_FEATURES systemd"
-+fi
-+
-+AC_DEFINE_UNQUOTED(SUPPORT_SYSTEMD, $HAVE_systemd, Support systemd based system services)
-+AM_CONDITIONAL(BUILD_SYSTEMD, test $HAVE_systemd = 1)
-+AC_SUBST(SUPPORT_SYSTEMD)
- 
- case $SUPPORT_NAGIOS in
-      1|yes|true|try)
diff --git a/pacemaker-lrmd.h-include-libxml.patch b/pacemaker-lrmd.h-include-libxml.patch
new file mode 100644
index 0000000..eff9da9
--- /dev/null
+++ b/pacemaker-lrmd.h-include-libxml.patch
@@ -0,0 +1,29 @@
+commit 6a9c3c80245f6fd84433e0c1c65c63b4f576350e
+Author: Gao,Yan <ygao@suse.com>
+Date:   Tue Mar 7 00:23:03 2017 +0100
+
+    Build: lrmd: Include libxml/tree.h in lrmd.h
+    
+    65d0b80 introduced "xmlNode *versioned_params" in lrmd_event_data_t but
+    without including libxml/tree.h in lrmd.h.
+    
+    Sbd failed to build against it:
+    
+    In file included from /usr/include/pacemaker/crm/common/util.h:33:0,
+                     from sbd-inquisitor.c:19:
+    /usr/include/pacemaker/crm/lrmd.h:241:5: error: unknown type name ‘xmlNode’
+         xmlNode *versioned_params;
+         ^
+
+diff --git a/include/crm/lrmd.h b/include/crm/lrmd.h
+index 446b39c..6f829f7 100644
+--- a/include/crm/lrmd.h
++++ b/include/crm/lrmd.h
+@@ -23,6 +23,7 @@
+  * \ingroup lrmd
+  */
+ #include <stdbool.h>
++#include <libxml/tree.h>
+ #include <crm/services.h>
+ 
+ #ifndef LRMD__H
diff --git a/pacemaker.changes b/pacemaker.changes
index 6e2f109..51ea242 100644
--- a/pacemaker.changes
+++ b/pacemaker.changes
@@ -1,3 +1,113 @@
+-------------------------------------------------------------------
+Tue Mar  7 00:01:15 UTC 2017 - ygao@suse.com
+
+- Build: lrmd: Include libxml/tree.h in lrmd.h
+  * pacemaker-lrmd.h-include-libxml.patch
+
+-------------------------------------------------------------------
+Mon Mar  6 22:58:46 UTC 2017 - ygao@suse.com
+
+- libfencing,fencing: properly remap "action" in configuration
+- libservices: ensure recurring actions table is created before using
+- libservices: improve error messages when creating operation
+- libservices: properly detect in-flight systemd/upstart ops when kicking
+- libservices: properly cancel in-flight systemd/upstart op
+- libservices: handle in-flight case first when cancelling an operation
+- libservices: prevent use-after-free when freeing an operation
+- libservices: ensure completed ops aren't on blocked ops list
+- libcrmcommon: assert if can't generate operation key
+- libcrmcommon: improve remote connection polling messages
+- crmd: clear failure only for requested node
+- crmd: improve message when clearing failures
+- pengine,libpe_status: make failcount clearing messages more helpful
+- pengine,libpe_status: don't clear same fail-count twice
+- cib: properly mark variable as volatile
+- libcib: avoid memory leak in query_node_uuid()
+- tools: avoid NULL dereference in crm_resource debug message
+- cib,libcrmcommon,lrmd: handle IP addresses better in messages
+- tools: crm_attribute should prefer node name from environment
+- libcrmcommon: Correctly delete XML comments according to their positions (bsc#1024037)
+- libcrmcommon: Correctly compare XML comments to prevent crmd from getting into infinite election loop (bsc#1024037)
+- crmd,libcrmcluster: minor log message improvements
+- tools: avoid deprecated function in notifyServicelogEvent
+- libcrmcommon,pengine,tools: pass local node name to resource agents
+- use callback instead of sync call
+- libcib: make querying node uuid more efficient
+- tools: allow regular expression with crm_attribute
+- attrd: support regular expressions in legacy attrd
+- attrd: support Pacemaker Remote node attributes in legacy attrd
+- use status scope to start node in standby mode
+- attrd: ignore unsupported requests in legacy attrd
+- attrd,crmd: implement peer remove requests in legacy attrd
+- crmd: don't clear remote node transient attributes unnecessarily
+- crm_mon: protect against non-standard or failing asctime
+- libservices(sync): partially prevent killing foreign process
+- libservices (sync): ensure no zombie is left behind
+- cib: improve re-sync handling
+- tools: implement crm_failcount command-line options correctly
+- tools: use correct regular expression for fail counts in crm_resource
+- cib: never disable legacy mode with corosync 1 stacks
+- cib: improve warning when legacy diff fails
+- libcrmcommon: ensure filename is not NULL before opening
+- crmd: be more resilient when checking an LRM command's "from"
+- crmd: improve crmd's LRM-related log messages
+- tools: properly ignore version with crm_diff --no-version (bsc#888726)
+- Ability to start node in standby
+- Upstream version cs: a7825f4f0a8db272d1ce0b1f93e8044cbcaa5144
+
+-------------------------------------------------------------------
+Mon Mar  6 13:04:16 UTC 2017 - ygao@suse.com
+
+- libservices: properly watch writable DBus handles
+- tools: don't reference hidden parameter in crm_resource help text
+- Alert: Set SNMP_PERSISTENT_DIR directory for the snmp-trap tool.
+- dbus: Prevent lrmd from hanging on dbus calls (bsc#1015264)
+- spec: add %check to run a subset of tests on rpmbuild
+- crmd: update cache status for guest node whose host is fenced
+- pengine: consider guest node unclean if its host is unclean
+- pengine: create a pseudo-fence for guest node recovery
+- pengine: guest node fencing doesn't require stonith enabled
+- pengine: remove unnecessary assert
+- mcp: Correction of the difference in access permission setting.
+- stonith_admin: Addition of the list-targets option.
+- stonith: Check for missing params in new device and dup
+- libservices: treat systemd service reloading as OK
+- crmd: increase severity when fencing didn't happen (bsc#1011240)
+- rng: Create resources-2.7.rng to update template class validation
+- libcrmcommon: Don't report error if the output file isn't syncable
+- crmd: bump feature set
+- pengine: disable migration for versioned resources
+- add versioned parameters support
+- Upstream version cs: 2817a2081e9e70e7412f0d0a253495611afab55e
+
+-------------------------------------------------------------------
+Mon Mar  6 12:58:37 UTC 2017 - ygao@suse.com
+
+- wd: Fix to not compare NULL when environment variable is not set
+- mcp,pacemaker_remote: order after time-sync
+
+- configure: fix fouled parameter expansion
+  * Drop obsolete pacemaker-configure-systemd-detection.patch
+
+- xml: rng: Keep score-attribute{,-mangle} in the existing RelaxNG schema files for graceful upgrades
+- Upstream version cs: 94ff4df51a55cc30d01843ea11b3292bac755432 (Pacemaker-1.1.16)
+
+-------------------------------------------------------------------
+Mon Mar  6 12:57:23 UTC 2017 - ygao@suse.com
+
+- RA: NodeUtilization - Use xl if available (bsc#1015842)
+  * bug-1015842_pacemaker-NodeUtilization-RA.patch
+
+-------------------------------------------------------------------
+Mon Mar  6 12:53:50 UTC 2017 - ygao@suse.com
+
+- spec: Prevent overwriting existing sysconfig files by conditionally running %fillup_only (bsc#1022807)
+
+-------------------------------------------------------------------
+Mon Mar  6 12:52:25 UTC 2017 - ygao@suse.com
+
+- spec: cts brings an RA that needs python-systemd
+
 -------------------------------------------------------------------
 Wed Feb 22 15:39:36 UTC 2017 - dimstar@opensuse.org
 
diff --git a/pacemaker.spec b/pacemaker.spec
index 475363d..196f44a 100644
--- a/pacemaker.spec
+++ b/pacemaker.spec
@@ -47,20 +47,21 @@
 %bcond_with doc
 
 Name:           pacemaker
-Version:        1.1.15+git20161104.b6f251a
+Version:        1.1.16+git20170302.a7825f4
 Release:        0
 Summary:        Scalable High-Availability cluster resource manager
-# AGPL-3.0 licensed extra/clustermon.sh is not present in the binary
 License:        GPL-2.0 and GPL-2.0+ and LGPL-2.1+
 Group:          Productivity/Clustering/HA
+# AGPL-3.0 licensed extra/clustermon.sh is not present in the binary
 Url:            http://www.clusterlabs.org
-# eg. https://github.com/ClusterLabs/pacemaker/archive/8ae45302394b039fb098e150f156df29fc0cb576/pacemaker-8ae4530.tar.gz
+# Hint: use "spectool -s 0 pacemaker.spec" (rpmdevtools) to check the final URL:
+# https://github.com/ClusterLabs/pacemaker/archive/e91769e5a39f5cb2f7b097d3c612368f0530535e/pacemaker-e91769e.tar.gz
 Source0:        %{name}-%{version}.tar.bz2
 Source1:        crm_report.in
 Source100:      pacemaker.rpmlintrc
 Patch1:         bug-806256_pacemaker-log-level-notice.patch
 Patch2:         bug-728579_pacemaker-stonith-dev-id.patch
-Patch3:         pacemaker-NodeUtilization-RA.patch
+Patch3:         bug-1015842_pacemaker-NodeUtilization-RA.patch
 Patch4:         pacemaker-cibsecret-tool-temp-disabled.patch
 Patch5:         pacemaker-nagios-plugin-dir.patch
 Patch6:         bug-812269_pacemaker-fencing-device-register-messages.patch
@@ -68,7 +69,7 @@ Patch7:         pacemaker-Wno-format-signedness.patch
 Patch8:         bug-943295_pacemaker-lrmd-log-notice.patch
 Patch9:         bug-977201_pacemaker-controld-self-fencing.patch
 Patch10:        bug-995365_pacemaker-cts-restart-systemd-journald.patch
-Patch11:        pacemaker-configure-systemd-detection.patch
+Patch11:        pacemaker-lrmd.h-include-libxml.patch
 # Required for core functionality
 BuildRequires:  autoconf
 BuildRequires:  automake
@@ -89,7 +90,8 @@ BuildRequires:  sed
 BuildRequires:  pkgconfig(bzip2)
 BuildRequires:  pkgconfig(corosync)
 BuildRequires:  pkgconfig(dbus-1)
-BuildRequires:  pkgconfig(glib-2.0)
+## version lower bound for: G_GNUC_INTERNAL
+BuildRequires:  pkgconfig(glib-2.0) >= 2.6
 BuildRequires:  pkgconfig(gnutls)
 BuildRequires:  pkgconfig(libexslt)
 # Pacemaker requires a minimum libqb functionality
@@ -248,11 +250,13 @@ manager for Corosync, CMAN and/or Linux-HA.
 The libpacemaker-devel package contains headers and shared libraries
 for developing tools for Pacemaker.
 
+# NOTE: can be noarch if lrmd_test is moved to another subpackage
 %package       cts
 Summary:        Test framework for cluster-related technologies
 Group:          Productivity/Clustering/HA
 Requires:       libpacemaker3 = %{version}-%{release}
 Requires:       python >= 2.6
+Requires:       python-systemd
 
 %description   cts
 Test framework for cluster-related technologies like Pacemaker
@@ -385,9 +389,15 @@ install -m 755 %{SOURCE1} %{buildroot}%{_sbindir}/crm_report
 %service_add_pre crm_mon.service
 
 %post cli
-%fillup_only pacemaker
+if [ ! -e %{_sysconfdir}/sysconfig/pacemaker ]; then
+    %fillup_only -n pacemaker
+fi
+
 %service_add_post crm_mon.service
-%fillup_only crm_mon
+
+if [ ! -e %{_sysconfdir}/sysconfig/crm_mon ]; then
+    %fillup_only -n crm_mon
+fi
 
 %preun cli
 %service_del_preun crm_mon.service