-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
failover: add failover_primary_timeout option
This was previously hardcoded to 31 seconds (hardcoded retry_timout + 1). This may be too short period under some circumstances. When we retry primary server we drop connection to the backup server and if the primary server is not yet available (and there are many unavailable primary servers) we may go through a long timeout cycle every half minute. This patch makes the value configurable. :config: Added `failover_primary_timout` configuration option. This can be used to configure how often SSSD tries to reconnect to a primary server after a successful connection to a backup server. This was previously hardcoded to 31 seconds which is kept as the default value. Resolves: #7375 Reviewed-by: Alexey Tikhonov <[email protected]> Reviewed-by: Iker Pedrosa <[email protected]> (cherry picked from commit e9738e3) (cherry picked from commit 14f32f6)
- Loading branch information
1 parent
c012186
commit f5bfcb9
Showing
10 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
SSSD Failover tests. | ||
:requirement: Failover | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
import pytest | ||
from sssd_test_framework.roles.client import Client | ||
from sssd_test_framework.roles.ldap import LDAP | ||
from sssd_test_framework.topology import KnownTopology | ||
|
||
|
||
@pytest.mark.parametrize("value, expected", [(None, 31), (15, 31), (60, 60)]) | ||
@pytest.mark.importance("low") | ||
@pytest.mark.ticket(gh=7375, jira="RHEL-17659") | ||
@pytest.mark.topology(KnownTopology.LDAP) | ||
def test_failover__retry_primary(client: Client, ldap: LDAP, value: int | None, expected: int): | ||
""" | ||
:title: Primary server reactivation timeout is respected | ||
:setup: | ||
1. Create LDAP user "user-1" | ||
2. Set failover_primary_timeout to @value | ||
3. Set ldap_uri to invalid, not working server | ||
4. Set ldap_backup_uri to working server | ||
5. Start SSSD | ||
:steps: | ||
1. Lookup user-1 | ||
2. Check that SSSD is connected to backup server | ||
3. Find "Primary server reactivation timeout set to @expected seconds" in domain logs | ||
:expectedresults: | ||
1. SSSD failover to backup server | ||
2. SSSD is indeed connected to the backup server | ||
3. String is found | ||
:customerscenario: True | ||
""" | ||
ldap.user("user-1").add() | ||
|
||
if value is not None: | ||
client.sssd.domain["failover_primary_timeout"] = str(value) | ||
|
||
client.sssd.enable_responder("ifp") | ||
client.sssd.domain["ldap_uri"] = "ldap://ldap.invalid" | ||
client.sssd.domain["ldap_backup_uri"] = f"ldap://{ldap.host.hostname}" | ||
client.sssd.start() | ||
|
||
# Lookup user to make sure SSSD did correctly failover to backup server | ||
result = client.tools.id("user-1") | ||
assert result is not None | ||
|
||
# Check that SSSD is indeed connected to backup server | ||
assert client.sssd.default_domain is not None | ||
status = client.sssctl.domain_status(client.sssd.default_domain, active=True) | ||
assert ldap.host.hostname in status.stdout | ||
|
||
# Check that primary server reactivation timeout was correctly created | ||
log = client.fs.read(client.sssd.logs.domain()) | ||
assert f"Primary server reactivation timeout set to {expected} seconds" in log |