Skip to content

Commit 16cd739

Browse files
Dev: migration: refine message wording (jsc#PED-11808)
(cherry picked from commit 97fa52b)
1 parent 219cb15 commit 16cd739

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

crmsh/migration.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,7 @@ def write_in_color(f, color: str, text: str):
124124
f.write(text)
125125

126126
def end(self):
127-
if self.has_problems:
128-
self.write_in_color(sys.stdout, constants.RED, '[FAIL]\n\n')
129-
else:
130-
self.write_in_color(sys.stdout, constants.GREEN, '[PASS]\n\n')
131-
if not self.has_problems:
132-
self.write_in_color(sys.stdout, constants.GREEN, '[PASS]\n')
127+
sys.stdout.write('\n')
133128

134129

135130
def migrate():
@@ -154,7 +149,7 @@ def check(args: typing.Sequence[str]) -> int:
154149
if not parsed_args.local and not parsed_args.json:
155150
check_remote_yield = check_remote()
156151
next(check_remote_yield)
157-
print('------ localhost ------')
152+
print('------ corosync @ localhost ------')
158153
else:
159154
check_remote_yield = itertools.repeat(0)
160155
match parsed_args.json:
@@ -173,6 +168,7 @@ def check(args: typing.Sequence[str]) -> int:
173168
next(check_remote_yield)
174169
print('------ corosync @ localhost ------')
175170
check_local(handler)
171+
print('------ cib ------')
176172
check_global(handler)
177173
handler.end()
178174
match handler:
@@ -189,12 +185,12 @@ def check(args: typing.Sequence[str]) -> int:
189185
print('****** summary ******')
190186
if ret == 0:
191187
CheckResultInteractiveHandler.write_in_color(sys.stdout, constants.GREEN, '[INFO]')
192-
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')
188+
sys.stdout.write(' Please run "crm cluster health sles16 --fix" on on any one of above nodes.\n')
193189
CheckResultInteractiveHandler.write_in_color(sys.stdout, constants.GREEN, '[PASS]')
194190
sys.stdout.write(' This cluster is good to migrate to SLES 16.\n')
195191
else:
196192
CheckResultInteractiveHandler.write_in_color(sys.stdout, constants.RED, '[FAIL]')
197-
sys.stdout.write(' Please fix all the "FAIL" problems above before migrating to SLES 16.\n')
193+
sys.stdout.write(' The pacemaker cluster stack can not migrate to SLES 16.\n')
198194
return ret
199195

200196

@@ -218,7 +214,7 @@ def run(self):
218214
prun_thread.join()
219215
ret = 0
220216
for host, result in prun_thread.result.items():
221-
sys.stdout.write(f'------ {host} ------\n')
217+
sys.stdout.write(f'------ corosync @ {host} ------\n')
222218
match result:
223219
case prun.SSHError() as e:
224220
handler.write_in_color(
@@ -339,8 +335,7 @@ def _check_unsupported_corosync_transport(handler: CheckResultHandler, dom):
339335
except KeyError:
340336
# looks like a corosync 3 config
341337
return
342-
handler.handle_tip(f'Corosync transport "{transport}" will be deprecated in corosync 3.', [
343-
'Run "crm health sles16 --fix" to migrate it to transport "knet".',
338+
handler.handle_tip(f'Corosync transport "{transport}" will be deprecated in corosync 3. Please use knet.', [
344339
])
345340

346341

@@ -528,8 +523,7 @@ def check_unsupported_resource_agents(handler: CheckResultHandler):
528523
ocf_resource_agents.append(resource_agent)
529524
elif resource_agent.m_class == 'stonith':
530525
if resource_agent.m_type == 'external/sbd':
531-
handler.handle_tip('stonith:external/sbd will be removed.', [
532-
'* Please replace it with stonith:fence_sbd.'
526+
handler.handle_tip('stonith:external/sbd will be removed. Please use stonith:fence_sbd', [
533527
])
534528
else:
535529
stonith_resource_agents.append(resource_agent)
@@ -605,6 +599,5 @@ def _check_removed_resource_agents(
605599

606600
def _check_ocfs2(handler: CheckResultHandler, cib: lxml.etree.Element):
607601
if cibquery.has_primitive_filesystem_with_fstype(cib, 'ocfs2'):
608-
handler.handle_problem(False, 'OCFS2 is not supported in SLES 16.', [
609-
'* Before migrating to SLES 16, replace it with GFS2.',
602+
handler.handle_problem(False, 'OCFS2 is not supported in SLES 16. Please use GFS2.', [
610603
])

test/features/migration.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Feature: migration
1010
And Run "crm cluster init -y -N hanode2" OK on "hanode1"
1111
When Try "crm cluster health sles16" on "hanode1"
1212
Then Expected return code is "1"
13-
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 -----"].
13+
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 -----"].
1414

1515
Scenario: Should not run fixes.
1616
When Try "crm cluster health sles16 --fix" on "hanode1"
@@ -21,10 +21,10 @@ Feature: migration
2121
When Run "crm cluster stop --all" on "hanode1"
2222
And Try "crm cluster health sles16" on "hanode1"
2323
Then Expected return code is "1"
24-
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 -----"].
24+
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 -----"].
2525

2626
Scenario: Run pre-migration checks when some of the nodes are offline.
2727
When Run "systemctl stop sshd" on "hanode2"
2828
And Try "crm cluster health sles16" on "hanode1"
2929
Then Expected return code is "1"
30-
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 -----"].
30+
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 -----"].

0 commit comments

Comments
 (0)