Skip to content

Commit

Permalink
ap: Raise dbus timeout
Browse files Browse the repository at this point in the history
With some recent changes on Azure Agent the default DBus call
timeout is not good enough. For example, in case of
`InstallDNSSECFirst_1_to_5` job hostnamectl received reply in ~20sec,
but later it increased to ~30sec (more subjobs - more time to reply).
It's good to raise this timeout to be more protected against minimum
performance times.

https://www.freedesktop.org/software/systemd/man/sd_bus_set_method_call_timeout.html#Description

Fixes: https://pagure.io/freeipa/issue/9207
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
  • Loading branch information
stanislavlevin committed Aug 1, 2022
1 parent 048225b commit 94329c7
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions ipatests/azure/scripts/setup_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from typing import NamedTuple, TYPE_CHECKING

if TYPE_CHECKING:
from typing import List, Tuple, Union
from typing import List, Tuple, Union, Dict

logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")

Expand Down Expand Up @@ -77,14 +77,19 @@ def ipv6(self):
return self._ipv6

def execute(
self, args: Union[str, List[str]], raiseonerr: bool = True
self,
args: Union[str, List[str]],
raiseonerr: bool = True,
env: Union[Dict[str, str], List[str], None] = None,
) -> ExecRunReturn:
"""
Exec an arbitrary command within container
"""
dcont = self.dclient.containers.get(self.name)
logging.info("%s: run: %s", dcont.name, args)
result: ExecRunReturn = dcont.exec_run(args, demux=True)
result: ExecRunReturn = dcont.exec_run(
args, demux=True, environment=env
)
if result.output[0] is not None:
logging.info("%s: %s", dcont.name, result.output[0])
logging.info("%s: result: %s", dcont.name, result.exit_code)
Expand Down Expand Up @@ -127,13 +132,13 @@ def __init__(
for c in range(1, self.scale + 1)
]

def execute_all(self, args):
def execute_all(self, args, env=None):
"""
Sequentially exec an arbitrary command within every container of group
"""
results = []
for cont in self.containers:
results.append(cont.execute(args))
results.append(cont.execute(args, env=env))
return results

def ips(self):
Expand Down Expand Up @@ -199,7 +204,8 @@ def setup_hostname(self):
cont.execute(cmd)

cmd = ["hostnamectl", "set-hostname", cont.hostname]
cont.execute(cmd)
# default timeout (25s) maybe not enough
cont.execute(cmd, env={"SYSTEMD_BUS_TIMEOUT": "50"})

def setup_resolvconf(self):
"""
Expand Down Expand Up @@ -331,15 +337,15 @@ def master_container(self):

return self._master_container

def execute(self, args):
def execute(self, args, env=None):
"""
Execute a command on controller (either master or local machine)
"""
if self.contr_type != "master":
proc = subprocess.run(args, check=True, capture_output=True)
return [proc.stdout.decode().rstrip().strip("'")]

return self.master_container.execute(args)
return self.master_container.execute(args, env=env)

def setup_hosts(self):
"""
Expand Down

0 comments on commit 94329c7

Please sign in to comment.