commit crmsh for openSUSE:Factory
Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2016-04-28 16:55:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "crmsh" Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2016-04-01 13:03:11.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2016-04-28 16:59:01.000000000 +0200 @@ -1,0 +2,35 @@ +Thu Apr 21 13:46:53 UTC 2016 - kgronlund@suse.com + +- Update to version 2.2.0+git.1461246131.bf3c265: + + medium: scripts: Add vmware to data manifest (fate#318320) + + medium: ui_node: Fix crash in node fence command (bsc#974902) + + low: scripts: Preserve formatting in description for vmware wizard + + low: scripts: Better description for sbd + +------------------------------------------------------------------- +Tue Apr 19 16:46:59 UTC 2016 - kgronlund@suse.com + +- Update to version 2.2.0+git.1461083981.dab79a4: + + high: scripts: VMware fencing using vCenter (fate#318320) + +------------------------------------------------------------------- +Tue Apr 19 07:53:28 UTC 2016 - kgronlund@suse.com + +- Update to version 2.2.0+git.1461051741.724349d: + + low: cibconfig: Don't mix up CLI name with XML tag + + low: constants: Add missing reload operation to parser + + low: corosync: Recycle node IDs when possible + + low: parse: Don't validate operation name in parser (bsc#975357) + + low: scripts: Only print debug output locally unless there were remote actions + + low: scripts: Fix watchdog test in sbd-device (fate#318320) + + low: scripts: Shouldn't set -e here (fate#318320) + +- Remove bug-974902_crm-node-fence.patch + +------------------------------------------------------------------- +Fri Apr 15 13:22:44 UTC 2016 - ygao@suse.com + +- medium: ui_node: Fix "crm node fence" (bsc#974902) + - bug-974902_crm-node-fence.patch + +------------------------------------------------------------------- Old: ---- crmsh-2.2.0+git.1459359704.8d9b910.tar.bz2 New: ---- crmsh-2.2.0+git.1461246131.bf3c265.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.6Qf33r/_old 2016-04-28 16:59:03.000000000 +0200 +++ /var/tmp/diff_new_pack.6Qf33r/_new 2016-04-28 16:59:03.000000000 +0200 @@ -32,13 +32,13 @@ %{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%define version_unconverted 2.2.0+git.1459359704.8d9b910 +%define version_unconverted 2.2.0+git.1461246131.bf3c265 Name: crmsh Summary: High Availability cluster command-line interface License: GPL-2.0+ Group: %{pkg_group} -Version: 2.2.0+git.1459359704.8d9b910 +Version: 2.2.0+git.1461246131.bf3c265 Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.6Qf33r/_old 2016-04-28 16:59:03.000000000 +0200 +++ /var/tmp/diff_new_pack.6Qf33r/_new 2016-04-28 16:59:03.000000000 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/ClusterLabs/crmsh.git</param> - <param name="changesrevision">8d9b910e4a11cf8f8148b5f97e35602bc71bde03</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">bf3c265508ce63bf1eb9c873534c29cfa488420d</param></service></servicedata> \ No newline at end of file ++++++ crmsh-2.2.0+git.1459359704.8d9b910.tar.bz2 -> crmsh-2.2.0+git.1461246131.bf3c265.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/contrib/git-hook-pre-commit new/crmsh-2.2.0+git.1461246131.bf3c265/contrib/git-hook-pre-commit --- old/crmsh-2.2.0+git.1459359704.8d9b910/contrib/git-hook-pre-commit 1970-01-01 01:00:00.000000000 +0100 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/contrib/git-hook-pre-commit 2016-04-21 15:46:53.000000000 +0200 @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +root="$(git rev-parse --show-toplevel)" +[ -d "$root" ] || exit 1 + +./update-data-manifest.sh +git add ./data-manifest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/cibconfig.py new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/cibconfig.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/cibconfig.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/cibconfig.py 2016-04-21 15:46:53.000000000 +0200 @@ -437,7 +437,7 @@ ''' pass - def __check_unique_clash(self, set_obj_all): + def _check_unique_clash(self, set_obj_all): 'Check whether resource parameters with attribute "unique" clash' def process_primitive(prim, clash_dict): ''' @@ -492,7 +492,7 @@ ''' Test objects for sanity. This is about semantics. ''' - rc = self.__check_unique_clash(set_obj_all) + rc = self._check_unique_clash(set_obj_all) for obj in sorted(self.obj_set, key=lambda x: x.obj_id): rc |= obj.check_sanity() return rc @@ -1148,7 +1148,7 @@ def find_child_in_node(self, child): for c in self.node.iterchildren(): - if c.tag == child.obj_type and \ + if c.tag == child.node.tag and \ c.get("id") == child.obj_id: return c return None @@ -3144,7 +3144,7 @@ if child.parent and child.parent.obj_id != obj_id: common_err("%s already in use at %s" % (child_id, child.parent.obj_id)) return False - if child.obj_type not in constants.children_tags: + if child.node.tag not in constants.children_tags: common_err("%s may contain a primitive or a group; %s is %s" % (parent_tag, child_id, child.obj_type)) return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/constants.py new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/constants.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/constants.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/constants.py 2016-04-21 15:46:53.000000000 +0200 @@ -114,9 +114,10 @@ "migrate_from", "promote", "demote", - "notify") -ra_operations = ("probe", "monitor", "start", "stop", - "promote", "demote", "notify", "migrate_to", "migrate_from") + "notify", + "reload") +ra_operations = tuple(["probe"] + list(op_cli_names)) + subpfx_list = { "instance_attributes": "instance_attributes", "meta_attributes": "meta_attributes", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/corosync.py new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/corosync.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/corosync.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/corosync.py 2016-04-21 15:46:53.000000000 +0200 @@ -327,11 +327,16 @@ utils.remote_diff(local_path, nodes) -def next_nodeid(parser): +def get_free_nodeid(parser): ids = parser.get_all('nodelist.node.nodeid') if not ids: return 1 - return max([int(i) for i in ids]) + 1 + ids = [int(i) for i in ids] + max_id = max(ids) + 1 + for i in xrange(1, max_id): + if i not in ids: + return i + return max_id def get_ip(node): @@ -399,7 +404,7 @@ p = Parser(f) node_addr = addr - node_id = next_nodeid(p) + node_id = get_free_nodeid(p) node_name = name node_value = (make_value('nodelist.node.ring0_addr', node_addr) + make_value('nodelist.node.nodeid', str(node_id))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/logparser.py new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/logparser.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/logparser.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/logparser.py 2016-04-21 15:46:53.000000000 +0200 @@ -167,18 +167,18 @@ """ old_pe_l_file = prev.path() new_pe_l_file = self.path() + no_actions = self.actions_count() == 0 if not os.path.isfile(old_pe_l_file) or not os.path.isfile(new_pe_l_file): - return self.actions_count() == 0 - num_actions = self.actions_count() + return no_actions old_cib = xmlutil.compressed_file_to_cib(old_pe_l_file) new_cib = xmlutil.compressed_file_to_cib(new_pe_l_file) if old_cib is None or new_cib is None: - return num_actions == 0 + return no_actions prev_epoch = old_cib.attrib.get("epoch", "0") epoch = new_cib.attrib.get("epoch", "0") prev_admin_epoch = old_cib.attrib.get("admin_epoch", "0") admin_epoch = new_cib.attrib.get("admin_epoch", "0") - return num_actions == 0 and epoch == prev_epoch and admin_epoch == prev_admin_epoch + return no_actions and epoch == prev_epoch and admin_epoch == prev_admin_epoch def transition_info(self): print "Transition %s (%s -" % (self, utils.shorttime(self.start_ts)), @@ -196,8 +196,8 @@ Serialize to dict (for cache) """ o = {"tags": list(self.tags)} - for k in dir(self): - if k.startswith('__') or k in ("loc", "tags") or hasattr(getattr(self, k), '__call__'): + for k in self.__slots__: + if k in ("loc", "tags"): continue o[k] = getattr(self, k) return o @@ -206,10 +206,7 @@ def from_dict(cls, loc, obj): t = Transition(loc, None, None, None, None, None) for k, v in obj.iteritems(): - if k == "tags": - setattr(t, k, set(v)) - else: - setattr(t, k, v) + setattr(t, k, set(v) if k == "tags" else v) return t @@ -280,7 +277,6 @@ self.events = {} self.transitions = [] - self.transitions_map = {} self.from_ts = None self.to_ts = None @@ -329,8 +325,9 @@ self.events = collections.defaultdict(list) self.transitions = [] + # trans_num:pe_num -> Transition() - self.transitions_map = {} + transitions_map = {} startre = _transition_start_re() endre = _transition_end_re() @@ -367,11 +364,11 @@ if ts is None or dc is None: continue id_ = trans_str(dc, pe_file) - transition = self.transitions_map.get(id_) + transition = transitions_map.get(id_) if transition is None: transition = Transition(self.loc, dc, ts, trans_num, pe_file, pe_num) self.transitions.append(transition) - self.transitions_map[id_] = transition + transitions_map[id_] = transition crmlog.common_debug("{Transition: %s" % (transition)) if not os.path.isfile(transition.path()): @@ -389,7 +386,7 @@ ts, dc = logtime.syslog_ts_node(line) if ts is None or dc is None: continue - transition = self.transitions_map.get(trans_str(dc, pe_file)) + transition = transitions_map.get(trans_str(dc, pe_file)) if transition is None: # transition end without previous begin... crmlog.common_debug("Found transition end without start: %s: %s - %s:%s" % (ts, filename, trans_num, pe_file)) @@ -429,8 +426,6 @@ if t.empty(self.transitions[i - 1]): empties.append(t) self.transitions = [t for t in self.transitions if t not in empties] - for e in empties: - del self.transitions_map[trans_str(e.dc, e.pe_file)] self._save_cache() if missing_pefiles: rdict = collections.defaultdict(list) @@ -595,9 +590,6 @@ return False self.events = obj["events"] self.transitions = [Transition.from_dict(self.loc, t) for t in obj["transitions"]] - self.transitions_map = {} - for t in self.transitions: - self.transitions_map[trans_str(t.dc, t.pe_file)] = t return True def _metafile(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/orderedset.py new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/orderedset.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/orderedset.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/orderedset.py 2016-04-21 15:46:53.000000000 +0200 @@ -67,8 +67,8 @@ yield curr[KEY] curr = curr[PREV] - def pop(self, last=True): - # changed default to last=False - by default, treat as queue. + def pop(self): + last = True if not self: raise KeyError('set is empty') key = next(reversed(self)) if last else next(iter(self)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/parse.py new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/parse.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/parse.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/parse.py 2016-04-21 15:46:53.000000000 +0200 @@ -37,7 +37,6 @@ _UNAME_RE = re.compile(r'([^:]+)(:(normal|member|ping|remote))?$', re.IGNORECASE) _TEMPLATE_RE = re.compile(r'@(.+)$') _RA_TYPE_RE = re.compile(r'[a-z0-9_:-]+$', re.IGNORECASE) -_OPTYPE_RE = re.compile(r'(%s)$' % ('|'.join(constants.op_cli_names)), re.IGNORECASE) _TAG_RE = re.compile(r"([a-zA-Z_][^\s:]*):?$") _ROLE2_RE = re.compile(r"role=(.+)$", re.IGNORECASE) _TARGET_RE = re.compile(r'([\w=-]+):$') @@ -138,12 +137,13 @@ "Called by do_parse(). Raises ParseError if parsing fails." raise NotImplementedError - def err(self, errmsg): + def err(self, msg, context=None, token=None): "Report a parse error and abort." - token = None - if self.has_tokens(): + if token is None and self.has_tokens(): token = self._cmd[self._currtok] - syntax_err(self._cmd, context=self._cmd[0], token=token, msg=errmsg) + if context is None: + context = self._cmd[0] + syntax_err(self._cmd, context=context, token=token, msg=msg) raise ParseError def begin(self, cmd, min_args=-1): @@ -694,7 +694,7 @@ </op> """ self.match('op') - op_type = self.match(_OPTYPE_RE, errmsg="Expected operation type") + op_type = self.match_identifier() all_attrs = self.match_nvpairs(minpairs=0) node = xmlutil.new('op', name=op_type) if not any(nvp.get('name') == 'interval' for nvp in all_attrs): @@ -1452,11 +1452,7 @@ return l def err(self, errmsg, token=''): - syntax_err(self.parent._cmd, - context=self.q_attr, - token=token, - msg=errmsg) - raise ParseError + self.parent.err(msg=errmsg, context=self.q_attr, token=token) def update_attrs(self, bracket, tokpos): if bracket in ('(', '['): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/scripts.py new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/scripts.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/scripts.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/scripts.py 2016-04-21 15:46:53.000000000 +0200 @@ -1117,13 +1117,14 @@ def _print_debug(printer, local_node, hosts, workdir, opts): "Print debug output (if any)" dbglog = os.path.join(workdir, 'crm_script.debug') - for host, result in _parallax_call(printer, hosts, - "if [ -f '%s' ]; then cat '%s'; fi" % (dbglog, dbglog), - opts).iteritems(): - if isinstance(result, parallax.Error): - printer.error(host, result) - else: - printer.output(host, *result) + if hosts: + for host, result in _parallax_call(printer, hosts, + "if [ -f '%s' ]; then cat '%s'; fi" % (dbglog, dbglog), + opts).iteritems(): + if isinstance(result, parallax.Error): + printer.error(host, result) + else: + printer.output(host, *result) if os.path.isfile(dbglog): f = open(dbglog).read() printer.output(local_node, 0, f, '') @@ -2082,8 +2083,10 @@ if not dry_run: if not config.core.debug: _run_cleanup(printer, has_remote_actions, local_node, hosts, workdir, opts) - else: + elif has_remote_actions: _print_debug(printer, local_node, hosts, workdir, opts) + else: + _print_debug(printer, local_node, None, workdir, opts) def _remove_empty_lines(txt): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/ui_node.py new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/ui_node.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/crmsh/ui_node.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/crmsh/ui_node.py 2016-04-21 15:46:53.000000000 +0200 @@ -213,9 +213,9 @@ if not utils.is_name_sane(node): return False if not config.core.force and \ - not utils.ask("Fencing %s will shut down the node and migrate any resources that are running on it! Do you want to fence %s?" % node): + not utils.ask("Fencing %s will shut down the node and migrate any resources that are running on it! Do you want to fence %s?" % (node, node)): return False - if utils.is_remote_node(node): + if xmlutil.is_remote_node(node): return utils.ext_cmd("stonith_admin -F '%s'" % (node)) == 0 else: return utils.ext_cmd(self.node_fence % (node)) == 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/data-manifest new/crmsh-2.2.0+git.1461246131.bf3c265/data-manifest --- old/crmsh-2.2.0+git.1459359704.8d9b910/data-manifest 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/data-manifest 2016-04-21 15:46:53.000000000 +0200 @@ -50,6 +50,7 @@ scripts/sbd-device/main.yml scripts/sbd/main.yml scripts/virtual-ip/main.yml +scripts/vmware/main.yml templates/apache templates/clvm templates/filesystem diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/scripts/sbd/main.yml new/crmsh-2.2.0+git.1461246131.bf3c265/scripts/sbd/main.yml --- old/crmsh-2.2.0+git.1459359704.8d9b910/scripts/sbd/main.yml 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/scripts/sbd/main.yml 2016-04-21 15:46:53.000000000 +0200 @@ -9,9 +9,11 @@ Create a SBD STONITH resource. SBD must be configured to use a particular shared storage device using /etc/sysconfig/sbd. - There is quite a bit more to do to make this SBD operational. - See http://www.linux-ha.org/wiki/SBD_Fencing for information, or - the sbd(8) manual page. + This wizard can optionally create and configure a SBD device. + A shared device must be available and visible on all nodes. + + For more information, see http://www.linux-ha.org/wiki/SBD_Fencing + or the sbd(8) manual page. parameters: - name: id diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/scripts/sbd-device/main.yml new/crmsh-2.2.0+git.1461246131.bf3c265/scripts/sbd-device/main.yml --- old/crmsh-2.2.0+git.1459359704.8d9b910/scripts/sbd-device/main.yml 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/scripts/sbd-device/main.yml 2016-04-21 15:46:53.000000000 +0200 @@ -32,15 +32,15 @@ systemctl is-active --quiet sbd && { echo "ERROR: SBD daemon is already running"; exit 1; } || true test -b "{{device}}" || { echo "ERROR: Not a device: {{device}"; exit 1; } lsmod | egrep "(wd|dog)" || { echo "ERROR: No watchdog kernel module loaded"; exit 1; } - test -b "{{watchdog}}" || { echo "ERROR: Not a device: {{watchdog}}"; exit 1; } + test -c "{{watchdog}}" || { echo "ERROR: Not a device: {{watchdog}}"; exit 1; } - shortdesc: Initialize the SBD device sudo: true nodes: local call: | #!/bin/sh - set -e - sbd -d "{{device}}" create + sbd dump &> /dev/null || sbd -d "{{device}}" create + # sbd allocate "$(uname -n)" # FIXME - shortdesc: Verify SBD Device call: | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/scripts/vmware/main.yml new/crmsh-2.2.0+git.1461246131.bf3c265/scripts/vmware/main.yml --- old/crmsh-2.2.0+git.1459359704.8d9b910/scripts/vmware/main.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/scripts/vmware/main.yml 2016-04-21 15:46:53.000000000 +0200 @@ -0,0 +1,56 @@ +# Copyright (C) 2016 Kristoffer Gronlund +# +# License: GNU General Public License (GPL) +version: 2.2 +category: Stonith +shortdesc: VMWare vCenter / ESX Server Fencing +longdesc: | + Fencing for VMware virtualized hosts using ESX Server or vCenter. + + This wizard configures a fencing resource for a single node. + You will need to run the wizard for each node to fence. + + Prerequisites + + 1. Install the vSphere Web Services SDK on all nodes. + + 2. Generate vCenter credentials using credstore_admin.pl + + 3. Copy credentials to the same location on all nodes. + +parameters: + - name: id + type: resource + shortdesc: Base Resource ID + value: vcenter-fencing + required: true + - name: node_name + type: string + shortdesc: Name of node to fence + required: true + - name: machine_name + type: string + shortdesc: Name of machine in vCenter inventory + required: true + - name: server + type: string + shortdesc: VCenter server URL + required: true + example: vcenter.example.com + - name: credstore + type: string + shortdesc: Credentials file name + required: true + +actions: + - cib: | + primitive {{id}}-{{node_name}} stonith:external/vcenter + VI_SERVER="{{server}}" + VI_CREDSTORE="{{credstore}}" + HOSTLIST="{{node_name}}={{machine_name}}" + RESETPOWERON="0" + pcmk_host_check="static-list" + pcmk_host_list="{{node_name}}" + op monitor interval="60s" + location loc-{{id}}-{{node_name}} {{id}}-{{node_name}} -inf: {{node_name}} + property stonith-enabled=true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1459359704.8d9b910/test/unittests/test_corosync.py new/crmsh-2.2.0+git.1461246131.bf3c265/test/unittests/test_corosync.py --- old/crmsh-2.2.0+git.1459359704.8d9b910/test/unittests/test_corosync.py 2016-03-31 08:00:48.000000000 +0200 +++ new/crmsh-2.2.0+git.1461246131.bf3c265/test/unittests/test_corosync.py 2016-04-21 15:46:53.000000000 +0200 @@ -67,7 +67,7 @@ p.add('nodelist', make_section('nodelist.node', make_value('nodelist.node.ring0_addr', '10.10.10.10') + - make_value('nodelist.node.nodeid', str(corosync.next_nodeid(p))))) + make_value('nodelist.node.nodeid', str(corosync.get_free_nodeid(p))))) _valid(p) self.assertEqual(p.count('nodelist.node'), 6) self.assertEqual(p.get_all('nodelist.node.nodeid'), @@ -75,11 +75,11 @@ def test_add_node_no_nodelist(self): "test checks that if there is no nodelist, no node is added" - from crmsh.corosync import make_section, make_value, next_nodeid + from crmsh.corosync import make_section, make_value, get_free_nodeid p = Parser(F1) _valid(p) - nid = next_nodeid(p) + nid = get_free_nodeid(p) self.assertEqual(p.count('nodelist.node'), nid - 1) p.add('nodelist', make_section('nodelist.node', @@ -89,11 +89,11 @@ self.assertEqual(p.count('nodelist.node'), nid - 1) def test_add_node_nodelist(self): - from crmsh.corosync import make_section, make_value, next_nodeid + from crmsh.corosync import make_section, make_value, get_free_nodeid p = Parser(F2) _valid(p) - nid = next_nodeid(p) + nid = get_free_nodeid(p) c = p.count('nodelist.node') p.add('nodelist', make_section('nodelist.node', @@ -101,7 +101,7 @@ make_value('nodelist.node.nodeid', str(nid)))) _valid(p) self.assertEqual(p.count('nodelist.node'), c + 1) - self.assertEqual(next_nodeid(p), nid + 1) + self.assertEqual(get_free_nodeid(p), nid + 1) def test_remove_node(self): p = Parser(F2) @@ -118,5 +118,15 @@ _valid(p) self.assertEqual(p.count('service.ver'), 1) + def test_get_free_nodeid(self): + def ids(*lst): + class Ids(object): + def get_all(self, _arg): + return lst + return Ids() + self.assertEqual(1, corosync.get_free_nodeid(ids('2', '5'))) + self.assertEqual(3, corosync.get_free_nodeid(ids('1', '2', '5'))) + self.assertEqual(4, corosync.get_free_nodeid(ids('1', '2', '3'))) + if __name__ == '__main__': unittest.main()
participants (1)
-
root@hilbert.suse.de