commit crmsh for openSUSE:Factory

Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2015-09-30 05:51:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2015-09-24 06:16:08.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2015-09-30 05:52:03.000000000 +0200 @@ -1,0 +2,14 @@ +Thu Sep 24 14:41:02 UTC 2015 - kgronlund@suse.com + +- Update to version 2.2.0~rc3+git.1443105613.80a246f: + + medium: cibconfig: Only warn for grouped children in colocations (bsc#927423) + +------------------------------------------------------------------- +Thu Sep 24 13:56:27 UTC 2015 - kgronlund@suse.com + +- Update to version 2.2.0~rc3+git.1443102798.74361f5: + + high: ui_node: Show remote nodes in crm node list (bsc#877962) + + medium: cibconfig: Warn if configuring constraint on child resource (bsc#927423) (#101) + + medium: cibconfig: Allow order constraints on group children (bsc#927423) + +------------------------------------------------------------------- Old: ---- crmsh-2.2.0~rc3+git.1442913222.4ba506b.tar.bz2 New: ---- crmsh-2.2.0~rc3+git.1443105613.80a246f.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.tpblRE/_old 2015-09-30 05:52:04.000000000 +0200 +++ /var/tmp/diff_new_pack.tpblRE/_new 2015-09-30 05:52:04.000000000 +0200 @@ -36,7 +36,7 @@ Summary: High Availability cluster command-line interface License: GPL-2.0+ Group: %{pkg_group} -Version: 2.2.0~rc3+git.1442913222.4ba506b +Version: 2.2.0~rc3+git.1443105613.80a246f Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.tpblRE/_old 2015-09-30 05:52:04.000000000 +0200 +++ /var/tmp/diff_new_pack.tpblRE/_new 2015-09-30 05:52:04.000000000 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/ClusterLabs/crmsh.git</param> - <param name="changesrevision">4ba506b414b9b5a6d6024880a6a1538b2d307968</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">80a246fe1ae9fdf650c8806452bd4171160433d2</param></service></servicedata> \ No newline at end of file ++++++ crmsh-2.2.0~rc3+git.1442913222.4ba506b.tar.bz2 -> crmsh-2.2.0~rc3+git.1443105613.80a246f.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/modules/cibconfig.py new/crmsh-2.2.0~rc3+git.1443105613.80a246f/modules/cibconfig.py --- old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/modules/cibconfig.py 2015-09-22 11:15:18.000000000 +0200 +++ new/crmsh-2.2.0~rc3+git.1443105613.80a246f/modules/cibconfig.py 2015-09-24 16:41:01.000000000 +0200 @@ -1622,6 +1622,28 @@ child_rsc.repr_gv(sg_obj, from_grp=True) +def _check_if_constraint_ref_is_child(obj): + """ + Used by check_sanity for constraints to verify + that referenced resources are not children in + a container. + """ + rc = 0 + for rscid in obj._referenced_resources(): + tgt = cib_factory.find_object(rscid) + if not tgt: + common_warn("%s: resource %s does not exist" % (obj.obj_id, rscid)) + rc = 1 + elif tgt.parent and tgt.parent.obj_type == "group": + if obj.obj_type == "colocation": + common_warn("%s: resource %s is grouped, constraints should apply to the group" % (obj.obj_id, rscid)) + rc = 1 + elif tgt.parent and tgt.parent.obj_type in constants.container_tags: + common_warn("%s: resource %s ambiguous, apply constraints to container" % (obj.obj_id, rscid)) + rc = 1 + return rc + + class CibLocation(CibObject): ''' Location constraint. @@ -1692,8 +1714,15 @@ if uname and uname.lower() not in ids: common_warn("%s: referenced node %s does not exist" % (self.obj_id, uname)) rc = 1 + rc2 = _check_if_constraint_ref_is_child(self) + if rc2 > rc: + rc = rc2 return rc + def _referenced_resources(self): + ret = self.node.xpath('.//resource_set/resource_ref/@id') + return ret or [self.node.get("rsc")] + def repr_gv(self, gv_obj, from_grp=False): ''' What to do with the location constraint? @@ -1830,6 +1859,23 @@ self.node.get("first"), self.node.get("then")]) + def _referenced_resources(self): + ret = self.node.xpath('.//resource_set/resource_ref/@id') + if ret: + return ret + if self.obj_type == "order": + return [self.node.get("first"), self.node.get("then")] + elif self.obj_type == "colocation": + return [self.node.get("rsc"), self.node.get("with-rsc")] + elif self.node.get("rsc"): + return [self.node.get("rsc")] + + def check_sanity(self): + if self.node is None: + common_err("%s: no xml (strange)" % self.obj_id) + return utils.get_check_rc() + return _check_if_constraint_ref_is_child(self) + class CibRscTicket(CibSimpleConstraint): ''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/modules/ui_node.py new/crmsh-2.2.0~rc3+git.1443105613.80a246f/modules/ui_node.py --- old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/modules/ui_node.py 2015-09-22 11:15:18.000000000 +0200 +++ new/crmsh-2.2.0~rc3+git.1443105613.80a246f/modules/ui_node.py 2015-09-24 16:41:02.000000000 +0200 @@ -22,7 +22,7 @@ """ takes an XML element defining a node, and returns the data to pass to print_node - is_offline: function(uname) -> offline? + is_offline: true|false """ type = uname = id = "" inst_attr = [] @@ -39,7 +39,7 @@ other[attr] = v inst_attr = [cli_nvpairs(nvpairs2list(elem)) for elem in node.xpath('./instance_attributes')] - return uname, id, type, other, inst_attr, is_offline(uname) + return uname, id, type, other, inst_attr, is_offline def print_node(uname, id, node_type, other, inst_attr, offline): @@ -124,26 +124,33 @@ @command.completers(compl.nodes) def do_show(self, context, node=None): 'usage: show [<node>]' - cib_elem = xmlutil.cibdump2elem() - if cib_elem is None: - return False - try: - nodes_node = cib_elem.xpath("//configuration/nodes")[0] - status = cib_elem.findall("status")[0] - node_state = status.xpath(".//node_state") - except: + cib = xmlutil.cibdump2elem() + if cib is None: return False - def is_offline(uname): - for state in node_state: - if state.get("uname") == uname and state.get("crmd") == "offline": - return True - return False + cfg_nodes = cib.xpath('/cib/configuration/nodes/node') + node_states = cib.xpath('/cib/status/node_state') + + def find(it, lst): + for n in lst: + if n.get("uname") == it: + return n + return None + + def do_print(uname): + xml = find(uname, cfg_nodes) + state = find(uname, node_states) + if xml is not None or state is not None: + is_offline = state is not None and state.get("crmd") == "offline" + print_node(*unpack_node_xmldata(xml if xml is not None else state, is_offline)) - for c in nodes_node.iterchildren(): - if c.tag != "node" or (node is not None and c.get("uname") != node): - continue - print_node(*unpack_node_xmldata(c, is_offline)) + if node is not None: + do_print(node) + else: + all_nodes = set([n.get("uname") for n in cfg_nodes + node_states]) + for uname in sorted(all_nodes): + do_print(uname) + return True @command.wait @command.completers(compl.nodes) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/test/testcases/confbasic.exp new/crmsh-2.2.0~rc3+git.1443105613.80a246f/test/testcases/confbasic.exp --- old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/test/testcases/confbasic.exp 2015-09-22 11:15:18.000000000 +0200 +++ new/crmsh-2.2.0~rc3+git.1443105613.80a246f/test/testcases/confbasic.exp 2015-09-24 16:41:02.000000000 +0200 @@ -56,6 +56,7 @@ .EXT crm_resource --show-metadata ocf:heartbeat:Delay .EXT crm_resource --show-metadata ocf:pacemaker:Stateful .EXT crm_resource --show-metadata ocf:heartbeat:Dummy +WARNING: 51: c2: resource d1 is grouped, constraints should apply to the group .EXT crmd metadata .EXT pengine metadata .EXT cib metadata @@ -132,3 +133,4 @@ rule 100: #uname eq node1 \ record-pending=true .INP: commit +WARNING: 53: c2: resource d1 is grouped, constraints should apply to the group diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/test/testcases/history.exp new/crmsh-2.2.0~rc3+git.1443105613.80a246f/test/testcases/history.exp --- old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/test/testcases/history.exp 2015-09-22 11:15:18.000000000 +0200 +++ new/crmsh-2.2.0~rc3+git.1443105613.80a246f/test/testcases/history.exp 2015-09-24 16:41:02.000000000 +0200 @@ -10,7 +10,7 @@ Nodes: xen-d xen-e Groups: Resources: d1 s-libvirt -Transitions: 43 44 45 46 48 272 49 50 +Transitions: 43* 44 45 46 48* 272* 49* 50* .INP: node xen-d Dec 14 20:06:35 xen-d corosync[5649]: [MAIN ] Corosync Cluster Engine ('1.4.3'): started and ready to provide service. Dec 14 20:06:36 xen-d corosync[5649]: [pcmk ] info: pcmk_peer_update: memb: xen-d 906822154 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/test/unittests/test_bugs.py new/crmsh-2.2.0~rc3+git.1443105613.80a246f/test/unittests/test_bugs.py --- old/crmsh-2.2.0~rc3+git.1442913222.4ba506b/test/unittests/test_bugs.py 2015-09-22 11:15:18.000000000 +0200 +++ new/crmsh-2.2.0~rc3+git.1443105613.80a246f/test/unittests/test_bugs.py 2015-09-24 16:41:02.000000000 +0200 @@ -280,9 +280,9 @@ crm configure group can hijack a cloned primitive (and then crash) """ obj1 = factory.create_object('primitive', 'p1', 'Dummy') - assert obj1 is not None + assert obj1 is True obj2 = factory.create_object('group', 'g1', 'p1') - assert obj2 is not None + assert obj2 is True obj3 = factory.create_object('group', 'g2', 'p1') print obj3 assert obj3 is False @@ -476,3 +476,58 @@ exp = 'node 1: dell71 attributes staging-0-0-placement=true meta-0-0-placement=true attributes standby=off' assert data == exp assert obj.cli_use_validate() + + +@with_setup(setup_func, teardown_func) +def test_group_constraint_location(): + """ + configuring a location constraint on a grouped resource is OK + """ + factory.create_object('node', 'node1') + factory.create_object('primitive', 'p1', 'Dummy') + factory.create_object('primitive', 'p2', 'Dummy') + factory.create_object('group', 'g1', 'p1', 'p2') + factory.create_object('location', 'loc-p1', 'p1', 'inf:', 'node1') + c = factory.find_object('loc-p1') + assert c and c.check_sanity() == 0 + + +@with_setup(setup_func, teardown_func) +def test_group_constraint_colocation(): + """ + configuring a colocation constraint on a grouped resource is bad + """ + factory.create_object('primitive', 'p1', 'Dummy') + factory.create_object('primitive', 'p2', 'Dummy') + factory.create_object('group', 'g1', 'p1', 'p2') + factory.create_object('colocation', 'coloc-p1-p2', 'inf:', 'p1', 'p2') + c = factory.find_object('coloc-p1-p2') + assert c and c.check_sanity() > 0 + + +@with_setup(setup_func, teardown_func) +def test_group_constraint_colocation_rscset(): + """ + configuring a constraint on a grouped resource is bad + """ + factory.create_object('primitive', 'p1', 'Dummy') + factory.create_object('primitive', 'p2', 'Dummy') + factory.create_object('primitive', 'p3', 'Dummy') + factory.create_object('group', 'g1', 'p1', 'p2') + factory.create_object('colocation', 'coloc-p1-p2-p3', 'inf:', 'p1', 'p2', 'p3') + c = factory.find_object('coloc-p1-p2-p3') + assert c and c.check_sanity() > 0 + + +@with_setup(setup_func, teardown_func) +def test_clone_constraint_colocation_rscset(): + """ + configuring a constraint on a cloned resource is bad + """ + factory.create_object('primitive', 'p1', 'Dummy') + factory.create_object('primitive', 'p2', 'Dummy') + factory.create_object('primitive', 'p3', 'Dummy') + factory.create_object('clone', 'c1', 'p1') + factory.create_object('colocation', 'coloc-p1-p2-p3', 'inf:', 'p1', 'p2', 'p3') + c = factory.find_object('coloc-p1-p2-p3') + assert c and c.check_sanity() > 0
participants (1)
-
root@hilbert.suse.de