diff --git a/cts/README.md b/cts/README.md index 3f603c24f4..6436736bc7 100644 --- a/cts/README.md +++ b/cts/README.md @@ -1,284 +1,326 @@ # Pacemaker Cluster Test Suite (CTS) ## Purpose Pacemaker's CTS is primarily for developers and packagers of the Pacemaker source code, but it can be useful for users who wish to see how their cluster will react to various situations. CTS consists of two main parts: a set of regression tests for verifying the functionality of particular Pacemaker components, and a cluster exerciser for intensively testing the behavior of an entire working cluster. The primary regression test front end is cts-regression in this directory. Run it with the --help option to see its usage. The regression tests can be run on any single cluster node. The cluster should be stopped on that node when running the tests. The rest of this document focuses on the cluster exerciser. The cluster exerciser runs a randomized series of predefined tests on the cluster. CTS can be run against a pre-existing cluster configuration or overwrite the existing configuration with a test configuration. ## Requirements * Three or more machines (one test exerciser and two or more test cluster machines). * The test cluster machines should be on the same subnet and have journalling filesystems (ext3, ext4, xfs, etc.) for all of their filesystems other than /boot. You also need a number of free IP addresses on that subnet if you intend to test mutual IP address takeover. * The test exerciser machine doesn't need to be on the same subnet as the test cluster machines. Minimal demands are made on the exerciser machine - it just has to stay up during the tests. * It helps a lot in tracking problems if all machines' clocks are closely synchronized. NTP does this automatically, but you can do it by hand if you want. * The exerciser needs to be able to ssh over to the cluster nodes as root without a password challenge. Configure ssh accordingly (see the Mini-HOWTO at the end of this document for more details). * The exerciser needs to be able to resolve the machine names of the test cluster - either by DNS or by /etc/hosts. * CTS is not guaranteed to run on all platforms that pacemaker itself does. It calls commands such as service that may not be provided by all OSes. ## Preparation Install Pacemaker (including CTS) on all machines. These scripts are coordinated with particular versions of Pacemaker, so you need the same version of CTS as the rest of Pacemaker, and you need the same version of pacemaker and CTS on both the test exerciser and the test cluster machines. You can install CTS from source, although many distributions provide packages that include it (e.g. pacemaker-cts or pacemaker-dev). Typically, packages will install CTS as /usr/share/pacemaker/tests/cts. Configure cluster communications (Corosync) on the cluster machines and verify everything works. NOTE: Do not run the cluster on the test exerciser machine. NOTE: Wherever machine names are mentioned in these configuration files, they must match the machines' `uname -n` name. This may or may not match the machines' FQDN (fully qualified domain name) - it depends on how you (and your OS) have named the machines. ## Run CTS Now assuming you did all this, what you need to do is run CTSlab.py: python ./CTSlab.py [options] number-of-tests-to-run You must specify which nodes are part of the cluster with --nodes, e.g.: --node "pcmk-1 pcmk-2 pcmk-3" Most people will want to save the output with --outputfile, e.g.: --outputfile ~/cts.log Unless you want to test your pre-existing cluster configuration, you also want: --clobber-cib --populate-resources --test-ip-base $IP # e.g. --test-ip-base 192.168.9.100 and configure some sort of fencing: --stonith $TYPE # e.g. "--stonith xvm" to use fence_xvm or "--stonith ssh" to use external/ssh A complete command line might look like: python ./CTSlab.py --nodes "pcmk-1 pcmk-2 pcmk-3" --outputfile ~/cts.log \ --clobber-cib --populate-resources --test-ip-base 192.168.9.100 \ --stonith xvm 50 For more options, use the --help option. NOTE: Perhaps more convenient way to compile a command line like above is to use cluster_test script that, at least in the source repository, sits in the same directory as this very file. To extract the result of a particular test, run: crm_report -T $test ## Optional/advanced testing ### Memory testing Pacemaker and CTS have various options for testing memory management. On the cluster nodes, pacemaker components will use various environment variables to control these options. How these variables are set varies by OS, but usually they are set in the /etc/sysconfig/pacemaker or /etc/default/pacemaker file. Valgrind is a program for detecting memory management problems (such as use-after-free errors). If you have valgrind installed, you can enable it by setting the following environment variables on all cluster nodes: PCMK_valgrind_enabled=pacemaker-attrd,pacemaker-controld,pacemaker-execd,pacemaker-fenced,cib,pacemaker-schedulerd VALGRIND_OPTS="--leak-check=full --trace-children=no --num-callers=25 --log-file=/var/lib/pacemaker/valgrind-%p --suppressions=/usr/share/pacemaker/tests/valgrind-pcmk.suppressions --gen-suppressions=all" and running CTS with these options: --valgrind-tests --valgrind-procs="pacemaker-attrd pacemaker-controld pacemaker-execd cib pacemaker-schedulerd pacemaker-fenced" These options should only be set while specifically testing memory management, because they may slow down the cluster significantly, and they will disable writes to the CIB. If desired, you can enable valgrind on a subset of pacemaker components rather than all of them as listed above. Valgrind will put a text file for each process in the location specified by valgrind's --log-file option. For explanations of the messages valgrind generates, see http://valgrind.org/docs/manual/mc-manual.html Separately, if you are using the GNU C library, the G_SLICE, MALLOC_PERTURB_, and MALLOC_CHECK_ environment variables can be set to affect the library's memory management functions. When using valgrind, G_SLICE should be set to "always-malloc", which helps valgrind track memory by always using the malloc() and free() routines directly. When not using valgrind, G_SLICE can be left unset, or set to "debug-blocks", which enables the C library to catch many memory errors but may impact performance. If the MALLOC_PERTURB_ environment variable is set to an 8-bit integer, the C library will initialize all newly allocated bytes of memory to the integer value, and will set all newly freed bytes of memory to the bitwise inverse of the integer value. This helps catch uses of uninitialized or freed memory blocks that might otherwise go unnoticed. Example: MALLOC_PERTURB_=221 If the MALLOC_CHECK_ environment variable is set, the C library will check for certain heap corruption errors. The most useful value in testing is 3, which will cause the library to print a message to stderr and abort execution. Example: MALLOC_CHECK_=3 Valgrind should be enabled for either all nodes or none, but the C library variables may be set differently on different nodes. ### Remote node testing If the pacemaker-remoted daemon is installed on all cluster nodes, CTS will enable remote node tests. The remote node tests choose a random node, stop the cluster on it, start pacemaker-remoted on it, and add an ocf:pacemaker:remote resource to turn it into a remote node. When the test is done, CTS will turn the node back into a cluster node. To avoid conflicts, CTS will rename the node, prefixing the original node name with "remote-". For example, "pcmk-1" will become "remote-pcmk-1". The name change may require special stonith configuration, if the fence agent expects the node name to be the same as its hostname. A common approach is to specify the "remote-" names in pcmk_host_list. If you use pcmk_host_list=all, CTS will expand that to all cluster nodes and their "remote-" names. You may additionally need a pcmk_host_map argument to map the "remote-" names to the hostnames. Example: --stonith xvm --stonith-args \ pcmk_arg_map=domain:uname,pcmk_host_list=all,pcmk_host_map=remote-pcmk-1:pcmk-1;remote-pcmk-2:pcmk-2 ### Remote node testing with valgrind When running the remote node tests, the pacemaker components on the cluster nodes can be run under valgrind as described in the "Memory testing" section. However, pacemaker-remoted cannot be run under valgrind that way, because it is started by the OS's regular boot system and not by pacemaker. Details vary by system, but the goal is to set the VALGRIND_OPTS environment variable and then start pacemaker-remoted by prefixing it with the path to valgrind. The init script and systemd service file provided with pacemaker-remoted will load the pacemaker environment variables from the same location used by other pacemaker components, so VALGRIND_OPTS will be set correctly if using one of those. For an OS using systemd, you can override the ExecStart parameter to run valgrind. For example: mkdir /etc/systemd/system/pacemaker_remote.service.d cat >/etc/systemd/system/pacemaker_remote.service.d/valgrind.conf < + + +that may be left behind into more canonical: + + + +so manual editing is tasked, or perhaps `--format` or `--c14n` +to `xmllint` will be of help (without any other side effects). + +If the overall process gets stuck anywhere, common sense to the rescue. +The initial part of the above recipe can be repeated anytime to verify +there's nothing to upgrade artificially like this, which is a desired +state. Note that `regression.sh` script performs validation of both +the input and output, should the upgrade take place, implicitly, so +there's no need of revalidation in the happy case. diff --git a/xml/Readme.md b/xml/Readme.md index 6cd1aff512..73aa64f584 100644 --- a/xml/Readme.md +++ b/xml/Readme.md @@ -1,110 +1,122 @@ # Schema Reference Pacemaker's XML schema has a version of its own, independent of the version of Pacemaker itself. ## Versioned Schema Evolution A versioned schema offers transparent backward and forward compatibility. - It reflects the timeline of schema-backed features (introduction, changes to the syntax, possibly deprecation) through the versioned stable schema increments, while keeping schema versions used by default by older Pacemaker versions untouched. - Pacemaker internally uses the latest stable schema version, and relies on supplemental transformations to promote cluster configurations based on older, incompatible schema versions into the desired form. - It allows experimental features with a possibly unstable configuration interface to be developed using the special `next` version of the schema. ## Mapping Pacemaker Versions to Schema Versions | Pacemaker | Latest Schema | Changed | --------- | ------------- | ---------------------------------------------- | `2.0.0` | `3.0` | `constraints`, `resources` | `1.1.18` | `2.10` | `resources`, `alerts` | `1.1.17` | `2.9` | `resources`, `rule` | `1.1.16` | `2.6` | `constraints` | `1.1.15` | `2.5` | `alerts` | `1.1.14` | `2.4` | `fencing` | `1.1.13` | `2.3` | `constraints` | `1.1.12` | `2.0` | `nodes`, `nvset`, `resources`, `tags`, `acls` | `1.1.8`+ | `1.2` | ## Schema generation Each logical portion of the schema goes into its own RNG file, named like `${base}-${X}.${Y}.rng`. `${base}` identifies the portion of the schema (e.g. constraints, resources); ${X}.${Y} is the latest schema version that contained changes in this portion of the schema. The complete, overall schema, `pacemaker-${X}.${Y}.rng`, is automatically generated from the other files via the Makefile. # Updating schema files # ## Experimental features ## Experimental features go into `${base}-next.rng` where `${base}` is the affected portion of the schema. If such a file does not already exist, create it by copying the most recent `${base}-${X}.${Y}.rng`. Pacemaker will not use the experimental schema by default; the cluster administrator must explicitly set the `validate-with` property appropriately to use it. ## Stable features ## The current stable version is determined at runtime when crm_schema_init() scans the CRM_SCHEMA_DIRECTORY. It will have the form `pacemaker-${X}.${Y}` and the highest `${X}.${Y}` wins. ### Simple Additions When the new syntax is a simple addition to the previous one, create a new entry, incrementing `${Y}`. ### Feature Removal or otherwise Incompatible Changes When the new syntax is not a simple addition to the previous one, create a new entry, incrementing `${X}` and setting `${Y} = 0`. An XSLT file is also required that converts an old syntax to the new one and must be named `upgrade-${Xold}.${Yold}.xsl`. See `xml/upgrade-1.3.xsl` for an example. +Since `xml/upgrade-2.10.xsl`, rather self-descriptive approach is taken, +separating metadata of the replacements and other modifications to +perform from the actual executive parts, which is leveraged, e.g., with +the on-the-fly overview as obtained with `./regression.sh -X test2to3`. +Also this was the first time particular key names of `nvpair`s, +i.e. below the granularity of the schemas so far, received attention, +and consequently, no longer expected names became systemically banned +in the after-upgrade schemas, using `` construct in the +data type specification pertaining the affected XML path. + ### General Procedure 1. Copy the most recent version of `${base}-*.rng` to `${base}-${X}.${Y}.rng` 1. Commit the copy, e.g. `"Low: xml: clone ${base} schema in preparation for changes"`. This way, the actual change will be obvious in the commit history. 1. Modify `${base}-${X}.${Y}.rng` as required. 1. If required, add an XSLT file, and update `xslt_SCRIPTS` in `xml/Makefile.am`. 1. Commit 1. `make -C xml clean; make -C xml all` to rebuild the schemas in the local source directory. 1. The CIB validity regression tests will break after the schema is updated. Run `tools/regression.sh` to get the new output, `diff tools/regression.validity.{out,exp}` to ensure the changes look correct, `cp tools/regression.validity.{out,exp}` to update the expected output, then commit the change. +1. Similarly, with the new major version `${X}`, it's advisable to refresh + scheduler tests at some point, see the instructions in `cts/README.md`. ## Using a New Schema New features will not be available until the cluster administrator: 1. Updates all the nodes 1. Runs the equivalent of `cibadmin --upgrade --force` ## Random Notes From the source directory, run `make -C xml diff` to see the changes in the current schema (compared to the previous ones) and also the pending changes in `pacemaker-next`. Alternatively, if the intention is to grok the overall historical schema evolution, use `make -C xml fulldiff`. diff --git a/xml/regression.sh b/xml/regression.sh index 9cc8a4053e..3679b2c37c 100755 --- a/xml/regression.sh +++ b/xml/regression.sh @@ -1,571 +1,570 @@ #!/bin/sh # Copyright 2018 Red Hat, Inc. # Author: Jan Pokorny # Part of pacemaker project # SPDX-License-Identifier: GPL-2.0-or-later set -eu # $1=reference (can be '-' for stdin), $2=investigated # alt.: wdiff, colordiff, ... DIFF=${DIFF:-diff} DIFFOPTS=${DIFFOPTS--u} DIFFPAGER=${DIFFPAGER:-less -LRX} # $1=schema, $2=validated # alt.: jing -i RNGVALIDATOR=${RNGVALIDATOR:-xmllint --noout --relaxng} # $1=stylesheet, $2=source # alt.: Xalan, saxon (note: only validates reliably with -B) _xalan_wrapper() { { Xalan "$2" "$1" 2>&1 >&3 \ | sed -e '/^Source tree node.*$/d' \ -e 's|^XSLT message: \(.*\) (Occurred.*)|\1|'; } 3>&- 3>&1 >&2 } # filtered out message: https://bugzilla.redhat.com/show_bug.cgi?id=1577367 _saxon_wrapper() { { saxon "-xsl:$1" "-s:$2" -versionmsg:off 2>&1 >&3 \ | sed -e '/^Cannot find CatalogManager.properties$/d'; } 3>&- 3>&1 >&2 } -#_xalan_wrapper() { Xalan $2 $1; } XSLTPROCESSOR=${XSLTPROCESSOR:-xsltproc} test "${XSLTPROCESSOR}" != Xalan || XSLTPROCESSOR=_xalan_wrapper test "${XSLTPROCESSOR}" != saxon || XSLTPROCESSOR=_saxon_wrapper tests= # test* names (should go first) here will become preselected default # # commons # emit_result() { _er_howmany=${1:?} # how many errors (0/anything else incl. strings) _er_subject=${2:?} _er_prefix=${3-} test -z "${_er_prefix}" || _er_prefix="${_er_prefix}: " if test "${_er_howmany}" = 0; then printf "%s%s finished OK\n" "${_er_prefix}" "${_er_subject}" else printf "%s%s encountered ${_er_howmany} errors\n" \ "${_er_prefix}" "${_er_subject}" fi } emit_error() { _ee_msg=${1:?} printf "%s\n" "${_ee_msg}" >&2 } # returns 1 + floor of base 2 logaritm for _lo0r_i in 1...255, # or 0 for _lo0r_i = 0 log2_or_0_return() { _lo0r_i=${1:?} return $(((!(_lo0r_i >> 1) && _lo0r_i) * 1 \ + (!(_lo0r_i >> 2) && _lo0r_i & (1 << 1)) * 2 \ + (!(_lo0r_i >> 3) && _lo0r_i & (1 << 2)) * 3 \ + (!(_lo0r_i >> 4) && _lo0r_i & (1 << 3)) * 4 \ + (!(_lo0r_i >> 5) && _lo0r_i & (1 << 4)) * 5 \ + (!(_lo0r_i >> 6) && _lo0r_i & (1 << 5)) * 6 \ + (!(_lo0r_i >> 7) && _lo0r_i & (1 << 6)) * 7 \ + !!(_lo0r_i >> 7) * 7 )) } # rough addition of two base 2 logarithms log2_or_0_add() { _lo0a_op1=${1:?} _lo0a_op2=${2:?} if test ${_lo0a_op1} -gt ${_lo0a_op2}; then return ${_lo0a_op1} elif test ${_lo0a_op2} -gt ${_lo0a_op1}; then return ${_lo0a_op2} elif test ${_lo0a_op1} -gt 0; then return $((_lo0a_op1 + 1)) else return ${_lo0a_op1} fi } # # test phases # # -r ... whether to remove referential files as well # stdin: input file per line test_cleaner() { _tc_cleanref=0 while test $# -gt 0; do case "$1" in -r) _tc_cleanref=1;; esac shift done while read _tc_origin; do _tc_origin=${_tc_origin%.*} rm -f "${_tc_origin}.up" "${_tc_origin}.up.err" rm -f "$(dirname "${_tc_origin}")/.$(basename "${_tc_origin}").up" test ${_tc_cleanref} -eq 0 \ || rm -f "${_tc_origin}.ref" "${_tc_origin}.ref.err" done } test_selfcheck() { _tsc_template= _tsc_validator= while test $# -gt 0; do case "$1" in -o=*) _tsc_template="${1#-o=}";; esac shift done _tsc_validator="${_tsc_template:?}" _tsc_validator="cibtr-${_tsc_validator%%.*}.rng" _tsc_template="upgrade-${_tsc_template}.xsl" # check schema (sub-grammar) for custom transformation mapping alone ${RNGVALIDATOR} 'http://relaxng.org/relaxng.rng' "${_tsc_validator}" # check the overall XSLT per the main grammar + said sub-grammar ${RNGVALIDATOR} "xslt_${_tsc_validator}" "${_tsc_template}" } test_explanation() { _tsc_template= while test $# -gt 0; do case "$1" in -o=*) _tsc_template="upgrade-${1#-o=}.xsl";; esac shift done ${XSLTPROCESSOR} upgrade-detail.xsl "${_tsc_template}" } # stdout: filename of the transformed file test_runner_upgrade() { _tru_template=${1:?} _tru_source=${2:?} # filename _tru_mode=${3:?} # extra modes wrt. "referential" outcome, see below _tru_ref="${_tru_source%.*}.ref" { test "$((_tru_mode & (1 << 0)))" -ne 0 \ || test -f "${_tru_ref}.err"; } \ && _tru_ref_err="${_tru_ref}.err" || _tru_ref_err=/dev/null _tru_target="${_tru_source%.*}.up" _tru_target_err="${_tru_target}.err" if test $((_tru_mode & (1 << 2))) -eq 0; then ${XSLTPROCESSOR} "${_tru_template}" "${_tru_source}" \ > "${_tru_target}" 2> "${_tru_target_err}" \ || { _tru_ref=$?; echo "${_tru_target_err}" return ${_tru_ref}; } else # when -B (deblanked outcomes handling) requested, we: # - drop blanks from the source XML # (effectively emulating pacemaker handling) # - re-drop blanks from the XSLT outcome, # which is compared with referential outcome # processed with even greedier custom deblanking # (extraneous inter-element whitespace like blank # lines will not get removed otherwise, see lower) xmllint --noblanks "${_tru_source}" \ | ${XSLTPROCESSOR} "${_tru_template}" - \ > "${_tru_target}" 2> "${_tru_target_err}" \ || { _tru_ref=$?; echo "${_tru_target_err}" return ${_tru_ref}; } # reusing variable no longer needed _tru_template="$(dirname "${_tru_target}")" _tru_template="${_tru_template}/.$(basename "${_tru_target}")" mv "${_tru_target}" "${_tru_template}" ${XSLTPROCESSOR} - "${_tru_template}" > "${_tru_target}" <<-EOF EOF fi # only respond with the flags except for "-B", i.e., when both: # - _tru_mode non-zero # - "-B" in _tru_mode is zero (hence non-zero when flipped with XOR) if test "$((_tru_mode * ((_tru_mode ^ (1 << 2)) & (1 << 2))))" -ne 0; then if test $((_tru_mode & (1 << 0))) -ne 0; then cp -a "${_tru_target}" "${_tru_ref}" cp -a "${_tru_target_err}" "${_tru_ref_err}" fi if test $((_tru_mode & (1 << 1))) -ne 0; then "${DIFF}" ${DIFFOPTS} "${_tru_source}" "${_tru_ref}" \ | ${DIFFPAGER} >&2 if test $? -ne 0; then printf "\npager failure\n" >&2 return 1 fi printf '\nIs comparison OK? ' >&2 if read _tru_answer &2; return 1;; esac else return 1 fi fi elif test -f "${_tru_ref}" && test -e "${_tru_ref_err}"; then { test "$((_tru_mode & (1 << 2)))" -eq 0 && cat "${_tru_ref}" \ || ${XSLTPROCESSOR} - "${_tru_ref}" <<-EOF EOF } \ | "${DIFF}" ${DIFFOPTS} - "${_tru_target}" >&2 \ && "${DIFF}" ${DIFFOPTS} "${_tru_ref_err}" \ "${_tru_target_err}" >&2 if test $? -ne 0; then emit_error "Outputs differ from referential ones" echo "/dev/null" return 1 fi else emit_error "Referential file(s) missing: ${_tru_ref}" echo "/dev/null" return 1 fi echo "${_tru_target}" } test_runner_validate() { _trv_schema=${1:?} _trv_target=${2:?} # filename if ! ${RNGVALIDATOR} "${_trv_schema}" "${_trv_target}" \ 2>/dev/null; then ${RNGVALIDATOR} "${_trv_schema}" "${_trv_target}" fi } # -o= ... which conventional version to deem as the transform origin # -t= ... which conventional version to deem as the transform target # -B # -D # -G ... see usage # stdin: input file per line test_runner() { _tr_mode=0 _tr_ret=0 _tr_schema_o= _tr_schema_t= _tr_target= _tr_template= while test $# -gt 0; do case "$1" in -o=*) _tr_template="upgrade-${1#-o=}.xsl" _tr_schema_o="pacemaker-${1#-o=}.rng";; -t=*) _tr_schema_t="pacemaker-${1#-t=}.rng";; -G) _tr_mode=$((_tr_mode | (1 << 0)));; -D) _tr_mode=$((_tr_mode | (1 << 1)));; -B) _tr_mode=$((_tr_mode | (1 << 2)));; esac shift done if ! test -f "${_tr_schema_o:?}" || ! test -f "${_tr_schema_t:?}"; then emit_error "Origin and/or target schema missing, rerun make" return 1 fi while read _tr_origin; do printf '%-60s' "${_tr_origin}... " # pre-validate if ! test_runner_validate "${_tr_schema_o}" "${_tr_origin}"; then _tr_ret=$((_tr_ret + 1)); echo "E:pre-validate"; continue fi # upgrade if ! _tr_target=$(test_runner_upgrade "${_tr_template}" \ "${_tr_origin}" "${_tr_mode}"); then _tr_ret=$((_tr_ret + 1)); test -n "${_tr_target}" || break echo "E:upgrade" test -s "${_tr_target}" \ && { echo ---; cat "${_tr_target}" || :; echo ---; } continue fi # post-validate if ! test_runner_validate "${_tr_schema_t}" "${_tr_target}"; then _tr_ret=$((_tr_ret + 1)); echo "E:post-validate"; continue fi echo "OK" done log2_or_0_return ${_tr_ret} } # # particular test variations # stdin: granular test specification(s) if any # test2to3() { _t23_pattern= while read _t23_spec; do _t23_spec=${_t23_spec%.xml} _t23_spec=${_t23_spec%\*} _t23_pattern="${_t23_pattern} -name ${_t23_spec}*.xml -o" done test -z "${_t23_pattern}" || _t23_pattern="( ${_t23_pattern%-o} )" find test-2 -name test-2 -o -type d -prune \ -o -name '*.xml' ${_t23_pattern} -print | env LC_ALL=C sort \ | { case " $* " in *\ -C\ *) test_cleaner;; *\ -S\ *) test_selfcheck -o=2.10;; *\ -X\ *) test_explanation -o=2.10;; *) test_runner -o=2.10 -t=3.0 "$@" || return $?;; esac; } } tests="${tests} test2to3" # -B # -D # -G ... see usage cts_scheduler() { _tcp_mode=0 _tcp_ret=0 _tcp_validatewith= _tcp_schema_o= _tcp_schema_t= _tcp_template= find ../cts/scheduler -name scheduler -o -type d -prune \ -o -name '*.xml' -print | env LC_ALL=C sort \ | { case " $* " in *\ -C\ *) test_cleaner -r;; *\ -S\ *) emit_result "not implemented" "option -S";; *\ -X\ *) emit_result "not implemented" "option -X";; *) while test $# -gt 0; do case "$1" in -G) _tcp_mode=$((_tcp_mode | (1 << 0)));; -D) _tcp_mode=$((_tcp_mode | (1 << 1)));; -B) _tcp_mode=$((_tcp_mode | (1 << 2)));; esac shift done while read _tcp_origin; do _tcp_validatewith=$(${XSLTPROCESSOR} - "${_tcp_origin}" <<-EOF EOF ) _tcp_schema_t=${_tcp_validatewith} case "${_tcp_validatewith}" in 1) _tcp_schema_o=1.3;; 2) _tcp_schema_o=2.10;; # only for gradual refinement as upgrade-2.10.xsl under # active development, move to 3.x when schema v4 emerges 3) _tcp_schema_o=2.10 _tcp_schema_t=2;; *) emit_error \ "need to skip ${_tcp_origin} (schema: ${_tcp_validatewith})" continue;; esac _tcp_template="upgrade-${_tcp_schema_o}.xsl" _tcp_schema_t="pacemaker-$((_tcp_schema_t + 1)).0.rng" test "${_tcp_schema_o%%.*}" = "${_tcp_validatewith}" \ && _tcp_schema_o="pacemaker-${_tcp_schema_o}.rng" \ || _tcp_schema_o="${_tcp_schema_t}" # pre-validate if test "${_tcp_schema_o}" != "${_tcp_schema_t}" \ && ! test_runner_validate "${_tcp_schema_o}" "${_tcp_origin}"; then _tcp_ret=$((_tcp_ret + 1)); echo "E:pre-validate"; continue fi # upgrade test "$((_tcp_mode & (1 << 0)))" -ne 0 \ || ln -fs "$(pwd)/${_tcp_origin}" "${_tcp_origin%.*}.ref" if ! _tcp_target=$(test_runner_upgrade "${_tcp_template}" \ "${_tcp_origin}" "${_tcp_mode}"); then _tcp_ret=$((_tcp_ret + 1)); test -n "${_tcp_target}" || break echo "E:upgrade" test -s "${_tcp_target}" \ && { echo ---; cat "${_tcp_target}" || :; echo ---; } continue fi test "$((_tcp_mode & (1 << 0)))" -ne 0 \ || rm -f "${_tcp_origin%.*}.ref" # post-validate if ! test_runner_validate "${_tcp_schema_t}" "${_tcp_target}"; then _tcp_ret=$((_tcp_ret + 1)); echo "E:post-validate"; continue fi test "$((_tcp_mode & (1 << 0)))" -eq 0 \ || mv "${_tcp_target}" "${_tcp_origin}" done; log2_or_0_return ${_tcp_ret};; esac; } } tests="${tests} cts_scheduler" # # "framework" # # option-likes ... options to be passed down # argument-likes ... drives a test selection test_suite() { _ts_pass= _ts_select= _ts_select_full= _ts_test_specs= _ts_global_ret=0 _ts_ret=0 while test $# -gt 0; do case "$1" in -) printf '%s\n' 'waiting for tests specified at stdin...'; while read _ts_spec; do _ts_select="${_ts_spec}@$1"; done;; -*) _ts_pass="${_ts_pass} $1";; *) _ts_select_full="${_ts_select_full}@$1" _ts_select="${_ts_select}@${1%%/*}";; esac shift done _ts_select="${_ts_select}@" _ts_select_full="${_ts_select_full}@" for _ts_test in ${tests}; do while true; do case "${_ts_select}" in *@${_ts_test}@*) _ts_select="${_ts_select%@${_ts_test}@*}"\ "@${_ts_select#*@${_ts_test}@}" break ;; @) case "${_ts_test}" in test*) break;; esac ;; esac continue 2 # move on to matching with next local test done _ts_test_specs= while true; do case "${_ts_select_full}" in *@${_ts_test}/*) _ts_test_full="${_ts_test}/${_ts_select_full#*@${_ts_test}/}" _ts_test_full="${_ts_test_full%%@*}" _ts_select_full="${_ts_select_full%@${_ts_test_full}@*}"\ "@${_ts_select_full#*@${_ts_test_full}@}" _ts_test_specs="${_ts_test_specs} ${_ts_test_full#*/}" ;; *) break ;; esac done for _ts_test_spec in ${_ts_test_specs}; do printf '%s\n' "${_ts_test_spec}" done | "${_ts_test}" ${_ts_pass} || _ts_ret=$? test ${_ts_ret} = 0 \ && emit_result ${_ts_ret} "${_ts_test}" \ || emit_result "at least 2^$((_ts_ret - 1))" "${_ts_test}" log2_or_0_add ${_ts_global_ret} ${_ts_ret} _ts_global_ret=$? done if test "${_ts_select}" != @; then emit_error "Non-existing test(s):$(echo "${_ts_select}" \ | tr '@' ' ')" log2_or_0_add ${_ts_global_ret} 1 || _ts_global_ret=$? fi return ${_ts_global_ret} } # NOTE: big letters are dedicated for per-test-set behaviour, # small ones for generic/global behaviour usage() { printf '%s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n' \ "usage: $0 [-{B,C,D,G,S,X}]* [-|{${tests## }}*]" \ "- when no suites (arguments) provided, \"test*\" ones get used" \ "- with '-' suite specification the actual ones grabbed on stdin" \ "- use '-B' to run validate-only check suppressing blanks first" \ "- use '-C' to only cleanup ephemeral byproducts" \ "- use '-D' to review originals vs. \"referential\" outcomes" \ "- use '-G' to generate \"referential\" outcomes" \ "- use '-S' for template self-check (requires net access)" \ "- use '-X' to show explanatory details about the upgrade" \ "- test specification can be granular, e.g. 'test2to3/022'" } main() { _main_pass= _main_bailout=0 _main_ret=0 while test $# -gt 0; do case "$1" in -h) usage; exit;; -C|-G|-S|-X) _main_bailout=1;; esac _main_pass="${_main_pass} $1" shift done test_suite ${_main_pass} || _main_ret=$? test ${_main_bailout} -eq 1 && return ${_main_ret} \ || test_suite -C ${_main_pass} >/dev/null || true test ${_main_ret} = 0 && emit_result ${_main_ret} "Overall suite" \ || emit_result "at least 2^$((_main_ret - 1))" "Overall suite" return ${_main_ret} } main "$@" diff --git a/xml/resources-3.0.rng b/xml/resources-3.0.rng index ff5eb7c959..3000b78208 100644 --- a/xml/resources-3.0.rng +++ b/xml/resources-3.0.rng @@ -1,404 +1,465 @@ + + + + + + + isolation + isolation-host + isolation-instance + isolation-wrapper + + + + + + pcmk_arg_map pcmk_list_cmd pcmk_monitor_cmd pcmk_off_cmd pcmk_on_cmd pcmk_reboot_cmd pcmk_status_cmd - + + + + + + + ([0-9\-]+) requires + + + + + + + interval-origin + start-delay + + enabled + on-fail + record-pending + role + timeout + + requires + + + + + + - + + + + + + + Stopped Started Slave Master ignore block stop restart standby fence restart-container ocf lsb heartbeat stonith upstart service systemd nagios diff --git a/xml/test-2/020-rsc-requires-inline.ref b/xml/test-2/020-rsc-requires-inline.ref index 6be2417df5..cef2958997 100644 --- a/xml/test-2/020-rsc-requires-inline.ref +++ b/xml/test-2/020-rsc-requires-inline.ref @@ -1,43 +1,45 @@ - + + + diff --git a/xml/test-2/021-rsc-requires-nvpair.ref b/xml/test-2/021-rsc-requires-nvpair.ref index 0dd6efb086..3c239e4552 100644 --- a/xml/test-2/021-rsc-requires-nvpair.ref +++ b/xml/test-2/021-rsc-requires-nvpair.ref @@ -1,46 +1,47 @@ - + + diff --git a/xml/test-2/024-rsc-requires-no-selfclash.ref b/xml/test-2/024-rsc-requires-no-selfclash.ref index ee56fb24b3..358ccd7d24 100644 --- a/xml/test-2/024-rsc-requires-no-selfclash.ref +++ b/xml/test-2/024-rsc-requires-no-selfclash.ref @@ -1,111 +1,116 @@ - + + + - + + + - + + diff --git a/xml/test-2/024-rsc-requires-no-selfclash.ref.err b/xml/test-2/024-rsc-requires-no-selfclash.ref.err index ea95864591..49d9683336 100644 --- a/xml/test-2/024-rsc-requires-no-selfclash.ref.err +++ b/xml/test-2/024-rsc-requires-no-selfclash.ref.err @@ -1,14 +1,14 @@ Resources-operation: myAddr1-start (rsc=myAddr1, meta=myAddr1-start-meta): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: myAddr1-start (rsc=myAddr1): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: myAddr2-start (rsc=myAddr2, meta=myAddr2-start-meta): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: myAddr2-start (rsc=myAddr2): moving requires under meta_attributes as requires unless already defined there for matching start|promote -Resources-operation: stateful1-promote (rsc=stateful1): moving requires under meta_attributes as requires unless already defined there for matching start|promote -Resources-operation: stateful1-start (rsc=stateful1): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: stateful1-demote (rsc=stateful1, meta=stateful1-demote-meta): dropping requires Resources-operation: ... only start/promote operation taken into account +Resources-operation: stateful1-promote (rsc=stateful1): moving requires under meta_attributes as requires unless already defined there for matching start|promote +Resources-operation: stateful1-start (rsc=stateful1): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: stateful2-promote (rsc=stateful2, meta=stateful2-promote-meta1): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: stateful2-promote (rsc=stateful2, meta=stateful2-promote-meta1): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: stateful2-promote (rsc=stateful2, meta=stateful2-promote-meta2): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: stateful2-start (rsc=stateful2, meta=stateful2-promote-meta3): moving requires under meta_attributes as requires unless already defined there for matching start|promote Resources-operation: stateful2-demote (rsc=stateful2, meta=stateful2-promote-meta): dropping requires Resources-operation: ... only start/promote operation taken into account diff --git a/xml/test-2/061-rsc-attrs-meta-exchange.ref b/xml/test-2/061-rsc-attrs-meta-exchange.ref new file mode 100644 index 0000000000..8148d76d37 --- /dev/null +++ b/xml/test-2/061-rsc-attrs-meta-exchange.ref @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/test-2/061-rsc-attrs-meta-exchange.ref.err b/xml/test-2/061-rsc-attrs-meta-exchange.ref.err new file mode 100644 index 0000000000..03c7a6fcbd --- /dev/null +++ b/xml/test-2/061-rsc-attrs-meta-exchange.ref.err @@ -0,0 +1,3 @@ +Resource meta_attributes: res1 (meta=res1-meta_attributes): renaming resource-failure-stickiness as migration-threshold, redefined as 1, for matching -INFINITY +Resource meta_attributes: res2 (meta=res2-meta_attributes): dropping resource-failure-stickiness +Resource meta_attributes: ... migration-threshold can be configured instead diff --git a/xml/test-2/061-rsc-attrs-meta-exchange.xml b/xml/test-2/061-rsc-attrs-meta-exchange.xml new file mode 100644 index 0000000000..99ff8559b0 --- /dev/null +++ b/xml/test-2/061-rsc-attrs-meta-exchange.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/test-2/021-rsc-requires-nvpair.ref b/xml/test-2/070-rsc-op-attrs-inst-requires-start.ref similarity index 90% copy from xml/test-2/021-rsc-requires-nvpair.ref copy to xml/test-2/070-rsc-op-attrs-inst-requires-start.ref index 0dd6efb086..20aba397b0 100644 --- a/xml/test-2/021-rsc-requires-nvpair.ref +++ b/xml/test-2/070-rsc-op-attrs-inst-requires-start.ref @@ -1,46 +1,48 @@ + - + - + + diff --git a/xml/test-2/070-rsc-op-attrs-inst-requires-start.ref.err b/xml/test-2/070-rsc-op-attrs-inst-requires-start.ref.err new file mode 100644 index 0000000000..1aa7937627 --- /dev/null +++ b/xml/test-2/070-rsc-op-attrs-inst-requires-start.ref.err @@ -0,0 +1 @@ +Resources-operation instance_attributes: myAddr-start (rsc=myAddr, meta=myAddr-start-instanceparams): moving requires under per-resource-meta_attributes as requires unless already defined there for matching start|promote diff --git a/xml/test-2/021-rsc-requires-nvpair.ref b/xml/test-2/070-rsc-op-attrs-inst-requires-start.xml similarity index 80% copy from xml/test-2/021-rsc-requires-nvpair.ref copy to xml/test-2/070-rsc-op-attrs-inst-requires-start.xml index 0dd6efb086..90a4735a5f 100644 --- a/xml/test-2/021-rsc-requires-nvpair.ref +++ b/xml/test-2/070-rsc-op-attrs-inst-requires-start.xml @@ -1,46 +1,48 @@ - + + - + + + + + + - - - - - + diff --git a/xml/test-2/020-rsc-requires-inline.ref b/xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.ref similarity index 77% copy from xml/test-2/020-rsc-requires-inline.ref copy to xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.ref index 6be2417df5..3dd51689cc 100644 --- a/xml/test-2/020-rsc-requires-inline.ref +++ b/xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.ref @@ -1,43 +1,42 @@ + - - + - + diff --git a/xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.ref.err b/xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.ref.err new file mode 100644 index 0000000000..0865c594da --- /dev/null +++ b/xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.ref.err @@ -0,0 +1,2 @@ +Resources-operation instance_attributes: myAddr-stop (rsc=myAddr, meta=myAddr-stop-instanceparams): dropping requires +Resources-operation instance_attributes: ... only start/promote operation taken into account diff --git a/xml/test-2/021-rsc-requires-nvpair.ref b/xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.xml similarity index 76% copy from xml/test-2/021-rsc-requires-nvpair.ref copy to xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.xml index 0dd6efb086..b6f87bfc2f 100644 --- a/xml/test-2/021-rsc-requires-nvpair.ref +++ b/xml/test-2/071-rsc-op-attrs-inst-requires-nonstart.xml @@ -1,46 +1,48 @@ - + + - + + + + + + - - - - - + diff --git a/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.ref b/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.ref new file mode 100644 index 0000000000..c63230c4ee --- /dev/null +++ b/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.ref @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.ref.err b/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.ref.err new file mode 100644 index 0000000000..bacdc09be7 --- /dev/null +++ b/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.ref.err @@ -0,0 +1,4 @@ +Resources-operation instance_attributes: myAddr-start (rsc=myAddr, meta=myAddr-start-instance): moving requires under per-resource-meta_attributes as requires unless already defined there for matching start|promote +Resources-operation: myAddr-start (rsc=myAddr): moving requires under meta_attributes as requires unless already defined there for matching start|promote +Resources-operation instance_attributes: stateful-promote (rsc=stateful, meta=stateful-promote-instance): moving requires under per-resource-meta_attributes as requires unless already defined there for matching start|promote +Resources-operation: stateful-promote (rsc=stateful, meta=stateful-promote-meta): moving requires under meta_attributes as requires unless already defined there for matching start|promote diff --git a/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.xml b/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.xml new file mode 100644 index 0000000000..c7359424bc --- /dev/null +++ b/xml/test-2/072-rsc-op-attrs-inst-requires-no-override.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/test-2/020-rsc-requires-inline.ref b/xml/test-2/073-rsc-op-attrs-inst-meta-meaning.ref similarity index 58% copy from xml/test-2/020-rsc-requires-inline.ref copy to xml/test-2/073-rsc-op-attrs-inst-meta-meaning.ref index 6be2417df5..28b1d17336 100644 --- a/xml/test-2/020-rsc-requires-inline.ref +++ b/xml/test-2/073-rsc-op-attrs-inst-meta-meaning.ref @@ -1,43 +1,51 @@ - - + + + + + + + - + - + + + + + + + + + + - - - - - - + diff --git a/xml/test-2/073-rsc-op-attrs-inst-meta-meaning.ref.err b/xml/test-2/073-rsc-op-attrs-inst-meta-meaning.ref.err new file mode 100644 index 0000000000..0410a57811 --- /dev/null +++ b/xml/test-2/073-rsc-op-attrs-inst-meta-meaning.ref.err @@ -0,0 +1,4 @@ +Resources-operation instance_attributes: myAddr-start (rsc=myAddr, meta=myAddr-start-instance): moving on-fail under meta_attributes as on-fail unless already defined there +Resources-operation instance_attributes: myAddr-start (rsc=myAddr, meta=myAddr-start-instance): moving record-pending under meta_attributes as record-pending unless already defined there +Resources-operation instance_attributes: myHttpd-monitor (rsc=myHttpd, meta=myHttpd-monitor-instance): moving timeout under meta_attributes as timeout unless already defined there +Resources-operation instance_attributes: myHttpd-monitor (rsc=myHttpd, meta=myHttpd-monitor-instance2): moving timeout under meta_attributes as timeout unless already defined there diff --git a/xml/test-2/020-rsc-requires-inline.ref b/xml/test-2/073-rsc-op-attrs-inst-meta-meaning.xml similarity index 53% copy from xml/test-2/020-rsc-requires-inline.ref copy to xml/test-2/073-rsc-op-attrs-inst-meta-meaning.xml index 6be2417df5..736d54669f 100644 --- a/xml/test-2/020-rsc-requires-inline.ref +++ b/xml/test-2/073-rsc-op-attrs-inst-meta-meaning.xml @@ -1,43 +1,49 @@ - + - - + + + + + + - + - + + + + + + + + + - - - - - - + diff --git a/xml/upgrade-2.10.xsl b/xml/upgrade-2.10.xsl index 85bf812870..03ea60d812 100644 --- a/xml/upgrade-2.10.xsl +++ b/xml/upgrade-2.10.xsl @@ -1,2015 +1,2488 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + - + - + - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + - + + != $ProcessedOpMetaAttributes + or + ( + not(rule) + and + not(preceding-sibling::meta_attributes[not(rule)]) + and + normalize-space($ProcessedInverseNonruleOpInstanceAttributes) + != $ProcessedInverseNonruleOpInstanceAttributes + )"> - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - + + - + + - + +