Skip to content

Commit

Permalink
ttt
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Aug 1, 2024
1 parent 23c16c0 commit e8f53af
Show file tree
Hide file tree
Showing 6 changed files with 426 additions and 308 deletions.
11 changes: 7 additions & 4 deletions crmsh/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ def _validate_sbd_option(self):
"""
Validate sbd options
"""
from .sbd import SBDUtils
if self.sbd_devices and self.diskless_sbd:
utils.fatal("Can't use -s and -S options together")
if self.sbd_devices:
SBDUtils.verify_sbd_device(self.sbd_devices)
if self.stage == "sbd":
if not self.sbd_devices and not self.diskless_sbd and self.yes_to_all:
utils.fatal("Stage sbd should specify sbd device by -s or diskless sbd by -S option")
Expand Down Expand Up @@ -298,8 +301,8 @@ def validate_option(self):
self._validate_sbd_option()

def init_sbd_manager(self):
from .sbd import SBDManager
self.sbd_manager = SBDManager(self)
from .sbd import SBDManager2
self.sbd_manager = SBDManager2(bootstrap_context=self)

def detect_platform(self):
"""
Expand Down Expand Up @@ -501,7 +504,7 @@ def is_online():
return False

# if peer_node is None, this is in the init process
if _context.cluster_node is None:
if not _context or _context.cluster_node is None:
return True
# In join process
# If the joining node is already online but can't find the init node
Expand Down Expand Up @@ -1397,7 +1400,7 @@ def init_sbd():
import crmsh.sbd
if _context.stage == "sbd":
crmsh.sbd.clean_up_existing_sbd_resource()
_context.sbd_manager.sbd_init()
_context.sbd_manager.init_and_deploy_sbd()


def init_upgradeutil():
Expand Down
2 changes: 1 addition & 1 deletion crmsh/ocfs2.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _check_sbd_and_ocfs2_dev(self):
"""
from . import sbd
if ServiceManager().service_is_enabled("sbd.service"):
sbd_device_list = sbd.SBDManager.get_sbd_device_from_config()
sbd_device_list = sbd.SBDUtils.get_sbd_device_from_config()
for dev in self.ocfs2_devices:
if dev in sbd_device_list:
self._dynamic_raise_error("{} cannot be the same with SBD device".format(dev))
Expand Down
6 changes: 3 additions & 3 deletions crmsh/qdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,12 @@ def adjust_sbd_watchdog_timeout_with_qdevice(self):
"""
Adjust SBD_WATCHDOG_TIMEOUT when configuring qdevice and diskless SBD
"""
from .sbd import SBDManager, SBDTimeout
from .sbd import SBDManager, SBDTimeout, SBDUtils
utils.check_all_nodes_reachable()
self.using_diskless_sbd = SBDManager.is_using_diskless_sbd()
self.using_diskless_sbd = SBDUtils.is_using_diskless_sbd()
# add qdevice after diskless sbd started
if self.using_diskless_sbd:
res = SBDManager.get_sbd_value_from_config("SBD_WATCHDOG_TIMEOUT")
res = SBDUtils.get_sbd_value_from_config("SBD_WATCHDOG_TIMEOUT")
if not res or int(res) < SBDTimeout.SBD_WATCHDOG_TIMEOUT_DEFAULT_WITH_QDEVICE:
sbd_watchdog_timeout_qdevice = SBDTimeout.SBD_WATCHDOG_TIMEOUT_DEFAULT_WITH_QDEVICE
SBDManager.update_configuration({"SBD_WATCHDOG_TIMEOUT": str(sbd_watchdog_timeout_qdevice)})
Expand Down
Loading

0 comments on commit e8f53af

Please sign in to comment.