diff --git a/crmsh/migration.py b/crmsh/migration.py index f900bbb64..45d2e6677 100644 --- a/crmsh/migration.py +++ b/crmsh/migration.py @@ -124,12 +124,7 @@ def write_in_color(f, color: str, text: str): f.write(text) def end(self): - if self.has_problems: - self.write_in_color(sys.stdout, constants.RED, '[FAIL]\n\n') - else: - self.write_in_color(sys.stdout, constants.GREEN, '[PASS]\n\n') - if not self.has_problems: - self.write_in_color(sys.stdout, constants.GREEN, '[PASS]\n') + sys.stdout.write('\n') def migrate(): @@ -154,7 +149,7 @@ def check(args: typing.Sequence[str]) -> int: if not parsed_args.local and not parsed_args.json: check_remote_yield = check_remote() next(check_remote_yield) - print('------ localhost ------') + print('------ corosync @ localhost ------') else: check_remote_yield = itertools.repeat(0) match parsed_args.json: @@ -173,6 +168,7 @@ def check(args: typing.Sequence[str]) -> int: next(check_remote_yield) print('------ corosync @ localhost ------') check_local(handler) + print('------ cib ------') check_global(handler) handler.end() match handler: @@ -189,12 +185,12 @@ def check(args: typing.Sequence[str]) -> int: print('****** summary ******') if ret == 0: CheckResultInteractiveHandler.write_in_color(sys.stdout, constants.GREEN, '[INFO]') - sys.stdout.write(' Please run "crm cluster health sles16 --fix" on on any one of above nodes, after migrating all the nodes to SLES 16.\n') + sys.stdout.write(' Please run "crm cluster health sles16 --fix" on on any one of above nodes.\n') CheckResultInteractiveHandler.write_in_color(sys.stdout, constants.GREEN, '[PASS]') sys.stdout.write(' This cluster is good to migrate to SLES 16.\n') else: CheckResultInteractiveHandler.write_in_color(sys.stdout, constants.RED, '[FAIL]') - sys.stdout.write(' Please fix all the "FAIL" problems above before migrating to SLES 16.\n') + sys.stdout.write(' The pacemaker cluster stack can not migrate to SLES 16.\n') return ret @@ -218,7 +214,7 @@ def run(self): prun_thread.join() ret = 0 for host, result in prun_thread.result.items(): - sys.stdout.write(f'------ {host} ------\n') + sys.stdout.write(f'------ corosync @ {host} ------\n') match result: case prun.SSHError() as e: handler.write_in_color( @@ -339,8 +335,7 @@ def _check_unsupported_corosync_transport(handler: CheckResultHandler, dom): except KeyError: # looks like a corosync 3 config return - handler.handle_tip(f'Corosync transport "{transport}" will be deprecated in corosync 3.', [ - 'Run "crm health sles16 --fix" to migrate it to transport "knet".', + handler.handle_tip(f'Corosync transport "{transport}" will be deprecated in corosync 3. Please use knet.', [ ]) @@ -528,8 +523,7 @@ def check_unsupported_resource_agents(handler: CheckResultHandler): ocf_resource_agents.append(resource_agent) elif resource_agent.m_class == 'stonith': if resource_agent.m_type == 'external/sbd': - handler.handle_tip('stonith:external/sbd will be removed.', [ - '* Please replace it with stonith:fence_sbd.' + handler.handle_tip('stonith:external/sbd will be removed. Please use stonith:fence_sbd', [ ]) else: stonith_resource_agents.append(resource_agent) @@ -605,6 +599,5 @@ def _check_removed_resource_agents( def _check_ocfs2(handler: CheckResultHandler, cib: lxml.etree.Element): if cibquery.has_primitive_filesystem_with_fstype(cib, 'ocfs2'): - handler.handle_problem(False, 'OCFS2 is not supported in SLES 16.', [ - '* Before migrating to SLES 16, replace it with GFS2.', + handler.handle_problem(False, 'OCFS2 is not supported in SLES 16. Please use GFS2.', [ ]) diff --git a/test/features/migration.feature b/test/features/migration.feature index 43dce9a36..7435c54e7 100644 --- a/test/features/migration.feature +++ b/test/features/migration.feature @@ -10,7 +10,7 @@ Feature: migration And Run "crm cluster init -y -N hanode2" OK on "hanode1" When Try "crm cluster health sles16" on "hanode1" Then Expected return code is "1" - And Expect stdout contains snippets ["[WARN] Corosync transport \"udpu\" will be deprecated in corosync 3.", "[FAIL] Please fix all the \"FAIL\" problems above before migrating to SLES 16.", "----- localhost -----", "----- hanode2 -----"]. + And Expect stdout contains snippets ["[WARN] Corosync transport \"udpu\" will be deprecated in corosync 3.", "[FAIL] The pacemaker cluster stack can not migrate to SLES 16. Please fix all the \"FAIL\" problems above before migrating to SLES 16.", "----- corosync @ localhost -----", "----- corosync @ hanode2 -----"]. Scenario: Should not run fixes. When Try "crm cluster health sles16 --fix" on "hanode1" @@ -21,10 +21,10 @@ Feature: migration When Run "crm cluster stop --all" on "hanode1" And Try "crm cluster health sles16" on "hanode1" Then Expected return code is "1" - And Expect stdout contains snippets ["Check results may be outdated or inaccurate.", "[WARN] Corosync transport \"udpu\" will be deprecated in corosync 3.", "[FAIL] Please fix all the \"FAIL\" problems above before migrating to SLES 16.", "----- localhost -----", "----- hanode2 -----"]. + And Expect stdout contains snippets ["Check results may be outdated or inaccurate.", "[WARN] Corosync transport \"udpu\" will be deprecated in corosync 3.", "[FAIL] The pacemaker cluster stack can not migrate to SLES 16. Please fix all the \"FAIL\" problems above before migrating to SLES 16.", "----- corosync @ localhost -----", "----- corosync @ hanode2 -----"]. Scenario: Run pre-migration checks when some of the nodes are offline. When Run "systemctl stop sshd" on "hanode2" And Try "crm cluster health sles16" on "hanode1" Then Expected return code is "1" - And Expect stdout contains snippets ["Cannot create SSH connection to", "[FAIL] Please fix all the \"FAIL\" problems above before migrating to SLES 16.", "----- localhost -----", "----- hanode2 -----"]. + And Expect stdout contains snippets ["Cannot create SSH connection to", "[FAIL] The pacemaker cluster stack can not migrate to SLES 16. Please fix all the \"FAIL\" problems above before migrating to SLES 16.", "----- corosync @ localhost -----", "----- corosync @ hanode2 -----"].