Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2019-09-23 12:34:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "crmsh" Mon Sep 23 12:34:10 2019 rev:162 rq:731950 version:4.1.0+git.1567524903.fff07b88 Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2019-08-22 10:52:54.365695588 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new.7948/crmsh.changes 2019-09-23 12:37:54.665605088 +0200 @@ -1,0 +2,21 @@ +Tue Sep 03 15:39:31 UTC 2019 - [email protected] + +- Update to version 4.1.0+git.1567524903.fff07b88: + * Doc: ui_resource: resolve maintenance vs is-managed conflict + * Test: ui_resource: resolve maintenance vs is-managed conflict + * Dev: ui_resource: resolve maintenance vs is-managed conflict + +------------------------------------------------------------------- +Tue Aug 27 13:41:08 UTC 2019 - [email protected] + +- Update to version 4.1.0+git.1566912937.ad2608af: + * Test: ui_resource: maintenance: stop using crm_resource + * Dev: ui_resource: maintenance: stop using crm_resource + +------------------------------------------------------------------- +Thu Aug 22 08:36:44 UTC 2019 - [email protected] + +- Update to version 4.1.0+git.1566462738.45748f84: + * Revert "dev: Suggestion: Try to centralized command options in one file" + +------------------------------------------------------------------- Old: ---- crmsh-4.1.0+git.1566218232.dbdf060c.tar.bz2 New: ---- crmsh-4.1.0+git.1567524903.fff07b88.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.HfJ2EY/_old 2019-09-23 12:37:55.181605003 +0200 +++ /var/tmp/diff_new_pack.HfJ2EY/_new 2019-09-23 12:37:55.181605003 +0200 @@ -36,7 +36,7 @@ Summary: High Availability cluster command-line interface License: GPL-2.0-or-later Group: %{pkg_group} -Version: 4.1.0+git.1566218232.dbdf060c +Version: 4.1.0+git.1567524903.fff07b88 Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.HfJ2EY/_old 2019-09-23 12:37:55.213604998 +0200 +++ /var/tmp/diff_new_pack.HfJ2EY/_new 2019-09-23 12:37:55.213604998 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/ClusterLabs/crmsh.git</param> - <param name="changesrevision">dbdf060c6e4809cf562ff7beafbd5afff8de6ebf</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">f01ad01a93385b981987dad29a4c7ae019bfdd6b</param></service></servicedata> \ No newline at end of file ++++++ crmsh-4.1.0+git.1566218232.dbdf060c.tar.bz2 -> crmsh-4.1.0+git.1567524903.fff07b88.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/crmsh/options.py new/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/options.py --- old/crmsh-4.1.0+git.1566218232.dbdf060c/crmsh/options.py 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/options.py 2019-09-03 17:35:03.000000000 +0200 @@ -16,77 +16,3 @@ scriptdir = "" # set to true when completing non-interactively shell_completion = False - - -arg_parameter_key = ["action", "dest", "metavar", "default", "type", "help"] - -cluster_init_base_options_value = [ - ("-h", "--help", "store_true", "help", "", None, None, "Show this help message"), - - ("-q", "--quiet", "store_true", "quiet", "", None, None, - "Be quiet (don't describe what's happening, just do it)"), - - ("-y", "--yes", "store_true", "yes_to_all", "", None, None, - 'Answer "yes" to all prompts (use with caution, this is destructive, especially during the "storage" stage)'), - - ("-t", "--template", "store", "template", "", None, None, - 'Optionally configure cluster with template "name" (currently only "ocfs2" is valid here)'), - - ("-n", "--name", "store", "name", "NAME", "hacluster", None, - 'Set the name of the configured cluster.'), - - ("-N", "--nodes", "store", "nodes", "NODES", None, None, - 'Additional nodes to add to the created cluster. ' + - 'May include the current node, which will always be the initial cluster node.'), - - ("-S", "--enable-sbd", "store_true", "diskless_sbd", "", None, None, - "Enable SBD even if no SBD device is configured (diskless mode)"), - - ("-w", "--watchdog", "store", "watchdog", "WATCHDOG", None, None, "Use the given watchdog device") -] - -cluster_init_net_options_value = [ - ("-i", "--interface", "store", "nic", "IF", None, str, "Bind to IP address on interface IF"), - - ("-u", "--unicast", "store_true", "unicast", "", None, None, - "Configure corosync to communicate over unicast (UDP), and not multicast. " + - "Default is multicast unless an environment where multicast cannot be used is detected."), - - ("-A", "--admin-ip", "store", "admin_ip", "IP", None, str, - "Configure IP address as an administration virtual IP"), - - ("-M", "--multi-heartbeats", "store_true", "second_hb", "", None, None, - "Configure corosync with second heartbeat line"), - - ("-I", "--ipv6", "store_true", "ipv6", "", None, None, "Configure corosync use IPv6"), - - ("--qdevice", "store", "qdevice", "QDEVICE", None, str, "QDevice IP"), - - ("--qdevice-port", "store", "qdevice_port", "QDEVICE_PORT", 5403, int, "QDevice port"), - - ("--qdevice-algo", "store", "qdevice_algo", "QDEVICE_ALGO", "ffsplit", str, "QDevice algorithm"), - - ("--qdevice-tie-breaker", "store", "qdevice_tie_breaker", "QDEVICE_TIE_BREAKER", "lowest", str, - "QDevice tie breaker") -] - -cluster_init_storage_options_value = [ - ("-p", "--partition-device", "store", "shared_device", "DEVICE", None, str, - 'Partition this shared storage device (only used in "storage" stage)'), - - ("-s", "--sbd-device", "store", "sbd_device", "DEVICE", None, str, - "Block device to use for SBD fencing"), - - ("-o", "--ocfs2-device", "store", "ocfs2_device", "DEVICE", None, str, - 'Block device to use for OCFS2 (only used in "vgfs" stage)') -] - -CLUSTER_INIT_BASE_OPTIONS = [] -CLUSTER_INIT_NET_OPTIONS = [] -CLUSTER_INIT_STORAGE_OPTIONS = [] -for value_tuple in cluster_init_base_options_value: - CLUSTER_INIT_BASE_OPTIONS.append((value_tuple[:-6], dict(zip(arg_parameter_key, value_tuple[-6:])))) -for value_tuple in cluster_init_net_options_value: - CLUSTER_INIT_NET_OPTIONS.append((value_tuple[:-6], dict(zip(arg_parameter_key, value_tuple[-6:])))) -for value_tuple in cluster_init_storage_options_value: - CLUSTER_INIT_STORAGE_OPTIONS.append((value_tuple[:-6], dict(zip(arg_parameter_key, value_tuple[-6:])))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/crmsh/ui_cluster.py new/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/ui_cluster.py --- old/crmsh-4.1.0+git.1566218232.dbdf060c/crmsh/ui_cluster.py 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/ui_cluster.py 2019-09-03 17:35:03.000000000 +0200 @@ -4,7 +4,6 @@ import optparse import re -from . import options as cmdoptions from . import command from . import utils from .msg import err_buf @@ -184,19 +183,58 @@ will be skipped. """, add_help_option=False) - for _options in cmdoptions.CLUSTER_INIT_BASE_OPTIONS: - parser.add_option(*_options[0], **_options[-1]) + parser.add_option("-h", "--help", action="store_true", dest="help", help="Show this help message") + parser.add_option("-q", "--quiet", action="store_true", dest="quiet", + help="Be quiet (don't describe what's happening, just do it)") + parser.add_option("-y", "--yes", action="store_true", dest="yes_to_all", + help='Answer "yes" to all prompts (use with caution, this is destructive, especially during the "storage" stage)') + parser.add_option("-t", "--template", dest="template", + help='Optionally configure cluster with template "name" (currently only "ocfs2" is valid here)') + parser.add_option("-n", "--name", metavar="NAME", dest="name", default="hacluster", + help='Set the name of the configured cluster.') + parser.add_option("-N", "--nodes", metavar="NODES", dest="nodes", + help='Additional nodes to add to the created cluster. ' + + 'May include the current node, which will always be the initial cluster node.') + # parser.add_option("--quick-start", dest="quickstart", action="store_true", help="Perform basic system configuration (NTP, watchdog, /etc/hosts)") + parser.add_option("-S", "--enable-sbd", dest="diskless_sbd", action="store_true", + help="Enable SBD even if no SBD device is configured (diskless mode)") + parser.add_option("-w", "--watchdog", dest="watchdog", metavar="WATCHDOG", + help="Use the given watchdog device") network_group = optparse.OptionGroup(parser, "Network configuration", "Options for configuring the network and messaging layer.") - for _options in cmdoptions.CLUSTER_INIT_NET_OPTIONS: - network_group.add_option(*_options[0], **_options[-1]) + network_group.add_option("-i", "--interface", dest="nic", metavar="IF", + help="Bind to IP address on interface IF") + network_group.add_option("-u", "--unicast", action="store_true", dest="unicast", + help="Configure corosync to communicate over unicast (UDP), and not multicast. " + + "Default is multicast unless an environment where multicast cannot be used is detected.") + network_group.add_option("-A", "--admin-ip", dest="admin_ip", metavar="IP", + help="Configure IP address as an administration virtual IP") + network_group.add_option("-M", "--multi-heartbeats", action="store_true", dest="second_hb", + help="Configure corosync with second heartbeat line") + network_group.add_option("-I", "--ipv6", action="store_true", dest="ipv6", + help="Configure corosync use IPv6") + network_group.add_option("--qdevice", + dest="qdevice", metavar="QDEVICE", + help="QDevice IP") + network_group.add_option("--qdevice-port", + dest="qdevice_port", metavar="QDEVICE_PORT", type="int", default=5403, + help="QDevice port") + network_group.add_option("--qdevice-algo", + dest="qdevice_algo", metavar="QDEVICE_ALGO", default="ffsplit", + help="QDevice algorithm") + network_group.add_option("--qdevice-tie-breaker", + dest="qdevice_tie_breaker", metavar="QDEVICE_TIE_BREAKER", default="lowest", + help="QDevice algorithm") parser.add_option_group(network_group) storage_group = optparse.OptionGroup(parser, "Storage configuration", "Options for configuring shared storage.") - for _options in cmdoptions.CLUSTER_INIT_STORAGE_OPTIONS: - storage_group.add_option(*_options[0], **_options[-1]) + storage_group.add_option("-p", "--partition-device", dest="shared_device", metavar="DEVICE", + help='Partition this shared storage device (only used in "storage" stage)') + storage_group.add_option("-s", "--sbd-device", dest="sbd_device", metavar="DEVICE", + help="Block device to use for SBD fencing") + storage_group.add_option("-o", "--ocfs2-device", dest="ocfs2_device", metavar="DEVICE", + help='Block device to use for OCFS2 (only used in "vgfs" stage)') parser.add_option_group(storage_group) - try: options, args = parser.parse_args(list(args)) except: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/crmsh/ui_resource.py new/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/ui_resource.py --- old/crmsh-4.1.0+git.1566218232.dbdf060c/crmsh/ui_resource.py 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/ui_resource.py 2019-09-03 17:35:03.000000000 +0200 @@ -44,9 +44,26 @@ l.append(p) return l +def get_children_with_attr(node, attr): + l = [] + for p in node.xpath(".//primitive"): + diff_attr = False + for meta_set in xmlutil.get_set_nodes(p, "meta_attributes", create=False): + p_value = xmlutil.get_attr_value(meta_set, attr) + if p_value is not None: + diff_attr = True + break + if diff_attr: + l.append(p) + return l def set_deep_meta_attr_node(target_node, attr, value): nvpair_l = [] + conflicting_attr = '' + if 'maintenance' == attr: + conflicting_attr = 'is-managed' + if 'is-managed' == attr: + conflicting_attr = 'maintenance' if xmlutil.is_clone(target_node): for c in target_node.iterchildren(): if xmlutil.is_child_rsc(c): @@ -54,16 +71,35 @@ if config.core.manage_children != "never" and \ (xmlutil.is_group(target_node) or (xmlutil.is_clone(target_node) and xmlutil.cloned_el(target_node) == "group")): + # maintenance and is-managed attributes conflict, + # ask the user if he wants to leave both. + if '' != conflicting_attr: + odd_children = get_children_with_attr(target_node, conflicting_attr) + for c in odd_children: + if config.core.manage_children == "always" or \ + (config.core.manage_children == "ask" and + utils.ask("'%s' conflicts with '%s' attribute. Remove '%s' for child resource %s?" % + (attr, conflicting_attr, conflicting_attr, c.get("id")))): + common_debug("force remove meta attr %s from %s" % + (conflicting_attr, c.get("id"))) + rm_meta_attribute(c, conflicting_attr, nvpair_l, force_children=True) + # remove attributes with different values odd_children = get_children_with_different_attr(target_node, attr, value) for c in odd_children: if config.core.manage_children == "always" or \ (config.core.manage_children == "ask" and - utils.ask("Do you want to override %s for child resource %s?" % + utils.ask("Do you want to override '%s' for child resource %s?" % (attr, c.get("id")))): common_debug("force remove meta attr %s from %s" % (attr, c.get("id"))) rm_meta_attribute(c, attr, nvpair_l, force_children=True) xmlutil.rmnodes(list(set(nvpair_l))) + if '' != conflicting_attr: + nvpairs = target_node.xpath("./meta_attributes/nvpair[@name='%s']" % (conflicting_attr)) + if len(nvpairs) > 0: + if (utils.ask("'%s' conflicts with '%s' attribute. Remove '%s' for resource %s?" % + (attr, conflicting_attr, conflicting_attr, target_node.get("id")))): + xmlutil.rmnodes(list(set(nvpairs))) xmlutil.xml_processnodes(target_node, xmlutil.is_emptynvpairs, xmlutil.rmnodes) @@ -533,7 +569,7 @@ on_off = 'true' else: on_off = 'false' - return utils.ext_cmd(self.rsc_maintenance % (resource, on_off)) == 0 + return self._commit_meta_attr(context, resource, "maintenance", on_off) def _get_trace_rsc(self, rsc_id): if not cib_factory.refresh(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/data-manifest new/crmsh-4.1.0+git.1567524903.fff07b88/data-manifest --- old/crmsh-4.1.0+git.1566218232.dbdf060c/data-manifest 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/data-manifest 2019-09-03 17:35:03.000000000 +0200 @@ -127,6 +127,8 @@ test/unittests/corosync.conf.2 test/unit-tests-in-container.sh test/unittests/__init__.py +test/unittests/pacemaker.log +test/unittests/pacemaker_unicode.log test/unittests/schemas/acls-1.1.rng test/unittests/schemas/acls-1.2.rng test/unittests/schemas/constraints-1.0.rng @@ -162,7 +164,7 @@ test/unittests/test_handles.py test/unittests/test_objset.py test/unittests/test_parse.py -test/unittests/test_resource.py +test/unittests/test_report.py test/unittests/test_scripts.py test/unittests/test_time.py test/unittests/test_utils.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/doc/crm.8.adoc new/crmsh-4.1.0+git.1567524903.fff07b88/doc/crm.8.adoc --- old/crmsh-4.1.0+git.1566218232.dbdf060c/doc/crm.8.adoc 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/doc/crm.8.adoc 2019-09-03 17:35:03.000000000 +0200 @@ -2038,6 +2038,9 @@ Enables or disables the per-resource maintenance mode. When this mode is enabled, no monitor operations will be triggered for the resource. +`maintenance` attribute conflicts with the `is-managed`. When setting +the `maintenance` attribute, the user is proposed to remove the +`is-managed` attribute if it exists. Usage: .................. @@ -2057,6 +2060,9 @@ are multiple meta attributes sets, the attribute is set in all of them. If the resource is a clone, all `is-managed` attributes are removed from the children resources. +`is-managed` attribute conflicts with the `maintenance`. When setting +the `is-managed` attribute, the user is proposed to remove the +`maintenance` attribute if it exists. For details on group management see <<cmdhelp_options_manage-children,`options manage-children`>>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/doc/website-v1/man-2.0.adoc new/crmsh-4.1.0+git.1567524903.fff07b88/doc/website-v1/man-2.0.adoc --- old/crmsh-4.1.0+git.1566218232.dbdf060c/doc/website-v1/man-2.0.adoc 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/doc/website-v1/man-2.0.adoc 2019-09-03 17:35:03.000000000 +0200 @@ -1704,6 +1704,9 @@ Enables or disables the per-resource maintenance mode. When this mode is enabled, no monitor operations will be triggered for the resource. +`maintenance` attribute conflicts with the `is-managed`. When setting +the `maintenance` attribute, the user is proposed to remove the +`is-managed` attribute if it exists. Usage: .................. @@ -1723,6 +1726,9 @@ are multiple meta attributes sets, the attribute is set in all of them. If the resource is a clone, all `is-managed` attributes are removed from the children resources. +`is-managed` attribute conflicts with the `maintenance`. When setting +the `is-managed` attribute, the user is proposed to remove the +`maintenance` attribute if it exists. For details on group management see <<cmdhelp_options_manage-children,`options manage-children`>>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/doc/website-v1/man-3.adoc new/crmsh-4.1.0+git.1567524903.fff07b88/doc/website-v1/man-3.adoc --- old/crmsh-4.1.0+git.1566218232.dbdf060c/doc/website-v1/man-3.adoc 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/doc/website-v1/man-3.adoc 2019-09-03 17:35:03.000000000 +0200 @@ -1965,6 +1965,9 @@ Enables or disables the per-resource maintenance mode. When this mode is enabled, no monitor operations will be triggered for the resource. +`maintenance` attribute conflicts with the `is-managed`. When setting +the `maintenance` attribute, the user is proposed to remove the +`is-managed` attribute if it exists. Usage: .................. @@ -1984,6 +1987,9 @@ are multiple meta attributes sets, the attribute is set in all of them. If the resource is a clone, all `is-managed` attributes are removed from the children resources. +`is-managed` attribute conflicts with the `maintenance`. When setting +the `is-managed` attribute, the user is proposed to remove the +`maintenance` attribute if it exists. For details on group management see <<cmdhelp_options_manage-children,`options manage-children`>>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/test/testcases/resource new/crmsh-4.1.0+git.1567524903.fff07b88/test/testcases/resource --- old/crmsh-4.1.0+git.1566218232.dbdf060c/test/testcases/resource 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/test/testcases/resource 2019-09-03 17:35:03.000000000 +0200 @@ -5,6 +5,9 @@ %setenv showobj=c1 resource manage c1 resource unmanage c1 +%setenv showobj=p2 +resource maintenance p2 on +resource maintenance p2 off %setenv showobj=cli-prefer-p3 resource migrate p3 node1 %setenv showobj= @@ -61,3 +64,17 @@ configure rm cg configure ms msg g resource scores +%setenv showobj= +configure primitive p5 Dummy +configure group g1 p5 +resource manage p5 +%setenv showobj=p5 +-F resource maintenance p5 on +%setenv showobj=p5 +-F resource unmanage p5 +%setenv showobj=p5 +-F resource maintenance g1 +resource start p5 +%setenv showobj=g1 +-F resource manage g1 +resource start p5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/test/testcases/resource.exp new/crmsh-4.1.0+git.1567524903.fff07b88/test/testcases/resource.exp --- old/crmsh-4.1.0+git.1566218232.dbdf060c/test/testcases/resource.exp 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/test/testcases/resource.exp 2019-09-03 17:35:03.000000000 +0200 @@ -85,6 +85,61 @@ </configuration> </cib> +.SETENV showobj=p2 +.TRY resource maintenance p2 on +.INP: configure +.INP: _regtest on +.INP: show xml p2 +<?xml version="1.0" ?> +<cib> + <configuration> + <crm_config/> + <nodes/> + <resources> + <master id="m1"> + <meta_attributes id="m1-meta_attributes"> + <nvpair id="m1-meta_attributes-maintenance" name="maintenance" value="true"/> + </meta_attributes> + <primitive id="p2" class="ocf" provider="heartbeat" type="Delay"> + <instance_attributes id="p2-instance_attributes"> + <nvpair name="startdelay" value="2" id="p2-instance_attributes-startdelay"/> + <nvpair name="mondelay" value="2" id="p2-instance_attributes-mondelay"/> + <nvpair name="stopdelay" value="2" id="p2-instance_attributes-stopdelay"/> + </instance_attributes> + </primitive> + </master> + </resources> + <constraints/> + </configuration> +</cib> + +.TRY resource maintenance p2 off +.INP: configure +.INP: _regtest on +.INP: show xml p2 +<?xml version="1.0" ?> +<cib> + <configuration> + <crm_config/> + <nodes/> + <resources> + <master id="m1"> + <meta_attributes id="m1-meta_attributes"> + <nvpair id="m1-meta_attributes-maintenance" name="maintenance" value="false"/> + </meta_attributes> + <primitive id="p2" class="ocf" provider="heartbeat" type="Delay"> + <instance_attributes id="p2-instance_attributes"> + <nvpair name="startdelay" value="2" id="p2-instance_attributes-startdelay"/> + <nvpair name="mondelay" value="2" id="p2-instance_attributes-mondelay"/> + <nvpair name="stopdelay" value="2" id="p2-instance_attributes-stopdelay"/> + </instance_attributes> + </primitive> + </master> + </resources> + <constraints/> + </configuration> +</cib> + .SETENV showobj=cli-prefer-p3 .TRY resource migrate p3 node1 .EXT crm_resource --quiet --move --resource 'p3' --node 'node1' @@ -903,3 +958,159 @@ Remaining: node1 capacity: Transition Summary: +.SETENV showobj= +.TRY configure primitive p5 Dummy +.EXT crm_resource --show-metadata ocf:heartbeat:Dummy +.EXT crm_resource --show-metadata stonith:null +.EXT stonithd metadata +.EXT crm_resource --show-metadata ocf:pacemaker:Dummy +.EXT crm_resource --show-metadata ocf:heartbeat:Delay +.TRY configure group g1 p5 +.TRY resource manage p5 +.SETENV showobj=p5 +.TRY -F resource maintenance p5 on +INFO: 'maintenance' conflicts with 'is-managed' attribute. Remove 'is-managed' for resource p5? [YES] +.INP: configure +.INP: _regtest on +.INP: show xml p5 +<?xml version="1.0" ?> +<cib> + <configuration> + <crm_config/> + <nodes/> + <resources> + <group id="g1"> + <primitive id="p5" class="ocf" provider="heartbeat" type="Dummy"> + <meta_attributes id="p5-meta_attributes-0"> + <nvpair id="p5-meta_attributes-0-maintenance" name="maintenance" value="true"/> + </meta_attributes> + </primitive> + </group> + </resources> + <constraints/> + </configuration> +</cib> + +.SETENV showobj=p5 +.TRY -F resource unmanage p5 +INFO: 'is-managed' conflicts with 'maintenance' attribute. Remove 'maintenance' for resource p5? [YES] +.INP: configure +.INP: _regtest on +.INP: show xml p5 +<?xml version="1.0" ?> +<cib> + <configuration> + <crm_config/> + <nodes/> + <resources> + <group id="g1"> + <primitive id="p5" class="ocf" provider="heartbeat" type="Dummy"> + <meta_attributes id="p5-meta_attributes"> + <nvpair id="p5-meta_attributes-is-managed" name="is-managed" value="false"/> + </meta_attributes> + </primitive> + </group> + </resources> + <constraints/> + </configuration> +</cib> + +.SETENV showobj=p5 +.TRY -F resource maintenance g1 +.INP: configure +.INP: _regtest on +.INP: show xml p5 +<?xml version="1.0" ?> +<cib> + <configuration> + <crm_config/> + <nodes/> + <resources> + <group id="g1"> + <meta_attributes id="g1-meta_attributes"> + <nvpair id="g1-meta_attributes-maintenance" name="maintenance" value="true"/> + </meta_attributes> + <primitive id="p5" class="ocf" provider="heartbeat" type="Dummy"/> + </group> + </resources> + <constraints/> + </configuration> +</cib> + +.TRY resource start p5 +.INP: configure +.INP: _regtest on +.INP: show xml p5 +<?xml version="1.0" ?> +<cib> + <configuration> + <crm_config/> + <nodes/> + <resources> + <group id="g1"> + <meta_attributes id="g1-meta_attributes"> + <nvpair id="g1-meta_attributes-maintenance" name="maintenance" value="true"/> + </meta_attributes> + <primitive id="p5" class="ocf" provider="heartbeat" type="Dummy"> + <meta_attributes id="p5-meta_attributes"> + <nvpair id="p5-meta_attributes-target-role" name="target-role" value="Started"/> + </meta_attributes> + </primitive> + </group> + </resources> + <constraints/> + </configuration> +</cib> + +.SETENV showobj=g1 +.TRY -F resource manage g1 +INFO: 'is-managed' conflicts with 'maintenance' attribute. Remove 'maintenance' for resource g1? [YES] +.INP: configure +.INP: _regtest on +.INP: show xml g1 +<?xml version="1.0" ?> +<cib> + <configuration> + <crm_config/> + <nodes/> + <resources> + <group id="g1"> + <meta_attributes id="g1-meta_attributes-0"> + <nvpair id="g1-meta_attributes-0-is-managed" name="is-managed" value="true"/> + </meta_attributes> + <primitive id="p5" class="ocf" provider="heartbeat" type="Dummy"> + <meta_attributes id="p5-meta_attributes"> + <nvpair id="p5-meta_attributes-target-role" name="target-role" value="Started"/> + </meta_attributes> + </primitive> + </group> + </resources> + <constraints/> + </configuration> +</cib> + +.TRY resource start p5 +.INP: configure +.INP: _regtest on +.INP: show xml g1 +<?xml version="1.0" ?> +<cib> + <configuration> + <crm_config/> + <nodes/> + <resources> + <group id="g1"> + <meta_attributes id="g1-meta_attributes-0"> + <nvpair id="g1-meta_attributes-0-is-managed" name="is-managed" value="true"/> + </meta_attributes> + <primitive id="p5" class="ocf" provider="heartbeat" type="Dummy"> + <meta_attributes id="p5-meta_attributes"> + <nvpair id="p5-meta_attributes-target-role" name="target-role" value="Started"/> + </meta_attributes> + </primitive> + </group> + </resources> + <constraints/> + </configuration> +</cib> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.1.0+git.1566218232.dbdf060c/test/unittests/test_resource.py new/crmsh-4.1.0+git.1567524903.fff07b88/test/unittests/test_resource.py --- old/crmsh-4.1.0+git.1566218232.dbdf060c/test/unittests/test_resource.py 2019-08-19 14:37:12.000000000 +0200 +++ new/crmsh-4.1.0+git.1567524903.fff07b88/test/unittests/test_resource.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -# Copyright (C) 2014-2018 Kristoffer Gronlund <[email protected]> -# See COPYING for license information. - - -#standard_library.install_aliases() -from builtins import object -from crmsh import ui_resource -from crmsh import utils - - -def test_maintenance(): - errors = [] - commands = [] - - def mockcmd(*args): - commands.append(args) - return 0 - - class MockContext(object): - def fatal_error(*args): - errors.append(args) - mc = MockContext() - - _pre_ext_cmd = utils.ext_cmd - try: - utils.ext_cmd = mockcmd - rscui = ui_resource.RscMgmt() - assert rscui.do_maintenance(mc, 'rsc1') is True - assert commands[-1] == ("crm_resource --resource 'rsc1' --meta --set-parameter maintenance --parameter-value 'true'",) - assert rscui.do_maintenance(mc, 'rsc1', 'on') is True - assert commands[-1] == ("crm_resource --resource 'rsc1' --meta --set-parameter maintenance --parameter-value 'true'",) - assert rscui.do_maintenance(mc, 'rsc1', 'off') is True - assert commands[-1] == ("crm_resource --resource 'rsc1' --meta --set-parameter maintenance --parameter-value 'false'",) - finally: - utils.ext_cmd = _pre_ext_cmd
