Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crmsh/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ def _validate_sbd_option(self):
"""
Validate sbd options
"""
no_sbd_option = not self.sbd_devices and not self.diskless_sbd
if self.watchdog and no_sbd_option:
utils.fatal("-w option should be used with -s or -S option")
if self.sbd_devices and self.diskless_sbd:
utils.fatal("Can't use -s and -S options together")
if self.sbd_devices:
Expand Down
2 changes: 1 addition & 1 deletion crmsh/ui_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def do_init(self, context, *args):
parser.add_argument("-S", "--enable-sbd", dest="diskless_sbd", action="store_true",
help="Enable SBD even if no SBD device is configured (diskless mode)")
parser.add_argument("-w", "--watchdog", dest="watchdog", metavar="WATCHDOG",
help="Use the given watchdog device or driver name")
help="Use the given watchdog device or driver name (only valid together with -s or -S option)")
parser.add_argument("-x", "--skip-csync2-sync", dest="skip_csync2", action="store_true",
help="Skip csync2 initialization (default, deprecated)")
parser.add_argument('--use-ssh-agent', action=argparse.BooleanOptionalAction, dest='use_ssh_agent', default=True,
Expand Down
2 changes: 1 addition & 1 deletion crmsh/ui_sbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def configure_usage(self) -> str:

timeout_usage_str = " ".join([f"[{t}-timeout=<integer>]" for t in timeout_types])
show_usage = f"crm sbd configure show [{'|'.join(show_types)}]"
return f"Usage:\n{show_usage}\ncrm sbd configure {timeout_usage_str} [watchdog-device=<device>]\n"
return f"Usage:\n{show_usage}\ncrm sbd configure {timeout_usage_str} [watchdog-device=<device|driver>]\n"

def _show_sysconfig(self) -> None:
'''
Expand Down
2 changes: 1 addition & 1 deletion crmsh/watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def init_watchdog(self):
# self._input is invalid, exit
rc, _, _ = ShellUtils().get_stdout_stderr(f"modinfo {self._input}")
if rc != 0:
utils.fatal("Should provide valid watchdog device or driver name by -w option")
utils.fatal("Should provide valid watchdog device or driver name")

# self._input is a driver name, load it if it was unloaded
if not self._driver_is_loaded(self._input):
Expand Down
4 changes: 2 additions & 2 deletions doc/crm.8.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2218,11 +2218,11 @@ Usage:
...............
# For disk-based SBD
crm sbd configure show [disk_metadata|sysconfig|property]
crm sbd configure [watchdog-timeout=<integer>] [allocate-timeout=<integer>] [loop-timeout=<integer>] [msgwait-timeout=<integer>] [crashdump-watchdog-timeout=<integer>] [watchdog-device=<device>]
crm sbd configure [watchdog-timeout=<integer>] [allocate-timeout=<integer>] [loop-timeout=<integer>] [msgwait-timeout=<integer>] [crashdump-watchdog-timeout=<integer>] [watchdog-device=<device|driver>]

# For disk-less SBD
crm sbd configure show [sysconfig|property]
crm sbd configure [watchdog-timeout=<integer>] [crashdump-watchdog-timeout=<integer>] [watchdog-device=<device>]
crm sbd configure [watchdog-timeout=<integer>] [crashdump-watchdog-timeout=<integer>] [watchdog-device=<device|driver>]
...............

example:
Expand Down
3 changes: 2 additions & 1 deletion test/features/steps/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
-S, --enable-sbd Enable SBD even if no SBD device is configured
(diskless mode)
-w, --watchdog WATCHDOG
Use the given watchdog device or driver name
Use the given watchdog device or driver name (only
valid together with -s or -S option)
-x, --skip-csync2-sync
Skip csync2 initialization (default, deprecated)
--use-ssh-agent, --no-use-ssh-agent
Expand Down
4 changes: 2 additions & 2 deletions test/unittests/test_ui_sbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_configure_usage_disk_diskbased(self, mock_is_using_disk_based_sbd, mock
mock_is_using_disk_based_sbd.return_value = True
timeout_usage_str = " ".join([f"[{t}-timeout=<integer>]" for t in ui_sbd.SBD.TIMEOUT_TYPES])
show_usage = f"crm sbd configure show [{'|'.join(ui_sbd.SBD.SHOW_TYPES)}]"
expected = f"Usage:\n{show_usage}\ncrm sbd configure {timeout_usage_str} [watchdog-device=<device>]\n"
expected = f"Usage:\n{show_usage}\ncrm sbd configure {timeout_usage_str} [watchdog-device=<device|driver>]\n"
self.assertEqual(self.sbd_instance_diskbased.configure_usage, expected)
mock_is_using_disk_based_sbd.assert_called_once()
mock_is_using_diskless_sbd.assert_not_called()
Expand All @@ -167,7 +167,7 @@ def test_configure_usage_disk_diskless(self, mock_is_using_disk_based_sbd, mock_
mock_is_using_diskless_sbd.return_value = True
timeout_usage_str = " ".join([f"[{t}-timeout=<integer>]" for t in ui_sbd.SBD.DISKLESS_TIMEOUT_TYPES])
show_usage = f"crm sbd configure show [{'|'.join(ui_sbd.SBD.DISKLESS_SHOW_TYPES)}]"
expected = f"Usage:\n{show_usage}\ncrm sbd configure {timeout_usage_str} [watchdog-device=<device>]\n"
expected = f"Usage:\n{show_usage}\ncrm sbd configure {timeout_usage_str} [watchdog-device=<device|driver>]\n"
self.assertEqual(self.sbd_instance_diskless.configure_usage, expected)
mock_is_using_disk_based_sbd.assert_called_once()
mock_is_using_diskless_sbd.assert_called_once()
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/test_watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def test_init_watchdog_error(self, mock_set_info, mock_set_input, mock_valid, mo

mock_valid.assert_called_once_with("test")
mock_run.assert_called_once_with("modinfo test")
mock_error.assert_called_once_with("Should provide valid watchdog device or driver name by -w option")
mock_error.assert_called_once_with("Should provide valid watchdog device or driver name")

@mock.patch('crmsh.watchdog.Watchdog._get_device_through_driver')
@mock.patch('crmsh.watchdog.Watchdog._load_watchdog_driver')
Expand Down