Skip to content

Commit c85bee8

Browse files
committed
pgsqlms: only check notify and promotable when OCF_CHECK_LEVEL=10
Pacemaker has started running validate-all action before creating the resource. It doesnt provide notify/promotable settings while doing so, so this patch moves these checks to OCF_CHECK_LEVEL 10 and runs the validate action at OCF_CHECK_LEVEL 10 when action is not validate-all.
1 parent d191e09 commit c85bee8

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

script/pgsqlms

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ my $start_opts = $ENV{'OCF_RESKEY_start_opts'} || $start_opts_default;
6464
my $maxlag = $ENV{'OCF_RESKEY_maxlag'} || $maxlag_default;
6565
my $recovery_tpl = $ENV{'OCF_RESKEY_recovery_template'}
6666
|| "$pgdata/recovery.conf.pcmk";
67+
my $ocf_check_level = $ENV{'OCF_CHECK_LEVEL'} || 0;
6768

6869

6970
# PostgreSQL commands path
@@ -1323,24 +1324,26 @@ sub pgsql_validate_all {
13231324
return $OCF_ERR_INSTALLED;
13241325
}
13251326

1326-
# check notify=true
1327-
unless ( defined $ENV{'OCF_RESKEY_CRM_meta_notify'}
1328-
and lc($ENV{'OCF_RESKEY_CRM_meta_notify'}) =~ /^true$|^on$|^yes$|^y$|^1$/ ) {
1329-
ocf_exit_reason(
1330-
'You must set meta parameter notify=true for your "master" resource'
1331-
);
1332-
return $OCF_ERR_INSTALLED;
1333-
}
1327+
if ( $ocf_check_level == 10 ) {
1328+
# check notify=true
1329+
unless ( defined $ENV{'OCF_RESKEY_CRM_meta_notify'}
1330+
and lc($ENV{'OCF_RESKEY_CRM_meta_notify'}) =~ /^true$|^on$|^yes$|^y$|^1$/ ) {
1331+
ocf_exit_reason(
1332+
'You must set meta parameter notify=true for your "master" resource'
1333+
);
1334+
return $OCF_ERR_INSTALLED;
1335+
}
13341336

1335-
# check master-max=1
1336-
unless (
1337-
defined $ENV{'OCF_RESKEY_CRM_meta_master_max'}
1338-
and $ENV{'OCF_RESKEY_CRM_meta_master_max'} eq '1'
1339-
) {
1340-
ocf_exit_reason(
1341-
'You must set meta parameter master-max=1 for your "master" resource'
1342-
);
1343-
return $OCF_ERR_INSTALLED;
1337+
# check master-max=1
1338+
unless (
1339+
defined $ENV{'OCF_RESKEY_CRM_meta_master_max'}
1340+
and $ENV{'OCF_RESKEY_CRM_meta_master_max'} eq '1'
1341+
) {
1342+
ocf_exit_reason(
1343+
'You must set meta parameter master-max=1 for your "master" resource'
1344+
);
1345+
return $OCF_ERR_INSTALLED;
1346+
}
13441347
}
13451348

13461349
if ( $PGVERNUM >= $PGVER_12 ) {
@@ -2271,6 +2274,9 @@ $PGVERNUM = _get_pg_version();
22712274
# Set current node name.
22722275
$nodename = ocf_local_nodename();
22732276

2277+
if ( $__OCF_ACTION eq 'validate-all' ) {
2278+
$ocf_check_level = 10;
2279+
}
22742280
$exit_code = pgsql_validate_all();
22752281

22762282
exit $exit_code if $exit_code != $OCF_SUCCESS or $__OCF_ACTION eq 'validate-all';

0 commit comments

Comments
 (0)