99from . import corosync
1010from . import xmlutil
1111from . import watchdog
12- from . import parallax
1312from .service_manager import ServiceManager
1413from .sh import ShellUtils
1514
@@ -787,6 +786,19 @@ def cleanup_existing_sbd_resource():
787786 utils .ext_cmd ("crm configure delete {}" .format (' ' .join (sbd_id_list )))
788787
789788
789+ def cleanup_sbd_configurations (remote = None ):
790+ shell = sh .cluster_shell ()
791+ sysconfig_sbd_bak = f"{ SBDManager .SYSCONFIG_SBD } .bak"
792+ logger .info ("Rename %s to %s on node %s" ,
793+ SBDManager .SYSCONFIG_SBD , sysconfig_sbd_bak , remote or utils .this_node ())
794+ cmd = f"test -f { SBDManager .SYSCONFIG_SBD } && mv { SBDManager .SYSCONFIG_SBD } { sysconfig_sbd_bak } || exit 0"
795+ shell .get_stdout_or_raise_error (cmd , host = remote )
796+
797+ for _dir in [SBDManager .SBD_SYSTEMD_DELAY_START_DIR , SBDManager .SBD_SYSTEMD_DELAY_START_DISABLE_DIR ]:
798+ cmd = f"test -d { _dir } && rm -rf { _dir } && systemctl daemon-reload || exit 0"
799+ shell .get_stdout_or_raise_error (cmd , host = remote )
800+
801+
790802def purge_sbd_from_cluster ():
791803 '''
792804 Purge SBD from cluster, the process includes:
@@ -804,17 +816,10 @@ def purge_sbd_from_cluster():
804816 if service_manager .service_is_enabled (constants .SBD_SERVICE , node ):
805817 logger .info ("Disable %s on node %s" , constants .SBD_SERVICE , node )
806818 service_manager .disable_service (constants .SBD_SERVICE , node )
807-
808- config_bak = f"{ SBDManager .SYSCONFIG_SBD } .bak"
809- logger .info ("Move %s to %s on all nodes" , SBDManager .SYSCONFIG_SBD , config_bak )
810- utils .cluster_run_cmd (f"mv { SBDManager .SYSCONFIG_SBD } { config_bak } " )
819+ cleanup_sbd_configurations (node )
811820
812821 out = sh .cluster_shell ().get_stdout_or_raise_error ("stonith_admin -L" )
813822 res = re .search ("([0-9]+) fence device[s]* found" , out )
814823 # after disable sbd.service, check if sbd is the last stonith device
815824 if res and int (res .group (1 )) <= 1 :
816825 utils .cleanup_stonith_related_properties ()
817-
818- for _dir in [SBDManager .SBD_SYSTEMD_DELAY_START_DIR , SBDManager .SBD_SYSTEMD_DELAY_START_DISABLE_DIR ]:
819- cmd = f"test -d { _dir } && rm -rf { _dir } || exit 0"
820- parallax .parallax_call (cluster_nodes , cmd )
0 commit comments