commit crmsh for openSUSE:Factory
Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2018-09-25 15:44:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "crmsh" Tue Sep 25 15:44:02 2018 rev:148 rq:637867 version:4.0.0+git.1537860833.be41d63c Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2018-08-20 16:19:01.736789318 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2018-09-25 15:44:14.517173899 +0200 @@ -1,0 +2,14 @@ +Tue Sep 25 07:44:44 UTC 2018 - kgronlund@suse.com + +- Update to version 4.0.0+git.1537860833.be41d63c: + * fix: bootstrap: non interactive unicast cluster init and join(bsc#1109172) + * medium: bootstrap: Disable strict host key checking on all ssh invocations + * medium: support ocfs2 log collecting + * hbreport: process name change for pacemaker 2.0(bsc#1106052) + * Fix: bootstrap: "-i" option doesn't work(bsc#1103833, bsc#1103834) + * Low: bootstrap: No warning message when using '-q' + * high: ra: Support Pacemaker 2.0 daemon names + * high: config: Locate pacemaker daemons more intelligently (#67) (bsc#1096783) + * Fix: TypeError in logparser.py(bsc#1093433) + +------------------------------------------------------------------- Old: ---- crmsh-4.0.0+git.1526547258.54aafa1d.tar.bz2 New: ---- crmsh-4.0.0+git.1537860833.be41d63c.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.G8wnek/_old 2018-09-25 15:44:15.029173352 +0200 +++ /var/tmp/diff_new_pack.G8wnek/_new 2018-09-25 15:44:15.037173344 +0200 @@ -36,7 +36,7 @@ Summary: High Availability cluster command-line interface License: GPL-2.0-or-later Group: %{pkg_group} -Version: 4.0.0+git.1526547258.54aafa1d +Version: 4.0.0+git.1537860833.be41d63c Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.G8wnek/_old 2018-09-25 15:44:15.077173301 +0200 +++ /var/tmp/diff_new_pack.G8wnek/_new 2018-09-25 15:44:15.077173301 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/ClusterLabs/crmsh.git</param> - <param name="changesrevision">ce8241d2ea413dd5a95eec87f57381ee25077f1c</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">c393b5c661a87f1f9e2bc03be587051aedc33220</param></service></servicedata> \ No newline at end of file ++++++ crmsh-4.0.0+git.1526547258.54aafa1d.tar.bz2 -> crmsh-4.0.0+git.1537860833.be41d63c.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/Dockerfile new/crmsh-4.0.0+git.1537860833.be41d63c/Dockerfile --- old/crmsh-4.0.0+git.1526547258.54aafa1d/Dockerfile 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/Dockerfile 2018-09-25 09:33:53.000000000 +0200 @@ -1,4 +1,4 @@ -FROM opensuse:42.3 +FROM opensuse/leap:15 MAINTAINER Kristoffer Gronlund version: 0.5 ENV container docker diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/bootstrap.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/bootstrap.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/bootstrap.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/bootstrap.py 2018-09-25 09:33:53.000000000 +0200 @@ -96,8 +96,7 @@ Log and display a warning message. """ log("WARNING: {}".format(" ".join(str(arg) for arg in args))) - if not _context.quiet: - print(term.render(clidisplay.warn("! {}".format(" ".join(str(arg) for arg in args))))) + print(term.render(clidisplay.warn("! {}".format(" ".join(str(arg) for arg in args))))) @utils.memoize @@ -856,7 +855,7 @@ warn(" Address already in use: {}".format(addr)) return False for net in all_: - if addr in utils.Network(net): + if utils.ip_in_network(addr, net): return True warn(" Address '{}' invalid, expected one of {}".format(addr, all_)) return False @@ -919,9 +918,13 @@ all_ = utils.network_v6_all() for item in all_.values(): network_list.extend(item) - default_networks = map(utils.get_ipv6_network, network_list) + default_networks = [utils.get_ipv6_network(x) for x in network_list] else: - default_networks = utils.network_all() + network_list = utils.network_all() + if len(network_list) > 1: + default_networks = [_context.ip_network, network_list.remove(_context.ip_network)] + else: + default_networks = _context.ip_network if not default_networks: error("No network configured at {}!".format(utils.this_node())) @@ -1008,7 +1011,11 @@ network_list.extend(item) default_networks = [utils.get_ipv6_network(x) for x in network_list] else: - default_networks = utils.network_all() + network_list = utils.network_all() + if len(network_list) > 1: + default_networks = [_context.ip_network, network_list.remove(_context.ip_network)] + else: + default_networks = _context.ip_network if not default_networks: error("No network configured at {}!".format(utils.this_node())) @@ -1565,7 +1572,7 @@ # If we *were* updating /etc/hosts, the next line would have "\"$hosts_line\"" as # the last arg (but this requires re-enabling this functionality in ha-cluster-init) - if not invoke("ssh root@{} crm cluster init csync2_remote {}".format(seed_host, utils.this_node())): + if not invoke("ssh -o StrictHostKeyChecking=no root@{} crm cluster init csync2_remote {}".format(seed_host, utils.this_node())): error("Can't invoke crm cluster init init csync2_remote on {}".format(seed_host)) # This is necessary if syncing /etc/hosts (to ensure everyone's got the @@ -1589,7 +1596,7 @@ # they haven't gone to all nodes in the cluster, which means a # subseqent join of another node can fail its sync of corosync.conf # when it updates expected_votes. Grrr... - if not invoke('ssh root@%s "csync2 -mr / ; csync2 -fr / ; csync2 -xv"' % (seed_host)): + if not invoke('ssh -o StrictHostKeyChecking=no root@%s "csync2 -mr / ; csync2 -fr / ; csync2 -xv"' % (seed_host)): print("") warn("csync2 run failed - some files may not be sync'd") @@ -1706,12 +1713,11 @@ is_unicast = "nodelist" in open(corosync.conf()).read() if is_unicast: ringXaddr_res = [] - print("") for i in 0, 1: while True: ringXaddr = prompt_for_string('Address for ring{}'.format(i), r'([0-9]+\.){3}[0-9]+|[0-9a-fA-F]{1,4}:', - "", + _context.ip_address if i == 0 and _context.ip_address else "", valid_ucastIP, ringXaddr_res) if not ringXaddr: @@ -1721,9 +1727,13 @@ tmp = re.findall(r' {}/[0-9]+ '.format(ringXaddr), outp, re.M)[0].strip() peer_ip = corosync.get_value("nodelist.node.ring{}_addr".format(i)) # peer ring0_addr and local ring0_addr must be configured in the same network - if peer_ip not in utils.Network(tmp): - print(term.render(clidisplay.error(" Peer IP {} is not in the same network: {}".format(peer_ip, tmp)))) - continue + if not utils.ip_in_network(peer_ip, tmp): + errmsg = " Peer IP {} is not in the same network: {}".format(peer_ip, tmp) + if _context.yes_to_all: + error(errmsg) + else: + print(term.render(clidisplay.error(errmsg))) + continue ringXaddr_res.append(ringXaddr) break @@ -1733,11 +1743,11 @@ invoke("rm -f /var/lib/heartbeat/crm/* /var/lib/pacemaker/cib/*") corosync.add_node_ucast(ringXaddr_res) csync2_update(corosync.conf()) - invoke("ssh root@{} corosync-cfgtool -R".format(seed_host)) + invoke("ssh -o StrictHostKeyChecking=no root@{} corosync-cfgtool -R".format(seed_host)) # if no SBD devices are configured, # check the existing cluster if the sbd service is enabled - if not configured_sbd_device() and invoke("ssh root@{} systemctl is-enabled sbd.service".format(seed_host)): + if not configured_sbd_device() and invoke("ssh -o StrictHostKeyChecking=no root@{} systemctl is-enabled sbd.service".format(seed_host)): _context.diskless_sbd = True if ipv6_flag and not is_unicast: @@ -1902,7 +1912,7 @@ _context.host_status = 1 return - _rc, outp, _errp = utils.get_stdout_stderr("ssh root@{} \"hostname\"".format(seed_host)) + _rc, outp, _errp = utils.get_stdout_stderr("ssh -o StrictHostKeyChecking=no root@{} \"hostname\"".format(seed_host)) if outp: _context.connect_name = seed_host _context.cluster_node = outp.strip() @@ -1917,7 +1927,7 @@ if nodename not in xmlutil.listnodes(): error("Specified node {} is not configured in cluster, can not remove".format(nodename)) - _rc, outp, _errp = utils.get_stdout_stderr("ssh root@{} \"hostname\"".format(nodename)) + _rc, outp, _errp = utils.get_stdout_stderr("ssh -o StrictHostKeyChecking=no root@{} \"hostname\"".format(nodename)) if outp: _context.connect_name = seed_host _context.cluster_node = nodename @@ -1934,7 +1944,7 @@ error("Invalid IP address") # try to use the IP address to connect - _rc, outp, _errp = utils.get_stdout_stderr("ssh root@{} \"hostname\"".format(nodename)) + _rc, outp, _errp = utils.get_stdout_stderr("ssh -o StrictHostKeyChecking=no root@{} \"hostname\"".format(nodename)) if outp: ipaddr = nodename nodename = outp.strip() @@ -1958,12 +1968,12 @@ if _context.host_status != 0: status("Stopping the corosync service") - if not invoke('ssh root@{} "systemctl stop corosync"'.format(_context.connect_name)): + if not invoke('ssh -o StrictHostKeyChecking=no root@{} "systemctl stop corosync"'.format(_context.connect_name)): error("Stopping corosync on {} failed".format(_context.connect_name)) # delete configuration files from the node to be removed toremove = [SYSCONFIG_SBD, CSYNC2_CFG, corosync.conf(), CSYNC2_KEY, COROSYNC_AUTH] - if not invoke('ssh root@{} "bash -c \\\"rm -f {} && rm -f /var/lib/heartbeat/crm/* /var/lib/pacemaker/cib/*\\\""'.format(node, " ".join(toremove))): + if not invoke('ssh -o StrictHostKeyChecking=no root@{} "bash -c \\\"rm -f {} && rm -f /var/lib/heartbeat/crm/* /var/lib/pacemaker/cib/*\\\""'.format(node, " ".join(toremove))): error("Deleting the configuration files failed") else: # Check node status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/command.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/command.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/command.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/command.py 2018-09-25 09:33:53.000000000 +0200 @@ -420,7 +420,7 @@ ''' return tab completions ''' - return list(self._children.keys()) + return [x for x in self._children.keys() if x not in self._aliases] def get_child(self, child): ''' @@ -455,9 +455,10 @@ child = getattr(cls, attr) return child if attr.startswith('do_') and inspect.isfunction(child) else None - def add_aliases(children, info): + def add_aliases(children, info, aliases): "Add any aliases for command to child map" for alias in info.aliases: + aliases.append(alias) children[alias] = info def add_help(info): @@ -480,23 +481,25 @@ elif info.type == 'level': help_module.add_help(entry, level=info.name) - def prepare(children, child): + def prepare(children, child, aliases): info = ChildInfo(child, cls) if info.type == 'command' and not is_valid_command_function(info.function): raise ValueError("Invalid command function: %s.%s" % (cls.__name__, info.function.__name__)) children[info.name] = info - add_aliases(children, info) + add_aliases(children, info, aliases) add_help(info) children = {} + aliases = [] for child_name in dir(cls): if child_name == 'do_up' and re.search("ui_root.Root", str(cls)): continue child = get_if_command(child_name) if child: - prepare(children, child) + prepare(children, child, aliases) setattr(cls, '_children', children) + setattr(cls, '_aliases', aliases) return children diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/config.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/config.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/config.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/config.py 2018-09-25 09:33:53.000000000 +0200 @@ -53,6 +53,23 @@ return path +def find_pacemaker_daemons(): + ''' + Search for the pacemaker daemon location by trying to find + where the daemons are. The control daemon is either + pacemaker-controld (2.0+) or crmd depending on the version. + ''' + candidate_dirs = ('{}/pacemaker'.format(d) for d in configure_libdir()) + for d in candidate_dirs: + daemon = '{}/pacemaker-controld'.format(d) + if os.path.exists(daemon): + return d + daemon = '{}/crmd'.format(d) + if os.path.exists(daemon): + return d + return '/usr/lib/pacemaker' + + # opt_ classes # members: default, completions, validate() @@ -227,7 +244,7 @@ 'sharedir': opt_dir('%(datadir)s/crmsh'), 'cache': opt_dir('%(cachedir)s/crm'), 'crm_config': opt_dir('%(varlib)s/pacemaker/cib'), - 'crm_daemon_dir': opt_dir('%(libdir)s/pacemaker'), + 'crm_daemon_dir': opt_dir(find_pacemaker_daemons()), 'crm_daemon_user': opt_string('hacluster'), 'ocf_root': opt_dir('%(libdir)s/ocf'), 'crm_dtd_dir': opt_dir('%(datadir)s/pacemaker'), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/constants.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/constants.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/constants.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/constants.py 2018-09-25 09:33:53.000000000 +0200 @@ -334,6 +334,8 @@ } meta_progs = ("crmd", "pengine", "stonithd", "cib") +meta_progs_20 = ("pacemaker-controld", "pacemaker-schedulerd", "pacemaker-fenced", "pacemaker-based") + # elide these properties from tab completion crmd_metadata_do_not_complete = ("dc-version", "cluster-infrastructure", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/logparser.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/logparser.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/logparser.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/logparser.py 2018-09-25 09:33:53.000000000 +0200 @@ -468,7 +468,7 @@ while any(f is not None for _, _, f in lines): x = min(lines, key=lambda v: v[0]) - if x[2] is None: + if x[0] is None or x[2] is None: break if self.to_ts and x[0] > self.to_ts: break diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/main.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/main.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/main.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/main.py 2018-09-25 09:33:53.000000000 +0200 @@ -60,10 +60,15 @@ # prefer the user set PATH def envsetup(): - mybinpath = os.path.dirname(sys.argv[0]) path = os.environ["PATH"].split(':') - for p in mybinpath, config.path.crm_daemon_dir: - if p not in path: + # always add these dirs to PATH if they exist + libexec_dirs = ('/usr/lib64', '/usr/libexec', '/usr/lib', + '/usr/local/lib64', '/usr/local/libexec', '/usr/local/lib') + pacemaker_dirs = set("{}/pacemaker".format(d) for d in libexec_dirs) + pacemaker_dirs.add(config.path.crm_daemon_dir) + pacemaker_dirs.add(os.path.dirname(sys.argv[0])) + for p in pacemaker_dirs: + if p not in path and os.path.isdir(p): os.environ['PATH'] = "%s:%s" % (os.environ['PATH'], p) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/ra.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/ra.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/ra.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/ra.py 2018-09-25 09:33:53.000000000 +0200 @@ -58,7 +58,7 @@ return False if userdir.getuser() not in ("root", config.path.crm_daemon_user): return False - if not (is_program(lrmadmin_prog) and is_process("lrmd")): + if not (is_program(lrmadmin_prog) and is_process(pacemaker_execd())): return False return utils.ext_cmd(">/dev/null 2>&1 %s -C" % lrmadmin_prog) == 0 @@ -227,23 +227,23 @@ @utils.memoize def get_pe_meta(): - return RAInfo("pengine", "metadata") + return RAInfo(utils.pacemaker_schedulerd(), "metadata") @utils.memoize def get_crmd_meta(): - return RAInfo("crmd", "metadata", + return RAInfo(utils.pacemaker_controld(), "metadata", exclude_from_completion=constants.crmd_metadata_do_not_complete) @utils.memoize def get_stonithd_meta(): - return RAInfo("stonithd", "metadata") + return RAInfo(utils.pacemaker_fenced(), "metadata") @utils.memoize def get_cib_meta(): - return RAInfo("cib", "metadata") + return RAInfo(utils.pacemaker_based(), "metadata") @utils.memoize @@ -266,7 +266,7 @@ ''' Do external program metadata. ''' - prog = is_program(prog) + prog = utils.pacemaker_daemon(prog) if prog: rc, l = stdout2list("%s metadata" % prog) if rc == 0: @@ -605,6 +605,8 @@ return cache.retrieve(sid) if self.ra_class in constants.meta_progs: l = prog_meta(self.ra_class) + elif self.ra_class in constants.meta_progs_20: + l = prog_meta(self.ra_class) else: l = ra_meta(self.ra_class, self.ra_type, self.ra_provider) if not l: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/ui_context.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/ui_context.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/ui_context.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/ui_context.py 2018-09-25 09:33:53.000000000 +0200 @@ -47,10 +47,20 @@ ''' Execute the given command line. ''' + def trans_to_help(line): + line_list = line.split() + if line_list[-1] in ["-h", "--help"] and \ + line_list[-2] == "property": + return " ".join(line_list[:-2] + ["help", "property"]) + else: + return line + line = line.strip() if not line or line.startswith('#'): return True + line = trans_to_help(line) + self._mark = len(self.stack) self._in_transit = False self._wait_for_dc = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/ui_ra.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/ui_ra.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/ui_ra.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/ui_ra.py 2018-09-25 09:33:53.000000000 +0200 @@ -115,6 +115,8 @@ ra_type, ra_class, ra_provider = args[0], args[1], args[2] elif args[0] in constants.meta_progs: ra_class, ra_provider, ra_type = args[0], None, None + elif args[0] in constants.meta_progs_20: + ra_class, ra_provider, ra_type = args[0], None, None else: ra_class, ra_provider, ra_type = ra.disambiguate_ra_type(args[0]) agent = ra.RAInfo(ra_class, ra_type, ra_provider) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/utils.py new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/utils.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/crmsh/utils.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/crmsh/utils.py 2018-09-25 09:33:53.000000000 +0200 @@ -14,6 +14,7 @@ import bz2 import fnmatch import gc +import ipaddress from contextlib import contextmanager from . import config from . import userdir @@ -201,6 +202,66 @@ return None +def pacemaker_20_daemon(new, old): + "helper to discover renamed pacemaker daemons" + if is_program(new): + return new + return old + + +@memoize +def pacemaker_attrd(): + return pacemaker_20_daemon("pacemaker-attrd", "attrd") + + +@memoize +def pacemaker_based(): + return pacemaker_20_daemon("pacemaker-based", "cib") + + +@memoize +def pacemaker_controld(): + return pacemaker_20_daemon("pacemaker-controld", "crmd") + + +@memoize +def pacemaker_execd(): + return pacemaker_20_daemon("pacemaker-execd", "lrmd") + + +@memoize +def pacemaker_fenced(): + return pacemaker_20_daemon("pacemaker-fenced", "stonithd") + + +@memoize +def pacemaker_remoted(): + return pacemaker_20_daemon("pacemaker-remoted", "pacemaker_remoted") + + +@memoize +def pacemaker_schedulerd(): + return pacemaker_20_daemon("pacemaker-schedulerd", "pengine") + + +def pacemaker_daemon(name): + if name == "attrd" or name == "pacemaker-attrd": + return pacemaker_attrd() + if name == "cib" or name == "pacemaker-based": + return pacemaker_based() + if name == "crmd" or name == "pacemaker-controld": + return pacemaker_controld() + if name == "lrmd" or name == "pacemaker-execd": + return pacemaker_execd() + if name == "stonithd" or name == "pacemaker-fenced": + return pacemaker_fenced() + if name == "pacemaker_remoted" or name == "pacemeaker-remoted": + return pacemaker_remoted() + if name == "pengine" or name == "pacemaker-schedulerd": + return pacemaker_schedulerd() + raise ValueError("Not a Pacemaker daemon name: {}".format(name)) + + def can_ask(): """ Is user-interactivity possible? @@ -1436,7 +1497,7 @@ def get_pcmk_version(dflt): version = dflt - crmd = is_program('crmd') + crmd = pacemaker_controld() if crmd: cmd = crmd else: @@ -1977,177 +2038,23 @@ def get_ipv6_network(addr_with_mask): - return Network(addr_with_mask).network().to_compressed() + return str(ipaddress.ip_interface(addr_with_mask).network.network_address) def gen_nodeid_from_ipv6(addr): - return IP(addr).ip_long() % 1000000000 - + return int(ipaddress.ip_address(addr)) % 1000000000 -MAX_IPV6 = (1 << 128) - 1 -MAX_IPV4 = (1 << 32) - 1 +def ip_in_network(addr, net): + return ipaddress.ip_address(addr) in ipaddress.ip_interface(net).network -class IP(object): - """ - learn from https://github.com/tehmaze/ipcalc - """ - def __init__(self, ip, mask=None, version=0): - """Initialize a new IPv4 or IPv6 address.""" - self.mask = mask - self.v = 0 - if isinstance(ip, int): - self.ip = int(ip) - if self.ip <= MAX_IPV4: - self.v = version or 4 - self.dq = self._itodq(ip) - else: - self.v = version or 6 - self.dq = self._itodq(ip) - else: - if '/' in ip: - ip, mask = ip.split('/', 1) - self.mask = int(mask) - self.v = version or 0 - self.dq = ip - self.ip = self._dqtoi(ip) - - if self.mask is None: - self.mask = {4: 32, 6: 128}[self.v] - elif isinstance(self.mask, str): - self.mask = int(self.mask) - - def __str__(self): - return self.dq - - def _dqtoi(self, dq): - """Convert dotquad or hextet to long.""" - if ':' in dq: - if not valid_ip_addr(dq, 6): - raise ValueError("Invalid IPv6 address") - return self._dqtoi_ipv6(dq) - if '.' in dq: - if not valid_ip_addr(dq): - raise ValueError("Invalid IPv4 address") - return self._dqtoi_ipv4(dq) - - raise ValueError("Invalid address input") - - def _dqtoi_ipv4(self, dq): - q = dq.split('.') - q.reverse() - self.v = 4 - return sum(int(byte) << 8 * index for index, byte in enumerate(q)) - - def _dqtoi_ipv6(self, dq): - hx = dq.split(':') - if len(hx) < 8: - ix = hx.index('') - px = len(hx[ix + 1:]) - for x in range(ix + px + 1, 8): - hx.insert(ix, '0') - - ip = '' - hx = [x == '' and '0' or x for x in hx] - for h in hx: - if len(h) < 4: - h = '%04x' % int(h, 16) - ip += h - self.v = 6 - return int(ip, 16) - - def _itodq(self, n): - """Convert long to dotquad or hextet.""" - if self.v == 4: - return '.'.join(map(str, [ - (n >> 24) & 0xff, - (n >> 16) & 0xff, - (n >> 8) & 0xff, - n & 0xff, - ])) - n = '%032x' % n - return ':'.join(n[4 * x:4 * x + 4] for x in range(0, 8)) +class IP: + def __init__(self, addr): + self.addr = ipaddress.ip_address(addr) def version(self): - return self.v - - def ip_long(self): - return self.ip - - def to_compressed(self): - """ - Compress an IP address to its shortest possible compressed form. - """ - if self.v == 6: - quads = ['%x' % (int(q, 16)) for q in self.dq.split(':')] - quadc = ':%s:' % (':'.join(quads),) - zeros = [0, -1] - - # Find the largest group of zeros - for match in re.finditer(r'(:[:0]+)', quadc): - count = len(match.group(1)) - 1 - if count > zeros[0]: - zeros = [count, match.start(1)] - - count, where = zeros - if count: - quadc = quadc[:where] + ':' + quadc[where + count:] - - quadc = re.sub(r'((^:)|(:$))', '', quadc) - quadc = re.sub(r'((^:)|(:$))', '::', quadc) - return quadc - - -class Network(IP): - """ - learn from https://github.com/tehmaze/ipcalc - """ - def netmask_long(self): - """ - Network netmask derived from subnet size, as long. - """ - if self.version() == 4: - return (MAX_IPV4 >> (32 - self.mask)) << (32 - self.mask) - return (MAX_IPV6 >> (128 - self.mask)) << (128 - self.mask) - - def network(self): - """ - Network address, as IP object. - """ - return IP(self.network_long(), version=self.version()) - - def network_long(self): - """ - Network address, as long. - """ - return self.ip & self.netmask_long() - - def broadcast_long(self): - """ - Broadcast address, as long. - """ - if self.version() == 4: - return self.network_long() | (MAX_IPV4 - self.netmask_long()) - return self.network_long() | (MAX_IPV6 - self.netmask_long()) - - def check_collision(self, other): - """Check another network against the given network.""" - other = Network(other) - return self.network_long() < other.network_long() < self.broadcast_long() or \ - other.network_long() < self.network_long() < other.broadcast_long() - - def __contains__(self, ip): - return self.check_collision(ip) - - def has_key(self, ip): - """ - Check if the given ip is part of the network. - - :param ip: the ip address - :type ip: :class:`IP` or str or long or int - """ - return self.__contains__(ip) + return self.addr.version # vim:ts=4:sw=4:et: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/hb_report/constants.py new/crmsh-4.0.0+git.1537860833.be41d63c/hb_report/constants.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/hb_report/constants.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/hb_report/constants.py 2018-09-25 09:33:53.000000000 +0200 @@ -138,5 +138,6 @@ SYSINFO_F = "sysinfo.txt" SYSSTATS_F = "sysstats.txt" TIME_F = "time.txt" +OCFS2_F = "ocfs2.txt" # vim:ts=4:sw=4:et: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/hb_report/utillib.py new/crmsh-4.0.0+git.1537860833.be41d63c/hb_report/utillib.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/hb_report/utillib.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/hb_report/utillib.py 2018-09-25 09:33:53.000000000 +0200 @@ -283,6 +283,7 @@ time_status() corosync_blackbox() get_ratraces() + dump_ocfs2() for p in process_list: p.join() @@ -441,7 +442,7 @@ for item in grep("^name", incmd="dlm_tool ls"): lock_name = item.split()[1] out_string += "## NOTICE - Lockspace {}\n".format(lock_name) - out_string += get_command_info("dlm_tool lockdump {}".format(lock_name))[1] + '\n' + out_string += get_command_info("dlm_tool lockdebug {}".format(lock_name))[1] + '\n' out_string += "##### NOTICE - Lockspace history:\n" out_string += get_command_info("dlm_tool dump")[1] + '\n' @@ -866,7 +867,7 @@ workdir = constants.WORKDIR if os.path.isfile(constants.CONF): shutil.copy2(constants.CONF, workdir) - if crmutils.is_process("crmd"): + if crmutils.is_process("pacemaker-controld") or crmutils.is_process("crmd"): dump_state(workdir) open(os.path.join(workdir, "RUNNING"), 'w') else: @@ -933,7 +934,7 @@ if constants.USER_NODES: nodes = constants.USER_NODES.split() # 2. running crm - elif crmutils.is_process("crmd"): + elif crmutils.is_process("pacemaker-controld") or crmutils.is_process("crmd"): cmd = "crm node server" nodes = get_command_info(cmd)[1].strip().split('\n') # 3. if the cluster's stopped, try the CIB @@ -1629,6 +1630,22 @@ time_f = os.path.join(constants.WORKDIR, constants.TIME_F) crmutils.str2file(out_string, time_f) +def dump_ocfs2(): + ocfs2_f = os.path.join(constants.WORKDIR, constants.OCFS2_F) + with open(ocfs2_f, "w") as f: + #dump all tasks stack into dmesg + os.system("echo t > /proc/sysrq-trigger") + + cmds = [ "dmesg", "ps -efL", "lsof", + "lsblk -o 'NAME,KNAME,MAJ:MIN,FSTYPE,LABEL,RO,RM,MODEL,SIZE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,MOUNTPOINT'", + "mounted.ocfs2 -f", "findmnt", "mount", + "cat /sys/fs/ocfs2/cluster_stack" + ] + for cmd in cmds: + _, out = crmutils.get_stdout(cmd) + f.write("\n\n#=====[ Command ] ==========================#\n") + f.write("# %s\n"%(cmd)) + f.write(out) def touch_dc(): if constants.SKIP_LVL: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/containerized-regression-tests.sh new/crmsh-4.0.0+git.1537860833.be41d63c/test/containerized-regression-tests.sh --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/containerized-regression-tests.sh 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/containerized-regression-tests.sh 2018-09-25 09:33:53.000000000 +0200 @@ -1,3 +1,3 @@ #!/bin/sh docker pull krig/crmsh:latest -docker run -t -v "$(pwd):/app" krig/crmsh /bin/sh -c "systemctl start dbus; cd /app; ./test/run-in-container.sh $(whoami) $(id -u) $(id -g)" +docker run -t -v "$(pwd):/app" krig/crmsh /bin/sh -c "cd /app; ./test/run-in-container.sh $(id -un) $(id -gn) $(id -u) $(id -g)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/regression.sh new/crmsh-4.0.0+git.1537860833.be41d63c/test/regression.sh --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/regression.sh 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/regression.sh 2018-09-25 09:33:53.000000000 +0200 @@ -145,6 +145,7 @@ fi > $difff if [ $? -ne 0 ]; then echo " FAIL" >&3 + cat $difff >&3 dumpcase return 1 else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/run-in-container.sh new/crmsh-4.0.0+git.1537860833.be41d63c/test/run-in-container.sh --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/run-in-container.sh 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/run-in-container.sh 2018-09-25 09:33:53.000000000 +0200 @@ -1,12 +1,17 @@ #!/bin/sh oname=$1 -ouid=$2 -ogid=$3 +ogroup=$2 +ouid=$3 +ogid=$4 cat /etc/group | awk '{ FS = ":" } { print $3 }' | grep -q "$ogid" || groupadd -g "$ogid" id -u $oname >/dev/null 2>&1 || useradd -u $ouid -g $ogid $oname +preamble() { + systemctl start dbus +} + unit_tests() { echo "** Unit tests" su $oname -c "./test/run" @@ -28,7 +33,10 @@ sh /usr/share/crmsh/tests/regression.sh } +preamble unit_tests configure make_install regression_tests + +chown $oname:$ogroup /app/crmtestout/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/run-in-travis.sh new/crmsh-4.0.0+git.1537860833.be41d63c/test/run-in-travis.sh --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/run-in-travis.sh 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/run-in-travis.sh 2018-09-25 09:33:53.000000000 +0200 @@ -22,6 +22,7 @@ } unit_tests +rc_unittest=$? configure make_install -regression_tests +regression_tests && exit $rc_unittest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/testcases/common.excl new/crmsh-4.0.0+git.1537860833.be41d63c/test/testcases/common.excl --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/testcases/common.excl 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/testcases/common.excl 2018-09-25 09:33:53.000000000 +0200 @@ -6,6 +6,8 @@ Error setting fail-count-p0=5 \(section=status, set=status-node1\): The object/attribute does not exist Error setting s1=1 2 3 \(section=status, set=status-node1\): The object/attribute does not exist Error signing on to the CRMd service +Error connecting to the controller +Error performing operation: Transport endpoint is not connected .EXT crm_resource --list-standards .EXT crm_resource --list-ocf-alternatives Delay .EXT crm_resource --list-ocf-alternatives Dummy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/testcases/common.filter new/crmsh-4.0.0+git.1537860833.be41d63c/test/testcases/common.filter --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/testcases/common.filter 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/testcases/common.filter 2018-09-25 09:33:53.000000000 +0200 @@ -2,4 +2,8 @@ # 1. replace .EXT [path/]<cmd> <parameter> with .EXT <cmd> <parameter> /\.EXT \/(.+)/ { gsub(/\/.*\//, "", $2) } /\.EXT >\/dev\/null 2>&1 \/(.+)/ { gsub(/\/.*\//, "", $4) } +/\.EXT pacemaker-fenced/ { gsub(/pacemaker-fenced/,"stonithd") } +/\.EXT pacemaker-controld/ { gsub(/pacemaker-controld/,"crmd") } +/\.EXT pacemaker-schedulerd/ { gsub(/pacemaker-schedulerd/,"pengine") } +/\.EXT pacemaker-based/ { gsub(/pacemaker-based/,"cib") } { print } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/testcases/ra.exp new/crmsh-4.0.0+git.1537860833.be41d63c/test/testcases/ra.exp --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/testcases/ra.exp 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/testcases/ra.exp 2018-09-25 09:33:53.000000000 +0200 @@ -96,7 +96,7 @@ The overall delay is derived from a random delay value adding this static delay so that the sum is kept below the maximum delay. pcmk_action_limit (integer, [1]): The maximum number of actions can be performed in parallel on this device - Pengine property concurrent-fencing=true needs to be configured first. + Cluster property concurrent-fencing=true needs to be configured first. Then use this to specify the maximum number of actions can be performed in parallel on this device. -1 is unlimited. pcmk_reboot_action (string, [reboot]): Advanced use only: An alternate command to run instead of 'reboot' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/testcases/resource.exp new/crmsh-4.0.0+git.1537860833.be41d63c/test/testcases/resource.exp --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/testcases/resource.exp 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/testcases/resource.exp 2018-09-25 09:33:53.000000000 +0200 @@ -838,40 +838,28 @@ .TRY resource start p3 .TRY resource cleanup .EXT crm_resource --cleanup -Error performing operation: Transport endpoint is not connected .TRY resource cleanup p3 .EXT crm_resource --cleanup --resource p3 -Error performing operation: Transport endpoint is not connected .TRY resource cleanup p3 node1 .EXT crm_resource --cleanup --resource p3 --node node1 -Error performing operation: Transport endpoint is not connected .TRY resource cleanup force .EXT crm_resource --cleanup --force -Error performing operation: Transport endpoint is not connected .TRY resource cleanup p3 force .EXT crm_resource --cleanup --resource p3 --force -Error performing operation: Transport endpoint is not connected .TRY resource cleanup p3 node1 force .EXT crm_resource --cleanup --resource p3 --node node1 --force -Error performing operation: Transport endpoint is not connected .TRY resource refresh .EXT crm_resource --refresh -Error performing operation: Transport endpoint is not connected .TRY resource refresh p3 .EXT crm_resource --refresh --resource p3 -Error performing operation: Transport endpoint is not connected .TRY resource refresh p3 node1 .EXT crm_resource --refresh --resource p3 --node node1 -Error performing operation: Transport endpoint is not connected .TRY resource refresh force .EXT crm_resource --refresh --force -Error performing operation: Transport endpoint is not connected .TRY resource refresh p3 force .EXT crm_resource --refresh --resource p3 --force -Error performing operation: Transport endpoint is not connected .TRY resource refresh p3 node1 force .EXT crm_resource --refresh --resource p3 --node node1 --force -Error performing operation: Transport endpoint is not connected .TRY resource stop p3 .TRY configure rm cg .TRY configure ms msg g @@ -900,6 +888,7 @@ clone_color: m1 allocation score on node1: 0 clone_color: p2:0 allocation score on node1: 0 native_color: p2:0 allocation score on node1: -INFINITY +p2:0 promotion score on none: 0 native_color: p3 allocation score on node1: -INFINITY clone_color: msg allocation score on node1: 0 clone_color: g:0 allocation score on node1: 0 @@ -910,6 +899,7 @@ group_color: p4:0 allocation score on node1: -INFINITY native_color: p0:0 allocation score on node1: -INFINITY native_color: p4:0 allocation score on node1: -INFINITY +g:0 promotion score on none: 0 Remaining: node1 capacity: Transition Summary: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1526547258.54aafa1d/test/unittests/test_utils.py new/crmsh-4.0.0+git.1537860833.be41d63c/test/unittests/test_utils.py --- old/crmsh-4.0.0+git.1526547258.54aafa1d/test/unittests/test_utils.py 2018-05-17 10:54:18.000000000 +0200 +++ new/crmsh-4.0.0+git.1537860833.be41d63c/test/unittests/test_utils.py 2018-09-25 09:33:53.000000000 +0200 @@ -129,12 +129,10 @@ ip = utils.IP('2001:db3::1') assert ip.version() == 6 - net = utils.Network('192.0.2.0/24') - assert ('192.168.2.0' in net) is False - assert ('192.0.2.42' in net) is True + assert (utils.ip_in_network('192.168.2.0', '192.0.2.0/24') is False) + assert (utils.ip_in_network('192.0.2.42', '192.0.2.0/24') is True) - net = utils.Network('2001:db8::2/64') - assert ('2001:db3::1' in net) is False - assert ('2001:db8::1' in net) is True + assert (utils.ip_in_network('2001:db3::1', '2001:db8::2/64') is False) + assert (utils.ip_in_network('2001:db8::1', '2001:db8::2/64') is True) assert utils.get_ipv6_network("2002:db8::2/64") == "2002:db8::"
participants (1)
-
root