File tree Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,21 @@ def adjust_sbd_timeout_related_cluster_configuration(cls):
248248 cls_inst .adjust_stonith_timeout ()
249249 cls_inst .adjust_systemd_start_timeout ()
250250
251+ @staticmethod
252+ def able_to_set_stonith_watchdog_timeout (value : int ) -> bool :
253+ '''
254+ Check if able to set stonith-watchdog-timeout property
255+ '''
256+ if not ServiceManager ().service_is_active ("sbd.service" ):
257+ logger .error ("Can't set stonith-watchdog-timeout because sbd.service is not active" )
258+ return False
259+ sbd_watchdog_timeout = SBDTimeout .get_sbd_watchdog_timeout ()
260+ if value < sbd_watchdog_timeout :
261+ logger .error ("Can't set stonith-watchdog-timeout to %d because it is less than SBD_WATCHDOG_TIMEOUT(now: %d)" ,
262+ value , sbd_watchdog_timeout )
263+ return False
264+ return True
265+
251266
252267class SBDManager (object ):
253268 """
Original file line number Diff line number Diff line change @@ -158,13 +158,29 @@ def read_cib(fun, params=None):
158158def sanity_check_nvpairs (ident , node , attr_list ):
159159 rc = utils .VerifyResult .SUCCESS
160160 for nvpair in node .iterchildren ("nvpair" ):
161+ rc |= check_stonith_watchdog_timeout (nvpair )
161162 n = nvpair .get ("name" )
162163 if n and n not in attr_list :
163164 logger .warning ("%s: unknown attribute '%s'" , ident , n )
164165 rc |= utils .VerifyResult .WARNING
165166 return rc
166167
167168
169+ def check_stonith_watchdog_timeout (nvpair ):
170+ rc = utils .VerifyResult .SUCCESS
171+ name , value = nvpair .get ("name" ), nvpair .get ("value" )
172+ if name and name == "stonith-watchdog-timeout" and value :
173+ try :
174+ from . import sbd
175+ intval = int (value )
176+ if not sbd .SBDTimeout .able_to_set_stonith_watchdog_timeout (intval ):
177+ rc = utils .VerifyResult .FATAL_ERROR
178+ except ValueError :
179+ logger .error ("stonith-watchdog-timeout must be an integer" )
180+ rc = utils .VerifyResult .FATAL_ERROR
181+ return rc
182+
183+
168184def sanity_check_meta (ident , node , attr_list ):
169185 rc = utils .VerifyResult .SUCCESS
170186 if node is None or not attr_list :
Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ Feature: configure sbd delay start correctly
9797 And SBD option "SBD_WATCHDOG_TIMEOUT" value is "15"
9898 And Cluster property "stonith-timeout" is "71"
9999
100+ When Try "crm configure property stonith-watchdog-timeout=1" on "hanode1"
101+ Then Except "Can't set stonith-watchdog-timeout to 1 because it is less than SBD_WATCHDOG_TIMEOUT(now: 15)" in stderr
102+
100103 @clean
101104 Scenario : disk-based SBD with big sbd_watchdog_timeout
102105 When Run "sed -i 's/watchdog_timeout: 15/watchdog_timeout: 60/' /etc/crm/profiles.yml" on "hanode1"
Original file line number Diff line number Diff line change @@ -81,3 +81,11 @@ Feature: Functional test for configure sub level
8181 Then Cluster service is "started" on "hanode1"
8282 When Run "crm node attribute hanode1 set cpu 2" on "hanode1"
8383 Then Run "crm -F configure filter " sed 's/cpu=/#cpu=' /g"" OK on "hanode1"
84+
85+ @clean
86+ Scenario : Set stonith-watchdog-timeout when sbd.service is disactive
87+ Given Cluster service is "stopped" on "hanode1"
88+ When Run "crm cluster init -y" on "hanode1"
89+ Then Cluster service is "started" on "hanode1"
90+ When Try "crm configure property stonith-watchdog-timeout=20" on "hanode1"
91+ Then Except "Can't set stonith-watchdog-timeout because sbd.service is not active" in stderr
You can’t perform that action at this time.
0 commit comments