Skip to content

Commit

Permalink
sbd2
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Jul 29, 2021
1 parent c2ec736 commit 06b56de
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions crmsh/sbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,33 @@ def _get_sbd_device(self):
dev_list = self._get_sbd_device_interactive()
self._sbd_devices = dev_list

def _correct_sbd_watchdog_timeout_for_s390(self):
"""
Corrent watchdog timeout if less than s390 default
"""
if self._context.is_s390 and self._sbd_watchdog_timeout < self.SBD_WATCHDOG_TIMEOUT_DEFAULT_S390:
bootstrap.warn("sbd_watchdog_timeout is set to {} for s390, it was {}".format(self.SBD_WATCHDOG_TIMEOUT_DEFAULT_S390, self._sbd_watchdog_timeout))
self._sbd_watchdog_timeout = self.SBD_WATCHDOG_TIMEOUT_DEFAULT_S390

def _initialize_sbd(self):
"""
Initialize SBD device
"""
opt = ""
if "sbd.watchdog_timeout" in self._context.profiles_dict:
self._sbd_watchdog_timeout = self._context.profiles_dict["sbd.watchdog_timeout"]
sbd_msgwait = int(self._sbd_watchdog_timeout) * 2
opt = "-4 {} -1 {}".format(sbd_msgwait, self._sbd_watchdog_timeout)
self._correct_sbd_watchdog_timeout_for_s390()
if self.diskless_sbd:
return

sbd_msgwait_default = int(self._sbd_watchdog_timeout) * 2
sbd_msgwait = sbd_msgwait_default
if "sbd.msgwait" in self._context.profiles_dict:
sbd_msgwait = self._context.profiles_dict["sbd.msgwait"]
if int(sbd_msgwait) < int(self._sbd_watchdog_timeout) * 2:
bootstrap.warn("sbd.msgwait should >= sbd.watchdog_timeout * 2")
opt = "-4 {} -1 {}".format(sbd_msgwait, self._sbd_watchdog_timeout)
if int(sbd_msgwait) < sbd_msgwait_default:
bootstrap.warn("sbd msgwait is set to {}, it was {}".format(sbd_msgwait_default, sbd_msgwait))
sbd_msgwait = sbd_msgwait_default
opt = "-4 {} -1 {}".format(sbd_msgwait, self._sbd_watchdog_timeout)

for dev in self._sbd_devices:
rc, _, err = bootstrap.invoke("sbd {} -d {} create".format(opt, dev))
if not rc:
Expand Down Expand Up @@ -207,8 +218,7 @@ def _determine_sbd_watchdog_timeout(self):
if utils.is_qdevice_configured() and utils.service_is_active("corosync-qdevice.service"):
qdevice_sync_timeout = utils.get_qdevice_sync_timeout()
self._sbd_watchdog_timeout = qdevice_sync_timeout + 5
if self._context.is_s390 and self._sbd_watchdog_timeout < self.SBD_WATCHDOG_TIMEOUT_DEFAULT_S390:
self._sbd_watchdog_timeout = self.SBD_WATCHDOG_TIMEOUT_DEFAULT_S390
self._correct_sbd_watchdog_timeout_for_s390()
self._stonith_timeout = self.calculate_stonith_timeout(self._sbd_watchdog_timeout)
# add sbd and qdevice together from beginning
elif self._context.qdevice_inst:
Expand Down

0 comments on commit 06b56de

Please sign in to comment.