diff --git a/lib/common/schemas.c b/lib/common/schemas.c index a27aa92224..f166a729d3 100644 --- a/lib/common/schemas.c +++ b/lib/common/schemas.c @@ -1,927 +1,935 @@ /* * Copyright (C) 2004-2016 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * 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 */ #include #include #include #include #include #include #include #if HAVE_LIBXML2 # include #endif #if HAVE_LIBXSLT # include # include #endif #include #include typedef struct { xmlRelaxNGPtr rng; xmlRelaxNGValidCtxtPtr valid; xmlRelaxNGParserCtxtPtr parser; } relaxng_ctx_cache_t; struct schema_s { int type; float version; char *name; char *location; char *transform; int after_transform; void *cache; }; static struct schema_s *known_schemas = NULL; static int xml_schema_max = 0; void xml_log(int priority, const char *fmt, ...) G_GNUC_PRINTF(2, 3); void xml_log(int priority, const char *fmt, ...) { va_list ap; va_start(ap, fmt); qb_log_from_external_source_va(__FUNCTION__, __FILE__, fmt, priority, __LINE__, 0, ap); va_end(ap); } static int xml_latest_schema_index(void) { return xml_schema_max - 4; } static int xml_minimum_schema_index(void) { static int best = 0; if (best == 0) { int lpc = 0; float target = 0.0; best = xml_latest_schema_index(); target = floor(known_schemas[best].version); for (lpc = best; lpc > 0; lpc--) { if (known_schemas[lpc].version < target) { return best; } else { best = lpc; } } best = xml_latest_schema_index(); } return best; } const char * xml_latest_schema(void) { return get_schema_name(xml_latest_schema_index()); } static const char * get_schema_root(void) { static const char *base = NULL; if (base == NULL) { base = getenv("PCMK_schema_directory"); } if (base == NULL || strlen(base) == 0) { base = CRM_DTD_DIRECTORY; } return base; } static char * get_schema_path(const char *name, const char *file) { const char *base = get_schema_root(); if (file) { return crm_strdup_printf("%s/%s", base, file); } return crm_strdup_printf("%s/%s.rng", base, name); } static int schema_filter(const struct dirent *a) { int rc = 0; float version = 0; if (strstr(a->d_name, "pacemaker-") != a->d_name) { /* crm_trace("%s - wrong prefix", a->d_name); */ } else if (!crm_ends_with(a->d_name, ".rng")) { /* crm_trace("%s - wrong suffix", a->d_name); */ } else if (sscanf(a->d_name, "pacemaker-%f.rng", &version) == 0) { /* crm_trace("%s - wrong format", a->d_name); */ } else if (strcmp(a->d_name, "pacemaker-1.1.rng") == 0) { /* "-1.1" was used for what later became "-next" */ /* crm_trace("%s - hack", a->d_name); */ } else { /* crm_debug("%s - candidate", a->d_name); */ rc = 1; } return rc; } static int schema_sort(const struct dirent **a, const struct dirent **b) { int rc = 0; float a_version = 0.0; float b_version = 0.0; sscanf(a[0]->d_name, "pacemaker-%f.rng", &a_version); sscanf(b[0]->d_name, "pacemaker-%f.rng", &b_version); if (a_version > b_version) { rc = 1; } else if(a_version < b_version) { rc = -1; } /* crm_trace("%s (%f) vs. %s (%f) : %d", a[0]->d_name, a_version, b[0]->d_name, b_version, rc); */ return rc; } static void __xml_schema_add(int type, float version, const char *name, const char *location, const char *transform, int after_transform) { int last = xml_schema_max; xml_schema_max++; known_schemas = realloc_safe(known_schemas, xml_schema_max * sizeof(struct schema_s)); CRM_ASSERT(known_schemas != NULL); memset(known_schemas+last, 0, sizeof(struct schema_s)); known_schemas[last].type = type; known_schemas[last].after_transform = after_transform; if (version > 0.0) { known_schemas[last].version = version; known_schemas[last].name = crm_strdup_printf("pacemaker-%.1f", version); known_schemas[last].location = crm_strdup_printf("%s.rng", known_schemas[last].name); } else { char dummy[1024]; CRM_ASSERT(name); CRM_ASSERT(location); sscanf(name, "%[^-]-%f", dummy, &version); known_schemas[last].version = version; known_schemas[last].name = strdup(name); known_schemas[last].location = strdup(location); } if (transform) { known_schemas[last].transform = strdup(transform); } if (after_transform == 0) { after_transform = xml_schema_max; /* upgrade is a one-way */ } known_schemas[last].after_transform = after_transform; if (known_schemas[last].after_transform < 0) { crm_debug("Added supported schema %d: %s (%s)", last, known_schemas[last].name, known_schemas[last].location); } else if (known_schemas[last].transform) { crm_debug("Added supported schema %d: %s (%s upgrades to %d with %s)", last, known_schemas[last].name, known_schemas[last].location, known_schemas[last].after_transform, known_schemas[last].transform); } else { crm_debug("Added supported schema %d: %s (%s upgrades to %d)", last, known_schemas[last].name, known_schemas[last].location, known_schemas[last].after_transform); } } /*! * \internal * \brief Load pacemaker schemas into cache */ void crm_schema_init(void) { int lpc, max; const char *base = get_schema_root(); struct dirent **namelist = NULL; max = scandir(base, &namelist, schema_filter, schema_sort); __xml_schema_add(1, 0.0, "pacemaker-0.6", "crm.dtd", "upgrade06.xsl", 3); __xml_schema_add(1, 0.0, "transitional-0.6", "crm-transitional.dtd", "upgrade06.xsl", 3); __xml_schema_add(2, 0.0, "pacemaker-0.7", "pacemaker-1.0.rng", NULL, 0); if (max < 0) { crm_notice("scandir(%s) failed: %s (%d)", base, strerror(errno), errno); } else { for (lpc = 0; lpc < max; lpc++) { int next = 0; float version = 0.0; char *transform = NULL; sscanf(namelist[lpc]->d_name, "pacemaker-%f.rng", &version); if ((lpc + 1) < max) { float next_version = 0.0; sscanf(namelist[lpc+1]->d_name, "pacemaker-%f.rng", &next_version); if (floor(version) < floor(next_version)) { struct stat s; char *xslt = NULL; transform = crm_strdup_printf("upgrade-%.1f.xsl", version); xslt = get_schema_path(NULL, transform); if (stat(xslt, &s) != 0) { crm_err("Transform %s not found", xslt); free(xslt); __xml_schema_add(2, version, NULL, NULL, NULL, -1); break; } else { free(xslt); } } } else { next = -1; } __xml_schema_add(2, version, NULL, NULL, transform, next); free(namelist[lpc]); free(transform); } } /* 1.1 was the old name for -next */ __xml_schema_add(2, 0.0, "pacemaker-1.1", "pacemaker-next.rng", NULL, 0); __xml_schema_add(2, 0.0, "pacemaker-next", "pacemaker-next.rng", NULL, -1); __xml_schema_add(0, 0.0, "none", "N/A", NULL, -1); free(namelist); } static gboolean validate_with_dtd(xmlDocPtr doc, gboolean to_logs, const char *dtd_file) { gboolean valid = TRUE; xmlDtdPtr dtd = NULL; xmlValidCtxtPtr cvp = NULL; CRM_CHECK(doc != NULL, return FALSE); CRM_CHECK(dtd_file != NULL, return FALSE); dtd = xmlParseDTD(NULL, (const xmlChar *)dtd_file); if (dtd == NULL) { crm_err("Could not locate/parse DTD: %s", dtd_file); return TRUE; } cvp = xmlNewValidCtxt(); if (cvp) { if (to_logs) { cvp->userData = (void *)LOG_ERR; cvp->error = (xmlValidityErrorFunc) xml_log; cvp->warning = (xmlValidityWarningFunc) xml_log; } else { cvp->userData = (void *)stderr; cvp->error = (xmlValidityErrorFunc) fprintf; cvp->warning = (xmlValidityWarningFunc) fprintf; } if (!xmlValidateDtd(cvp, doc, dtd)) { valid = FALSE; } xmlFreeValidCtxt(cvp); } else { crm_err("Internal error: No valid context"); } xmlFreeDtd(dtd); return valid; } #if 0 static void relaxng_invalid_stderr(void *userData, xmlErrorPtr error) { /* Structure xmlError struct _xmlError { int domain : What part of the library raised this er int code : The error code, e.g. an xmlParserError char * message : human-readable informative error messag xmlErrorLevel level : how consequent is the error char * file : the filename int line : the line number if available char * str1 : extra string information char * str2 : extra string information char * str3 : extra string information int int1 : extra number information int int2 : column number of the error or 0 if N/A void * ctxt : the parser context if available void * node : the node in the tree } */ crm_err("Structured error: line=%d, level=%d %s", error->line, error->level, error->message); } #endif static gboolean validate_with_relaxng(xmlDocPtr doc, gboolean to_logs, const char *relaxng_file, relaxng_ctx_cache_t **cached_ctx) { int rc = 0; gboolean valid = TRUE; relaxng_ctx_cache_t *ctx = NULL; CRM_CHECK(doc != NULL, return FALSE); CRM_CHECK(relaxng_file != NULL, return FALSE); if (cached_ctx && *cached_ctx) { ctx = *cached_ctx; } else { crm_info("Creating RNG parser context"); ctx = calloc(1, sizeof(relaxng_ctx_cache_t)); xmlLoadExtDtdDefaultValue = 1; ctx->parser = xmlRelaxNGNewParserCtxt(relaxng_file); CRM_CHECK(ctx->parser != NULL, goto cleanup); if (to_logs) { xmlRelaxNGSetParserErrors(ctx->parser, (xmlRelaxNGValidityErrorFunc) xml_log, (xmlRelaxNGValidityWarningFunc) xml_log, GUINT_TO_POINTER(LOG_ERR)); } else { xmlRelaxNGSetParserErrors(ctx->parser, (xmlRelaxNGValidityErrorFunc) fprintf, (xmlRelaxNGValidityWarningFunc) fprintf, stderr); } ctx->rng = xmlRelaxNGParse(ctx->parser); CRM_CHECK(ctx->rng != NULL, crm_err("Could not find/parse %s", relaxng_file); goto cleanup); ctx->valid = xmlRelaxNGNewValidCtxt(ctx->rng); CRM_CHECK(ctx->valid != NULL, goto cleanup); if (to_logs) { xmlRelaxNGSetValidErrors(ctx->valid, (xmlRelaxNGValidityErrorFunc) xml_log, (xmlRelaxNGValidityWarningFunc) xml_log, GUINT_TO_POINTER(LOG_ERR)); } else { xmlRelaxNGSetValidErrors(ctx->valid, (xmlRelaxNGValidityErrorFunc) fprintf, (xmlRelaxNGValidityWarningFunc) fprintf, stderr); } } /* xmlRelaxNGSetValidStructuredErrors( */ /* valid, relaxng_invalid_stderr, valid); */ xmlLineNumbersDefault(1); rc = xmlRelaxNGValidateDoc(ctx->valid, doc); if (rc > 0) { valid = FALSE; } else if (rc < 0) { crm_err("Internal libxml error during validation\n"); } cleanup: if (cached_ctx) { *cached_ctx = ctx; } else { if (ctx->parser != NULL) { xmlRelaxNGFreeParserCtxt(ctx->parser); } if (ctx->valid != NULL) { xmlRelaxNGFreeValidCtxt(ctx->valid); } if (ctx->rng != NULL) { xmlRelaxNGFree(ctx->rng); } free(ctx); } return valid; } /*! * \internal * \brief Clean up global memory associated with XML schemas */ void crm_schema_cleanup(void) { int lpc; relaxng_ctx_cache_t *ctx = NULL; for (lpc = 0; lpc < xml_schema_max; lpc++) { switch (known_schemas[lpc].type) { case 0: /* None */ break; case 1: /* DTD - Not cached */ break; case 2: /* RNG - Cached */ ctx = (relaxng_ctx_cache_t *) known_schemas[lpc].cache; if (ctx == NULL) { break; } if (ctx->parser != NULL) { xmlRelaxNGFreeParserCtxt(ctx->parser); } if (ctx->valid != NULL) { xmlRelaxNGFreeValidCtxt(ctx->valid); } if (ctx->rng != NULL) { xmlRelaxNGFree(ctx->rng); } free(ctx); known_schemas[lpc].cache = NULL; break; default: break; } free(known_schemas[lpc].name); free(known_schemas[lpc].location); free(known_schemas[lpc].transform); } free(known_schemas); known_schemas = NULL; } static gboolean validate_with(xmlNode *xml, int method, gboolean to_logs) { xmlDocPtr doc = NULL; gboolean valid = FALSE; int type = 0; char *file = NULL; if (method < 0) { return FALSE; } type = known_schemas[method].type; if(type == 0) { return TRUE; } CRM_CHECK(xml != NULL, return FALSE); doc = getDocPtr(xml); file = get_schema_path(known_schemas[method].name, known_schemas[method].location); crm_trace("Validating with: %s (type=%d)", crm_str(file), type); switch (type) { case 1: valid = validate_with_dtd(doc, to_logs, file); break; case 2: valid = validate_with_relaxng(doc, to_logs, file, (relaxng_ctx_cache_t **) & (known_schemas[method].cache)); break; default: crm_err("Unknown validator type: %d", type); break; } free(file); return valid; } static void dump_file(const char *filename) { FILE *fp = NULL; int ch, line = 0; CRM_CHECK(filename != NULL, return); fp = fopen(filename, "r"); CRM_CHECK(fp != NULL, return); fprintf(stderr, "%4d ", ++line); do { ch = getc(fp); if (ch == EOF) { putc('\n', stderr); break; } else if (ch == '\n') { fprintf(stderr, "\n%4d ", ++line); } else { putc(ch, stderr); } } while (1); fclose(fp); } gboolean validate_xml_verbose(xmlNode *xml_blob) { int fd = 0; xmlDoc *doc = NULL; xmlNode *xml = NULL; gboolean rc = FALSE; char *filename = strdup(CRM_STATE_DIR "/cib-invalid.XXXXXX"); umask(S_IWGRP | S_IWOTH | S_IROTH); fd = mkstemp(filename); write_xml_fd(xml_blob, filename, fd, FALSE); dump_file(filename); doc = xmlParseFile(filename); xml = xmlDocGetRootElement(doc); rc = validate_xml(xml, NULL, FALSE); free_xml(xml); unlink(filename); free(filename); return rc; } gboolean validate_xml(xmlNode *xml_blob, const char *validation, gboolean to_logs) { int version = 0; if (validation == NULL) { validation = crm_element_value(xml_blob, XML_ATTR_VALIDATION); } if (validation == NULL) { int lpc = 0; bool valid = FALSE; validation = crm_element_value(xml_blob, "ignore-dtd"); if (crm_is_true(validation)) { /* Legacy compatibilty */ crm_xml_add(xml_blob, XML_ATTR_VALIDATION, "none"); return TRUE; } /* Work it out */ for (lpc = 0; lpc < xml_schema_max; lpc++) { if (validate_with(xml_blob, lpc, FALSE)) { valid = TRUE; crm_xml_add(xml_blob, XML_ATTR_VALIDATION, known_schemas[lpc].name); crm_info("XML validated against %s", known_schemas[lpc].name); if(known_schemas[lpc].after_transform == 0) { break; } } } return valid; } version = get_schema_version(validation); if (strcmp(validation, "none") == 0) { return TRUE; } else if (version < xml_schema_max) { return validate_with(xml_blob, version, to_logs); } crm_err("Unknown validator: %s", validation); return FALSE; } #if HAVE_LIBXSLT static xmlNode * apply_transformation(xmlNode *xml, const char *transform) { char *xform = NULL; xmlNode *out = NULL; xmlDocPtr res = NULL; xmlDocPtr doc = NULL; xsltStylesheet *xslt = NULL; CRM_CHECK(xml != NULL, return FALSE); doc = getDocPtr(xml); xform = get_schema_path(NULL, transform); xmlLoadExtDtdDefaultValue = 1; xmlSubstituteEntitiesDefault(1); xslt = xsltParseStylesheetFile((const xmlChar *)xform); CRM_CHECK(xslt != NULL, goto cleanup); res = xsltApplyStylesheet(xslt, doc, NULL); CRM_CHECK(res != NULL, goto cleanup); out = xmlDocGetRootElement(res); cleanup: if (xslt) { xsltFreeStylesheet(xslt); } free(xform); return out; } #endif const char * get_schema_name(int version) { if (version < 0 || version >= xml_schema_max) { return "unknown"; } return known_schemas[version].name; } int get_schema_version(const char *name) { int lpc = 0; if (name == NULL) { name = "none"; } for (; lpc < xml_schema_max; lpc++) { if (safe_str_eq(name, known_schemas[lpc].name)) { return lpc; } } return -1; } /* set which validation to use */ int update_validation(xmlNode **xml_blob, int *best, int max, gboolean transform, gboolean to_logs) { xmlNode *xml = NULL; char *value = NULL; int max_stable_schemas = xml_latest_schema_index(); int lpc = 0, match = -1, rc = pcmk_ok; int next = -1; /* -1 denotes "inactive" value */ CRM_CHECK(best != NULL, return -EINVAL); *best = 0; CRM_CHECK(xml_blob != NULL, return -EINVAL); CRM_CHECK(*xml_blob != NULL, return -EINVAL); xml = *xml_blob; value = crm_element_value_copy(xml, XML_ATTR_VALIDATION); if (value != NULL) { match = get_schema_version(value); lpc = match; if (lpc >= 0 && transform == FALSE) { - lpc++; + *best = lpc++; } else if (lpc < 0) { crm_debug("Unknown validation type"); lpc = 0; } } if (match >= max_stable_schemas) { /* nothing to do */ free(value); *best = match; return pcmk_ok; } while (lpc <= max_stable_schemas) { crm_debug("Testing '%s' validation (%d of %d)", known_schemas[lpc].name ? known_schemas[lpc].name : "", lpc, max_stable_schemas); if (validate_with(xml, lpc, to_logs) == FALSE) { if (next != -1) { crm_info("Configuration not valid for schema: %s", known_schemas[lpc].name); next = -1; } else { crm_trace("%s validation failed", known_schemas[lpc].name ? known_schemas[lpc].name : ""); } if (*best) { /* we've satisfied the validation, no need to check further */ break; } rc = -pcmk_err_schema_validation; } else { if (next != -1) { crm_debug("Configuration valid for schema: %s", known_schemas[next].name); next = -1; } rc = pcmk_ok; } if (rc == pcmk_ok) { *best = lpc; } if (rc == pcmk_ok && transform) { xmlNode *upgrade = NULL; next = known_schemas[lpc].after_transform; if (next <= lpc) { /* There is no next version, or next would regress */ crm_trace("Stopping at %s", known_schemas[lpc].name); break; } else if (max > 0 && (lpc == max || next > max)) { crm_trace("Upgrade limit reached at %s (lpc=%d, next=%d, max=%d)", known_schemas[lpc].name, lpc, next, max); break; } else if (known_schemas[lpc].transform == NULL) { crm_debug("%s-style configuration is also valid for %s", known_schemas[lpc].name, known_schemas[next].name); lpc = next; } else { crm_debug("Upgrading %s-style configuration to %s with %s", known_schemas[lpc].name, known_schemas[next].name, known_schemas[lpc].transform ? known_schemas[lpc].transform : "no-op"); #if HAVE_LIBXSLT upgrade = apply_transformation(xml, known_schemas[lpc].transform); #endif if (upgrade == NULL) { crm_err("Transformation %s failed", known_schemas[lpc].transform); rc = -pcmk_err_transform_failed; } else if (validate_with(upgrade, next, to_logs)) { crm_info("Transformation %s successful", known_schemas[lpc].transform); lpc = next; *best = next; free_xml(xml); xml = upgrade; rc = pcmk_ok; } else { crm_err("Transformation %s did not produce a valid configuration", known_schemas[lpc].transform); crm_log_xml_info(upgrade, "transform:bad"); free_xml(upgrade); rc = -pcmk_err_schema_validation; } next = -1; } } if (transform == FALSE || rc != pcmk_ok) { /* we need some progress! */ lpc++; } } - if (*best > match) { + if (*best > match && *best) { crm_info("%s the configuration from %s to %s", transform?"Transformed":"Upgraded", value ? value : "", known_schemas[*best].name); crm_xml_add(xml, XML_ATTR_VALIDATION, known_schemas[*best].name); } *xml_blob = xml; free(value); return rc; } gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs) { gboolean rc = TRUE; const char *value = crm_element_value(*xml, XML_ATTR_VALIDATION); + char *const orig_value = strdup(value == NULL ? "(none)" : value); int version = get_schema_version(value); int orig_version = version; int min_version = xml_minimum_schema_index(); if (version < min_version) { xmlNode *converted = NULL; converted = copy_xml(*xml); update_validation(&converted, &version, 0, TRUE, to_logs); value = crm_element_value(converted, XML_ATTR_VALIDATION); if (version < min_version) { - if (version < orig_version) { + if (version < orig_version || orig_version == -1) { if (to_logs) { - crm_config_err("Your current configuration could not validate" - " with any schema in range [%s, %s]\n", + crm_config_err("Your current configuration %s could not" + " validate with any schema in range [%s, %s]," + " cannot upgrade to %s.\n", + orig_value, get_schema_name(orig_version), - xml_latest_schema()); + xml_latest_schema(), + get_schema_name(min_version)); } else { - fprintf(stderr, "Your current configuration could not validate" - " with any schema in range [%s, %s]\n", + fprintf(stderr, "Your current configuration %s could not" + " validate with any schema in range [%s, %s]," + " cannot upgrade to %s.\n", + orig_value, get_schema_name(orig_version), - xml_latest_schema()); + xml_latest_schema(), + get_schema_name(min_version)); } } else if (to_logs) { crm_config_err("Your current configuration could only be upgraded to %s... " - "the minimum requirement is %s.\n", crm_str(value), + "the minimum requirement is %s.", crm_str(value), get_schema_name(min_version)); } else { fprintf(stderr, "Your current configuration could only be upgraded to %s... " "the minimum requirement is %s.\n", crm_str(value), get_schema_name(min_version)); } free_xml(converted); converted = NULL; rc = FALSE; } else { free_xml(*xml); *xml = converted; if (version < xml_latest_schema_index()) { crm_config_warn("Your configuration was internally updated to %s... " "which is acceptable but not the most recent", get_schema_name(version)); } else if (to_logs) { crm_info("Your configuration was internally updated to the latest version (%s)", get_schema_name(version)); } } } else if (version >= get_schema_version("none")) { if (to_logs) { crm_config_warn("Configuration validation is currently disabled." " It is highly encouraged and prevents many common cluster issues."); } else { fprintf(stderr, "Configuration validation is currently disabled." " It is highly encouraged and prevents many common cluster issues.\n"); } } if (best_version) { *best_version = version; } + free(orig_value); return rc; } diff --git a/tools/regression.sh b/tools/regression.sh index 2d80107991..03feb61dd7 100755 --- a/tools/regression.sh +++ b/tools/regression.sh @@ -1,723 +1,795 @@ #!/bin/bash : ${shadow=tools-regression} test_home=`dirname $0` num_errors=0 num_passed=0 GREP_OPTIONS= verbose=0 -tests="dates tools acls" +tests="dates tools acls validity" function test_assert() { target=$1; shift cib=$1; shift app=`echo "$cmd" | sed 's/\ .*//'` printf "* Running: $app - $desc\n" 1>&2 printf "=#=#=#= Begin test: $desc =#=#=#=\n" eval $VALGRIND_CMD $cmd 2>&1 rc=$? if [ x$cib != x0 ]; then printf "=#=#=#= Current cib after: $desc =#=#=#=\n" CIB_user=root cibadmin -Q fi printf "=#=#=#= End test: $desc - `crm_error $rc` ($rc) =#=#=#=\n" if [ $rc -ne $target ]; then num_errors=`expr $num_errors + 1` printf "* Failed (rc=%.3d): %-14s - %s\n" $rc $app "$desc" printf "* Failed (rc=%.3d): %-14s - %s\n" $rc $app "$desc (`which $app`)" 1>&2 return exit 1 else printf "* Passed: %-14s - %s\n" $app "$desc" num_passed=`expr $num_passed + 1` fi } function usage() { echo "Usage: ./regression.sh [-s(ave)] [-x] [-v(erbose)]" exit $1 } done=0 do_save=0 VALGRIND_CMD= while test "$done" = "0"; do case "$1" in -t) tests=$2; shift; shift;; -V|--verbose) verbose=1; shift;; -v|--valgrind) export G_SLICE=always-malloc VALGRIND_CMD="valgrind -q --gen-suppressions=all --show-reachable=no --leak-check=full --trace-children=no --time-stamp=yes --num-callers=20 --suppressions=/usr/share/pacemaker/tests/valgrind-pcmk.suppressions" shift;; -x) set -x; shift;; -s) do_save=1; shift;; -p) PATH="$2:$PATH"; export PATH; shift 1;; -?) usage 0;; -*) echo "unknown option: $1"; usage 1;; *) done=1;; esac done if [ "x$VALGRIND_CMD" = "x" -a -x $test_home/crm_simulate ]; then xml_home=`dirname ${test_home}` echo "Using local binaries from: $test_home, schemas from $xml_home" export PATH="$test_home:$PATH" export PCMK_schema_directory=${xml_home}/xml fi function test_tools() { export CIB_shadow_dir=$test_home $VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow 2>&1 export CIB_shadow=$shadow desc="Validate CIB" cmd="cibadmin -Q" test_assert 0 desc="Configure something before erasing" cmd="crm_attribute -n cluster-delay -v 60s" test_assert 0 desc="Require --force for CIB erasure" cmd="cibadmin -E" test_assert 22 desc="Allow CIB erasure with --force" cmd="cibadmin -E --force" test_assert 0 desc="Query CIB" cmd="cibadmin -Q > /tmp/$$.existing.xml" test_assert 0 desc="Set cluster option" cmd="crm_attribute -n cluster-delay -v 60s" test_assert 0 desc="Query new cluster option" cmd="cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay" test_assert 0 desc="Query cluster options" cmd="cibadmin -Q -o crm_config > /tmp/$$.opt.xml" test_assert 0 desc="Set no-quorum policy" cmd="crm_attribute -n no-quorum-policy -v ignore" test_assert 0 desc="Delete nvpair" cmd="cibadmin -D -o crm_config --xml-text ''" test_assert 0 desc="Create operaton should fail" cmd="cibadmin -C -o crm_config --xml-file /tmp/$$.opt.xml" test_assert 76 desc="Modify cluster options section" cmd="cibadmin -M -o crm_config --xml-file /tmp/$$.opt.xml" test_assert 0 desc="Query updated cluster option" cmd="cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay" test_assert 0 desc="Set duplicate cluster option" cmd="crm_attribute -n cluster-delay -v 40s -s duplicate" test_assert 0 desc="Setting multiply defined cluster option should fail" cmd="crm_attribute -n cluster-delay -v 30s" test_assert 76 desc="Set cluster option with -s" cmd="crm_attribute -n cluster-delay -v 30s -s duplicate" test_assert 0 desc="Delete cluster option with -i" cmd="crm_attribute -n cluster-delay -D -i cib-bootstrap-options-cluster-delay" test_assert 0 desc="Create node1 and bring it online" cmd="crm_simulate --live-check --in-place --node-up=node1" test_assert 0 desc="Create node attribute" cmd="crm_attribute -n ram -v 1024M -U node1 -t nodes" test_assert 0 desc="Query new node attribute" cmd="cibadmin -Q -o nodes | grep node1-ram" test_assert 0 desc="Digest calculation" cmd="cibadmin -Q | cibadmin -5 -p 2>&1 > /dev/null" test_assert 0 # This update will fail because it has version numbers desc="Replace operation should fail" cmd="cibadmin -R --xml-file /tmp/$$.existing.xml" test_assert 205 desc="Default standby value" cmd="crm_standby -N node1 -G" test_assert 0 desc="Set standby status" cmd="crm_standby -N node1 -v true" test_assert 0 desc="Query standby value" cmd="crm_standby -N node1 -G" test_assert 0 desc="Delete standby value" cmd="crm_standby -N node1 -D" test_assert 0 desc="Create a resource" cmd="cibadmin -C -o resources --xml-text ''" test_assert 0 desc="Create a resource meta attribute" cmd="crm_resource -r dummy --meta -p is-managed -v false" test_assert 0 desc="Query a resource meta attribute" cmd="crm_resource -r dummy --meta -g is-managed" test_assert 0 desc="Remove a resource meta attribute" cmd="crm_resource -r dummy --meta -d is-managed" test_assert 0 desc="Create a resource attribute" cmd="crm_resource -r dummy -p delay -v 10s" test_assert 0 desc="List the configured resources" cmd="crm_resource -L" test_assert 0 desc="Set a resource's fail-count" cmd="crm_failcount -r dummy -v 10 -N node1" test_assert 0 desc="Require a destination when migrating a resource that is stopped" cmd="crm_resource -r dummy -M" test_assert 22 desc="Don't support migration to non-existent locations" cmd="crm_resource -r dummy -M -N i.dont.exist" test_assert 6 desc="Create a fencing resource" cmd="cibadmin -C -o resources --xml-text ''" test_assert 0 desc="Bring resources online" cmd="crm_simulate --live-check --in-place -S" test_assert 0 desc="Try to move a resource to its existing location" cmd="crm_resource -r dummy --move --host node1" test_assert 22 desc="Move a resource from its existing location" cmd="crm_resource -r dummy --move" test_assert 0 desc="Clear out constraints generated by --move" cmd="crm_resource -r dummy --clear" test_assert 0 desc="Default ticket granted state" cmd="crm_ticket -t ticketA -G granted -d false" test_assert 0 desc="Set ticket granted state" cmd="crm_ticket -t ticketA -r --force" test_assert 0 desc="Query ticket granted state" cmd="crm_ticket -t ticketA -G granted" test_assert 0 desc="Delete ticket granted state" cmd="crm_ticket -t ticketA -D granted --force" test_assert 0 desc="Make a ticket standby" cmd="crm_ticket -t ticketA -s" test_assert 0 desc="Query ticket standby state" cmd="crm_ticket -t ticketA -G standby" test_assert 0 desc="Activate a ticket" cmd="crm_ticket -t ticketA -a" test_assert 0 desc="Delete ticket standby state" cmd="crm_ticket -t ticketA -D standby" test_assert 0 desc="Ban a resource on unknown node" cmd="crm_resource -r dummy -B -N host1" test_assert 6 desc="Create two more nodes and bring them online" cmd="crm_simulate --live-check --in-place --node-up=node2 --node-up=node3" test_assert 0 desc="Ban dummy from node1" cmd="crm_resource -r dummy -B -N node1" test_assert 0 desc="Ban dummy from node2" cmd="crm_resource -r dummy -B -N node2" test_assert 0 desc="Relocate resources due to ban" cmd="crm_simulate --live-check --in-place -S" test_assert 0 desc="Move dummy to node1" cmd="crm_resource -r dummy -M -N node1" test_assert 0 desc="Clear implicit constraints for dummy on node2" cmd="crm_resource -r dummy -U -N node2" test_assert 0 desc="Drop the status section" cmd="cibadmin -R -o status --xml-text ''" test_assert 0 0 desc="Create a clone" cmd="cibadmin -C -o resources --xml-text ''" test_assert 0 0 desc="Create a resource meta attribute" cmd="crm_resource -r test-primitive --meta -p is-managed -v false" test_assert 0 desc="Create a resource meta attribute in the primitive" cmd="crm_resource -r test-primitive --meta -p is-managed -v false --force" test_assert 0 desc="Update resource meta attribute with duplicates" cmd="crm_resource -r test-clone --meta -p is-managed -v true" test_assert 0 desc="Update resource meta attribute with duplicates (force clone)" cmd="crm_resource -r test-clone --meta -p is-managed -v true --force" test_assert 0 desc="Update child resource meta attribute with duplicates" cmd="crm_resource -r test-primitive --meta -p is-managed -v false" test_assert 0 desc="Delete resource meta attribute with duplicates" cmd="crm_resource -r test-clone --meta -d is-managed" test_assert 0 desc="Delete resource meta attribute in parent" cmd="crm_resource -r test-primitive --meta -d is-managed" test_assert 0 desc="Create a resource meta attribute in the primitive" cmd="crm_resource -r test-primitive --meta -p is-managed -v false --force" test_assert 0 desc="Update existing resource meta attribute" cmd="crm_resource -r test-clone --meta -p is-managed -v true" test_assert 0 desc="Create a resource meta attribute in the parent" cmd="crm_resource -r test-clone --meta -p is-managed -v true --force" test_assert 0 desc="Copy resources" cmd="cibadmin -Q -o resources > /tmp/$$.resources.xml" test_assert 0 0 desc="Delete resource paremt meta attribute (force)" cmd="crm_resource -r test-clone --meta -d is-managed --force" test_assert 0 desc="Restore duplicates" cmd="cibadmin -R -o resources --xml-file /tmp/$$.resources.xml" test_assert 0 desc="Delete resource child meta attribute" cmd="crm_resource -r test-primitive --meta -d is-managed" test_assert 0 rm -f /tmp/$$.existing.xml /tmp/$$.resources.xml } function test_dates() { desc="2014-01-01 00:30:00 - 1 Hour" cmd="iso8601 -d '2014-01-01 00:30:00Z' -D P-1H -E '2013-12-31 23:30:00Z'" test_assert 0 0 for y in 06 07 08 09 10 11 12 13 14 15 16 17 18; do desc="20$y-W01-7" cmd="iso8601 -d '20$y-W01-7 00Z'" test_assert 0 0 desc="20$y-W01-7 - round-trip" cmd="iso8601 -d '20$y-W01-7 00Z' -W -E '20$y-W01-7 00:00:00Z'" test_assert 0 0 desc="20$y-W01-1" cmd="iso8601 -d '20$y-W01-1 00Z'" test_assert 0 0 desc="20$y-W01-1 - round-trip" cmd="iso8601 -d '20$y-W01-1 00Z' -W -E '20$y-W01-1 00:00:00Z'" test_assert 0 0 done desc="2009-W53-07" cmd="iso8601 -d '2009-W53-7 00:00:00Z' -W -E '2009-W53-7 00:00:00Z'" test_assert 0 0 desc="2009-01-31 + 1 Month" cmd="iso8601 -d '2009-01-31 00:00:00Z' -D P1M -E '2009-02-28 00:00:00Z'" test_assert 0 0 desc="2009-01-31 + 2 Months" cmd="iso8601 -d '2009-01-31 00:00:00Z' -D P2M -E '2009-03-31 00:00:00Z'" test_assert 0 0 desc="2009-01-31 + 3 Months" cmd="iso8601 -d '2009-01-31 00:00:00Z' -D P3M -E '2009-04-30 00:00:00Z'" test_assert 0 0 desc="2009-03-31 - 1 Month" cmd="iso8601 -d '2009-03-31 00:00:00Z' -D P-1M -E '2009-02-28 00:00:00Z'" test_assert 0 0 } function get_epoch() { CIB_user=root CIB_file=$1 CIB_shadow="" cibadmin -Q | head -n 1 | sed -e 's/.* epoch=\"\([0-9]*\).*/\1/' } function restore_epoch() { infile=$1; shift old=$1; shift new=$(get_epoch $infile) sed -i 's/epoch=.$old/epoch=\"$new/g' $infile } function test_acl_loop() { # Make sure we're rejecting things for the right reasons export PCMK_trace_functions=__xml_acl_check,__xml_acl_post_process export PCMK_stderr=1 CIB_user=root cibadmin --replace --xml-text '' export CIB_user=unknownguy desc="$CIB_user: Query configuration" cmd="cibadmin -Q" test_assert 13 0 desc="$CIB_user: Set enable-acl" cmd="crm_attribute -n enable-acl -v false" test_assert 13 0 desc="$CIB_user: Set stonith-enabled" cmd="crm_attribute -n stonith-enabled -v false" test_assert 13 0 desc="$CIB_user: Create a resource" cmd="cibadmin -C -o resources --xml-text ''" test_assert 13 0 export CIB_user=l33t-haxor desc="$CIB_user: Query configuration" cmd="cibadmin -Q" test_assert 13 0 desc="$CIB_user: Set enable-acl" cmd="crm_attribute -n enable-acl -v false" test_assert 13 0 desc="$CIB_user: Set stonith-enabled" cmd="crm_attribute -n stonith-enabled -v false" test_assert 13 0 desc="$CIB_user: Create a resource" cmd="cibadmin -C -o resources --xml-text ''" test_assert 13 0 export CIB_user=niceguy desc="$CIB_user: Query configuration" cmd="cibadmin -Q" test_assert 0 0 desc="$CIB_user: Set enable-acl" cmd="crm_attribute -n enable-acl -v false" test_assert 13 0 desc="$CIB_user: Set stonith-enabled" cmd="crm_attribute -n stonith-enabled -v false" test_assert 0 desc="$CIB_user: Create a resource" cmd="cibadmin -C -o resources --xml-text ''" test_assert 13 0 export CIB_user=root desc="$CIB_user: Query configuration" cmd="cibadmin -Q" test_assert 0 0 desc="$CIB_user: Set stonith-enabled" cmd="crm_attribute -n stonith-enabled -v true" test_assert 0 desc="$CIB_user: Create a resource" cmd="cibadmin -C -o resources --xml-text ''" test_assert 0 export CIB_user=l33t-haxor desc="$CIB_user: Create a resource meta attribute" cmd="crm_resource -r dummy --meta -p target-role -v Stopped" test_assert 13 0 desc="$CIB_user: Query a resource meta attribute" cmd="crm_resource -r dummy --meta -g target-role" test_assert 13 0 desc="$CIB_user: Remove a resource meta attribute" cmd="crm_resource -r dummy --meta -d target-role" test_assert 13 0 export CIB_user=niceguy desc="$CIB_user: Create a resource meta attribute" cmd="crm_resource -r dummy --meta -p target-role -v Stopped" test_assert 0 desc="$CIB_user: Query a resource meta attribute" cmd="crm_resource -r dummy --meta -g target-role" test_assert 0 desc="$CIB_user: Remove a resource meta attribute" cmd="crm_resource -r dummy --meta -d target-role" test_assert 0 desc="$CIB_user: Create a resource meta attribute" cmd="crm_resource -r dummy --meta -p target-role -v Started" test_assert 0 export CIB_user=badidea desc="$CIB_user: Query configuration - implied deny" cmd="cibadmin -Q" test_assert 0 0 export CIB_user=betteridea desc="$CIB_user: Query configuration - explicit deny" cmd="cibadmin -Q" test_assert 0 0 CIB_user=root cibadmin -Q > /tmp/$$.haxor.xml CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin --delete --xml-text '' CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -Ql export CIB_user=niceguy desc="$CIB_user: Replace - remove acls" cmd="cibadmin --replace --xml-file /tmp/$$.haxor.xml" test_assert 13 0 CIB_user=root cibadmin -Q > /tmp/$$.haxor.xml CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -C -o resources --xml-text '' CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -Ql desc="$CIB_user: Replace - create resource" cmd="cibadmin --replace --xml-file /tmp/$$.haxor.xml" test_assert 13 0 CIB_user=root cibadmin -Q > /tmp/$$.haxor.xml CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" crm_attribute -n enable-acl -v false CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -Ql desc="$CIB_user: Replace - modify attribute (deny)" cmd="cibadmin --replace --xml-file /tmp/$$.haxor.xml" test_assert 13 0 CIB_user=root cibadmin -Q > /tmp/$$.haxor.xml CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin --replace --xml-text '' CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -Ql desc="$CIB_user: Replace - delete attribute (deny)" cmd="cibadmin --replace --xml-file /tmp/$$.haxor.xml" test_assert 13 0 CIB_user=root cibadmin -Q > /tmp/$$.haxor.xml CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin --modify --xml-text '' CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -Ql desc="$CIB_user: Replace - create attribute (deny)" cmd="cibadmin --replace --xml-file /tmp/$$.haxor.xml" test_assert 13 0 rm -rf /tmp/$$.haxor.xml CIB_user=bob CIB_user=root cibadmin -Q > /tmp/$$.haxor.xml CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin --modify --xml-text '' CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -Ql desc="$CIB_user: Replace - create attribute (allow)" cmd="cibadmin --replace -o resources --xml-file /tmp/$$.haxor.xml" test_assert 0 0 CIB_user=root cibadmin -Q > /tmp/$$.haxor.xml CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin --modify --xml-text '' CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -Ql desc="$CIB_user: Replace - modify attribute (allow)" cmd="cibadmin --replace -o resources --xml-file /tmp/$$.haxor.xml" test_assert 0 0 CIB_user=root cibadmin -Q > /tmp/$$.haxor.xml CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin --replace -o resources --xml-text '' CIB_user=root CIB_file=/tmp/$$.haxor.xml CIB_shadow="" cibadmin -Ql desc="$CIB_user: Replace - delete attribute (allow)" cmd="cibadmin --replace -o resources --xml-file /tmp/$$.haxor.xml" test_assert 0 0 } function test_acls() { export CIB_shadow_dir=$test_home $VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow --validate-with pacemaker-1.3 2>&1 export CIB_shadow=$shadow cat</tmp/$$.acls.xml EOF desc="Configure some ACLs" cmd="cibadmin -M -o acls --xml-file /tmp/$$.acls.xml" test_assert 0 desc="Enable ACLs" cmd="crm_attribute -n enable-acl -v true" test_assert 0 desc="Set cluster option" cmd="crm_attribute -n no-quorum-policy -v ignore" test_assert 0 desc="New ACL" cmd="cibadmin --create -o acls --xml-text ''" test_assert 0 desc="Another ACL" cmd="cibadmin --create -o acls --xml-text ''" test_assert 0 desc="Updated ACL" cmd="cibadmin --replace -o acls --xml-text ''" test_assert 0 test_acl_loop printf "\n\n !#!#!#!#! Upgrading to pacemaker-2.0 and retesting !#!#!#!#!\n" printf "\nUpgrading to pacemaker-2.0 and re-testing\n" 1>&2 export CIB_user=root desc="$CIB_user: Upgrade to pacemaker-2.0" cmd="cibadmin --upgrade --force -V" test_assert 0 sed -i 's/epoch=.2/epoch=\"6/g' $CIB_shadow_dir/shadow.$CIB_shadow sed -i 's/admin_epoch=.1/admin_epoch=\"0/g' $CIB_shadow_dir/shadow.$CIB_shadow test_acl_loop } +function test_validity() { + + export CIB_shadow_dir=$test_home + $VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow --validate-with pacemaker-1.2 2>&1 + export CIB_shadow=$shadow + export PCMK_trace_functions=update_validation,cli_config_update + export PCMK_stderr=1 + + cibadmin -C -o resources --xml-text '' + cibadmin -C -o resources --xml-text '' + cibadmin -C -o constraints --xml-text '' + cibadmin -Q > /tmp/$$.good-1.2.xml + + + desc="Try to make resulting CIB invalid (enum violation)" + cmd="cibadmin -M -o constraints --xml-text ''" + test_assert 203 + + sed 's|"start"|"break"|' /tmp/$$.good-1.2.xml > /tmp/$$.bad-1.2.xml + desc="Run crm_simulate with invalid CIB (enum violation)" + cmd="crm_simulate -x /tmp/$$.bad-1.2.xml -S" + test_assert 126 0 + + + desc="Try to make resulting CIB invalid (unrecognized validate-with)" + cmd="cibadmin -M --xml-text ''" + test_assert 203 + + sed 's|"pacemaker-1.2"|"pacemaker-9999.0"|' /tmp/$$.good-1.2.xml > /tmp/$$.bad-1.2.xml + desc="Run crm_simulate with invalid CIB (unrecognized validate-with)" + cmd="crm_simulate -x /tmp/$$.bad-1.2.xml -S" + test_assert 126 0 + + + desc="Try to make resulting CIB invalid, but possibly recoverable (valid with X.Y+1)" + cmd="cibadmin -C -o configuration --xml-text ''" + test_assert 203 + + sed 's||\0|' /tmp/$$.good-1.2.xml > /tmp/$$.bad-1.2.xml + desc="Run crm_simulate with invalid, but possibly recoverable CIB (valid with X.Y+1)" + cmd="crm_simulate -x /tmp/$$.bad-1.2.xml -S" + test_assert 0 0 + + + sed 's|\s\s*validate-with="[^"]*"||' /tmp/$$.good-1.2.xml > /tmp/$$.bad-1.2.xml + desc="Make resulting CIB valid, although without validate-with attribute" + cmd="cibadmin -R --xml-file /tmp/$$.bad-1.2.xml" + test_assert 0 + + desc="Run crm_simulate with valid CIB, but without validate-with attribute" + cmd="crm_simulate -x /tmp/$$.bad-1.2.xml -S" + test_assert 0 0 + + + # this will just disable validation and accept the config, outputting + # validation errors + sed -e 's|\s\s*validate-with="[^"]*"||' \ + -e 's|\(\s\s*epoch="[^"]*\)"|\10"|' -e 's|"start"|"break"|' \ + /tmp/$$.good-1.2.xml > /tmp/$$.bad-1.2.xml + desc="Make resulting CIB invalid, and without validate-with attribute" + cmd="cibadmin -R --xml-file /tmp/$$.bad-1.2.xml" + test_assert 0 + + desc="Run crm_simulate with invalid CIB, also without validate-with attribute" + cmd="crm_simulate -x /tmp/$$.bad-1.2.xml -S" + test_assert 0 0 + + + rm -f /tmp/$$.good-1.2.xml /tmp/$$.bad-1.2.xml +} + for t in $tests; do echo "Testing $t" test_$t > $test_home/regression.$t.out sed -i -e 's/cib-last-written.*>/>/'\ - -e 's/ last-run=\"[0-9]*\"//' \ - -e 's/crm_feature_set="[^"]*" //'\ - -e 's/validate-with="[^"]*" //'\ - -e 's/Created new pacemaker-.* configuration/Created new pacemaker configuration/'\ + -e 's/ last-run=\"[0-9]*\"//'\ + -e 's/crm_feature_set="[^"]*" //'\ + -e 's/validate-with="[^"]*" //'\ + -e 's/Created new pacemaker-.* configuration/Created new pacemaker configuration/'\ -e 's/.*__xml_acl_check/__xml_acl_check/g'\ - -e 's/.*__xml_acl_post_process/__xml_acl_post_process/g'\ - -e 's/.*error: unpack_resources:/error: unpack_resources:/g'\ - -e 's/ last-rc-change=\"[0-9]*\"//' $test_home/regression.$t.out + -e 's/.*__xml_acl_post_process/__xml_acl_post_process/g'\ + -e 's/.*error: unpack_resources:/error: unpack_resources:/g'\ + -e 's/ last-rc-change=\"[0-9]*\"//'\ + -e 's|^/tmp/[0-9][0-9]*\.||' $test_home/regression.$t.out if [ $do_save = 1 ]; then cp $test_home/regression.$t.out $test_home/regression.$t.exp fi done failed=0 echo -e "\n\nResults" for t in $tests; do if [ $do_save = 1 ]; then cp $test_home/regression.$t.out $test_home/regression.$t.exp fi if [ $verbose = 1 ]; then diff -wu $test_home/regression.$t.exp $test_home/regression.$t.out else diff -wu $test_home/regression.$t.exp $test_home/regression.$t.out fi if [ $? != 0 ]; then failed=1 fi done echo -e "\n\nSummary" for t in $tests; do grep -e "^*" $test_home/regression.$t.out done if [ $num_errors != 0 ]; then echo $num_errors tests failed exit 1 elif [ $failed = 1 ]; then echo $num_passed tests passed but diff failed exit 2 else echo $num_passed tests passed exit 0 fi diff --git a/tools/regression.validity.exp b/tools/regression.validity.exp new file mode 100644 index 0000000000..b6e51c7acb --- /dev/null +++ b/tools/regression.validity.exp @@ -0,0 +1,383 @@ +Created new pacemaker configuration +Setting up shadow instance +A new shadow instance was created. To begin using it paste the following into your shell: + CIB_shadow=tools-regression ; export CIB_shadow +=#=#=#= Begin test: Try to make resulting CIB invalid (enum violation) =#=#=#= +Call failed: Update does not conform to the configured schema +=#=#=#= Current cib after: Try to make resulting CIB invalid (enum violation) =#=#=#= + + + + + + + + + + + + + + +=#=#=#= End test: Try to make resulting CIB invalid (enum violation) - Update does not conform to the configured schema (203) =#=#=#= +* Passed: cibadmin - Try to make resulting CIB invalid (enum violation) +=#=#=#= Begin test: Run crm_simulate with invalid CIB (enum violation) =#=#=#= +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-1.2' validation (4 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-1.2 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-1.3' validation (5 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-1.3 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.0' validation (6 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-2.0 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.1' validation (7 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-2.1 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.2' validation (8 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-2.2 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.3' validation (9 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-2.3 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.4' validation (10 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-2.4 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.5' validation (11 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-2.5 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.6' validation (12 of 12) +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-2.6 validation failed +Your current configuration pacemaker-1.2 could not validate with any schema in range [pacemaker-1.2, pacemaker-2.6], cannot upgrade to pacemaker-2.0. +=#=#=#= End test: Run crm_simulate with invalid CIB (enum violation) - Required key not available (126) =#=#=#= +* Passed: crm_simulate - Run crm_simulate with invalid CIB (enum violation) +=#=#=#= Begin test: Try to make resulting CIB invalid (unrecognized validate-with) =#=#=#= +Call failed: Update does not conform to the configured schema +=#=#=#= Current cib after: Try to make resulting CIB invalid (unrecognized validate-with) =#=#=#= + + + + + + + + + + + + + + +=#=#=#= End test: Try to make resulting CIB invalid (unrecognized validate-with) - Update does not conform to the configured schema (203) =#=#=#= +* Passed: cibadmin - Try to make resulting CIB invalid (unrecognized validate-with) +=#=#=#= Begin test: Run crm_simulate with invalid CIB (unrecognized validate-with) =#=#=#= +( schemas.c:736 ) debug: update_validation: Unknown validation type +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-0.6' validation (0 of 12) +element rsc_order: validity error : Element rsc_order does not carry attribute to +element rsc_order: validity error : Element rsc_order does not carry attribute from +element rsc_order: validity error : No declaration for attribute first of element rsc_order +element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +element rsc_order: validity error : No declaration for attribute then of element rsc_order +( schemas.c:760 ) trace: update_validation: pacemaker-0.6 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'transitional-0.6' validation (1 of 12) +element rsc_order: validity error : Element rsc_order does not carry attribute to +element rsc_order: validity error : Element rsc_order does not carry attribute from +element rsc_order: validity error : No declaration for attribute first of element rsc_order +element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +element rsc_order: validity error : No declaration for attribute then of element rsc_order +( schemas.c:760 ) trace: update_validation: transitional-0.6 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-0.7' validation (2 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-0.7 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-1.0' validation (3 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-1.0 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-1.2' validation (4 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-1.2 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-1.3' validation (5 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-1.3 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.0' validation (6 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-2.0 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.1' validation (7 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-2.1 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.2' validation (8 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-2.2 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.3' validation (9 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-2.3 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.4' validation (10 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-2.4 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.5' validation (11 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-2.5 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.6' validation (12 of 12) +Entity: line 1: element cib: Relax-NG validity error : Invalid attribute validate-with for element cib +( schemas.c:760 ) trace: update_validation: pacemaker-2.6 validation failed +Your current configuration pacemaker-9999.0 could not validate with any schema in range [unknown, pacemaker-2.6], cannot upgrade to pacemaker-2.0. +=#=#=#= End test: Run crm_simulate with invalid CIB (unrecognized validate-with) - Required key not available (126) =#=#=#= +* Passed: crm_simulate - Run crm_simulate with invalid CIB (unrecognized validate-with) +=#=#=#= Begin test: Try to make resulting CIB invalid, but possibly recoverable (valid with X.Y+1) =#=#=#= +Call failed: Update does not conform to the configured schema +=#=#=#= Current cib after: Try to make resulting CIB invalid, but possibly recoverable (valid with X.Y+1) =#=#=#= + + + + + + + + + + + + + + +=#=#=#= End test: Try to make resulting CIB invalid, but possibly recoverable (valid with X.Y+1) - Update does not conform to the configured schema (203) =#=#=#= +* Passed: cibadmin - Try to make resulting CIB invalid, but possibly recoverable (valid with X.Y+1) +=#=#=#= Begin test: Run crm_simulate with invalid, but possibly recoverable CIB (valid with X.Y+1) =#=#=#= +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-1.2' validation (4 of 12) +Entity: line 12: element tags: Relax-NG validity error : Element configuration has extra content: tags +( schemas.c:760 ) trace: update_validation: pacemaker-1.2 validation failed +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-1.3' validation (5 of 12) +( schemas.c:804 ) debug: update_validation: Upgrading pacemaker-1.3-style configuration to pacemaker-2.0 with upgrade-1.3.xsl +( schemas.c:816 ) info: update_validation: Transformation upgrade-1.3.xsl successful +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.0' validation (6 of 12) +( schemas.c:797 ) debug: update_validation: pacemaker-2.0-style configuration is also valid for pacemaker-2.1 +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.1' validation (7 of 12) +( schemas.c:771 ) debug: update_validation: Configuration valid for schema: pacemaker-2.1 +( schemas.c:797 ) debug: update_validation: pacemaker-2.1-style configuration is also valid for pacemaker-2.2 +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.2' validation (8 of 12) +( schemas.c:771 ) debug: update_validation: Configuration valid for schema: pacemaker-2.2 +( schemas.c:797 ) debug: update_validation: pacemaker-2.2-style configuration is also valid for pacemaker-2.3 +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.3' validation (9 of 12) +( schemas.c:771 ) debug: update_validation: Configuration valid for schema: pacemaker-2.3 +( schemas.c:797 ) debug: update_validation: pacemaker-2.3-style configuration is also valid for pacemaker-2.4 +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.4' validation (10 of 12) +( schemas.c:771 ) debug: update_validation: Configuration valid for schema: pacemaker-2.4 +( schemas.c:797 ) debug: update_validation: pacemaker-2.4-style configuration is also valid for pacemaker-2.5 +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.5' validation (11 of 12) +( schemas.c:771 ) debug: update_validation: Configuration valid for schema: pacemaker-2.5 +( schemas.c:797 ) debug: update_validation: pacemaker-2.5-style configuration is also valid for pacemaker-2.6 +( schemas.c:751 ) debug: update_validation: Testing 'pacemaker-2.6' validation (12 of 12) +( schemas.c:771 ) debug: update_validation: Configuration valid for schema: pacemaker-2.6 +( schemas.c:787 ) trace: update_validation: Stopping at pacemaker-2.6 +( schemas.c:843 ) info: update_validation: Transformed the configuration from pacemaker-1.2 to pacemaker-2.6 +error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined +error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option +error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity + +Current cluster status: + + dummy1 (ocf::pacemaker:Dummy): Stopped + dummy2 (ocf::pacemaker:Dummy): Stopped + +Transition Summary: +error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined +error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option +error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity + +Executing cluster transition: + +Revised cluster status: + + dummy1 (ocf::pacemaker:Dummy): Stopped + dummy2 (ocf::pacemaker:Dummy): Stopped + +=#=#=#= End test: Run crm_simulate with invalid, but possibly recoverable CIB (valid with X.Y+1) - OK (0) =#=#=#= +* Passed: crm_simulate - Run crm_simulate with invalid, but possibly recoverable CIB (valid with X.Y+1) +=#=#=#= Begin test: Make resulting CIB valid, although without validate-with attribute =#=#=#= +element rsc_order: validity error : Element rsc_order does not carry attribute to +element rsc_order: validity error : Element rsc_order does not carry attribute from +element rsc_order: validity error : No declaration for attribute first of element rsc_order +element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +element rsc_order: validity error : No declaration for attribute then of element rsc_order +element rsc_order: validity error : Element rsc_order does not carry attribute to +element rsc_order: validity error : Element rsc_order does not carry attribute from +element rsc_order: validity error : No declaration for attribute first of element rsc_order +element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +element rsc_order: validity error : No declaration for attribute then of element rsc_order +=#=#=#= Current cib after: Make resulting CIB valid, although without validate-with attribute =#=#=#= + + + + + + + + + + + + + + +=#=#=#= End test: Make resulting CIB valid, although without validate-with attribute - OK (0) =#=#=#= +* Passed: cibadmin - Make resulting CIB valid, although without validate-with attribute +=#=#=#= Begin test: Run crm_simulate with valid CIB, but without validate-with attribute =#=#=#= +Configuration validation is currently disabled. It is highly encouraged and prevents many common cluster issues. +bad-1.2.xml:10: element rsc_order: validity error : Element rsc_order does not carry attribute to +bad-1.2.xml:10: element rsc_order: validity error : Element rsc_order does not carry attribute from +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute first of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute then of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : Element rsc_order does not carry attribute to +bad-1.2.xml:10: element rsc_order: validity error : Element rsc_order does not carry attribute from +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute first of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute then of element rsc_order +error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined +error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option +error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity + +Current cluster status: + + dummy1 (ocf::pacemaker:Dummy): Stopped + dummy2 (ocf::pacemaker:Dummy): Stopped + +Transition Summary: +error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined +error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option +error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity + +Executing cluster transition: + +Revised cluster status: + + dummy1 (ocf::pacemaker:Dummy): Stopped + dummy2 (ocf::pacemaker:Dummy): Stopped + +=#=#=#= End test: Run crm_simulate with valid CIB, but without validate-with attribute - OK (0) =#=#=#= +* Passed: crm_simulate - Run crm_simulate with valid CIB, but without validate-with attribute +=#=#=#= Begin test: Make resulting CIB invalid, and without validate-with attribute =#=#=#= +element rsc_order: validity error : Element rsc_order does not carry attribute to +element rsc_order: validity error : Element rsc_order does not carry attribute from +element rsc_order: validity error : No declaration for attribute first of element rsc_order +element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +element rsc_order: validity error : No declaration for attribute then of element rsc_order +element rsc_order: validity error : Element rsc_order does not carry attribute to +element rsc_order: validity error : Element rsc_order does not carry attribute from +element rsc_order: validity error : No declaration for attribute first of element rsc_order +element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +element rsc_order: validity error : No declaration for attribute then of element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +Entity: line 10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +=#=#=#= Current cib after: Make resulting CIB invalid, and without validate-with attribute =#=#=#= + + + + + + + + + + + + + + +=#=#=#= End test: Make resulting CIB invalid, and without validate-with attribute - OK (0) =#=#=#= +* Passed: cibadmin - Make resulting CIB invalid, and without validate-with attribute +=#=#=#= Begin test: Run crm_simulate with invalid CIB, also without validate-with attribute =#=#=#= +Configuration validation is currently disabled. It is highly encouraged and prevents many common cluster issues. +bad-1.2.xml:10: element rsc_order: validity error : Element rsc_order does not carry attribute to +bad-1.2.xml:10: element rsc_order: validity error : Element rsc_order does not carry attribute from +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute first of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute then of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : Element rsc_order does not carry attribute to +bad-1.2.xml:10: element rsc_order: validity error : Element rsc_order does not carry attribute from +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute first of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute first-action of element rsc_order +bad-1.2.xml:10: element rsc_order: validity error : No declaration for attribute then of element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order +bad-1.2.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order +error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined +error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option +error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity +(constraints.:430 ) error: unpack_simple_rsc_order: Cannot invert rsc_order constraint ord_1-2. Please specify the inverse manually. + +Current cluster status: + + dummy1 (ocf::pacemaker:Dummy): Stopped + dummy2 (ocf::pacemaker:Dummy): Stopped + +Transition Summary: +error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined +error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option +error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity + +Executing cluster transition: + +Revised cluster status: + + dummy1 (ocf::pacemaker:Dummy): Stopped + dummy2 (ocf::pacemaker:Dummy): Stopped + +=#=#=#= End test: Run crm_simulate with invalid CIB, also without validate-with attribute - OK (0) =#=#=#= +* Passed: crm_simulate - Run crm_simulate with invalid CIB, also without validate-with attribute