3636from . import userdir
3737from .constants import QDEVICE_HELP_INFO , STONITH_TIMEOUT_DEFAULT ,\
3838 REJOIN_COUNT , REJOIN_INTERVAL , PCMK_DELAY_MAX , CSYNC2_SERVICE , WAIT_TIMEOUT_MS_DEFAULT
39+ from . import cluster_fs
3940from . import qdevice
4041from . import parallax
4142from . import log
7071 "/etc/samba/smb.conf" , SYSCONFIG_NFS , SYSCONFIG_PCMK , SBDManager .SYSCONFIG_SBD , PCMK_REMOTE_AUTH , watchdog .Watchdog .WATCHDOG_CFG ,
7172 PROFILES_FILE , CRM_CFG , SBDManager .SBD_SYSTEMD_DELAY_START_DIR )
7273
73- INIT_STAGES_EXTERNAL = ("ssh" , "csync2" , "corosync" , "sbd" , "cluster" , "admin" , "qdevice" )
74+ INIT_STAGES_EXTERNAL = ("ssh" , "csync2" , "corosync" , "sbd" , "cluster" , "ocfs2" , "gfs2" , " admin" , "qdevice" )
7475INIT_STAGES_INTERNAL = ("csync2_remote" , "qnetd_remote" )
7576INIT_STAGES_ALL = INIT_STAGES_EXTERNAL + INIT_STAGES_INTERNAL
7677JOIN_STAGES_EXTERNAL = ("ssh" , "csync2" , "ssh_merge" , "cluster" )
@@ -111,6 +112,10 @@ def __init__(self):
111112 self .qdevice_heuristics = None
112113 self .qdevice_heuristics_mode = None
113114 self .qdevice_rm_flag = None
115+ self .ocfs2_devices = []
116+ self .gfs2_devices = []
117+ self .use_cluster_lvm2 = None
118+ self .mount_point = None
114119 self .cluster_node = None
115120 self .force = None
116121 self .arbitrator = None
@@ -269,7 +274,7 @@ def _validate_stage(self):
269274 if self .type == "init" :
270275 if self .stage not in INIT_STAGES_ALL :
271276 utils .fatal (f"Invalid stage: { self .stage } (available stages: { ', ' .join (INIT_STAGES_EXTERNAL )} )" )
272- if self .stage in ("admin" , "qdevice" ) and not self .cluster_is_running :
277+ if self .stage in ("admin" , "qdevice" , "ocfs2" ) and not self .cluster_is_running :
273278 utils .fatal (f"Cluster is inactive, can't run '{ self .stage } ' stage" )
274279 if self .stage in ("corosync" , "cluster" ) and self .cluster_is_running :
275280 utils .fatal (f"Cluster is active, can't run '{ self .stage } ' stage" )
@@ -288,6 +293,8 @@ def validate_option(self):
288293 """
289294 if self .qdevice_inst :
290295 self .qdevice_inst .valid_qdevice_options ()
296+ if self .ocfs2_devices or self .gfs2_devices or self .stage in ("ocfs2" , "gfs2" ):
297+ cluster_fs .ClusterFSManager .pre_verify (self )
291298 if not self .skip_csync2 and self .type == "init" :
292299 self .skip_csync2 = utils .get_boolean (os .getenv ("SKIP_CSYNC2_SYNC" ))
293300 if self .skip_csync2 and self .stage :
@@ -1402,6 +1409,26 @@ def init_sbd():
14021409 _context .sbd_manager .init_and_deploy_sbd ()
14031410
14041411
1412+ def init_ocfs2 ():
1413+ """
1414+ OCFS2 configure process
1415+ """
1416+ if not _context .ocfs2_devices :
1417+ return
1418+ ocfs2_manager = cluster_fs .ClusterFSManager (_context )
1419+ ocfs2_manager .init ()
1420+
1421+
1422+ def init_gfs2 ():
1423+ """
1424+ GFS2 configure process
1425+ """
1426+ if not _context .gfs2_devices :
1427+ return
1428+ gfs2_manager = cluster_fs .ClusterFSManager (_context )
1429+ gfs2_manager .init ()
1430+
1431+
14051432def init_cluster ():
14061433 """
14071434 Initial cluster configuration.
@@ -2187,6 +2214,8 @@ def bootstrap_init(context):
21872214 init_cluster ()
21882215 init_admin ()
21892216 init_qdevice ()
2217+ init_ocfs2 ()
2218+ init_gfs2 ()
21902219 except lock .ClaimLockError as err :
21912220 utils .fatal (err )
21922221
@@ -2284,6 +2313,7 @@ def bootstrap_join(context):
22842313 join_csync2 (cluster_node , remote_user )
22852314 join_ssh_merge (cluster_node , remote_user )
22862315 probe_partitions ()
2316+ join_cluster_fs (cluster_node , remote_user )
22872317 join_cluster (cluster_node , remote_user )
22882318 except (lock .SSHError , lock .ClaimLockError ) as err :
22892319 utils .fatal (err )
@@ -2295,6 +2325,14 @@ def bootstrap_finished():
22952325 logger .info ("Done (log saved to %s on %s)" , log .CRMSH_LOG_FILE , utils .this_node ())
22962326
22972327
2328+ def join_cluster_fs (peer_host , peer_user ):
2329+ """
2330+ If init node configured OCFS2/GFS2 device, verify that device on join node
2331+ """
2332+ inst = cluster_fs .ClusterFSManager (_context )
2333+ inst .join (peer_host )
2334+
2335+
22982336def remove_qdevice () -> None :
22992337 """
23002338 Remove qdevice service and configuration from cluster
0 commit comments