mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
Provide more detailed logging around memory detection
This should make it easier to troubleshoot low memory installation failures from the logs. https://pagure.io/freeipa/issue/8404 Signed-off-by: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
parent
98a88bd719
commit
75c1b7ed34
@ -1077,16 +1077,19 @@ def check_available_memory(ca=False):
|
|||||||
if not ca:
|
if not ca:
|
||||||
minimum_suggested -= 150 * 1000 * 1000
|
minimum_suggested -= 150 * 1000 * 1000
|
||||||
if in_container():
|
if in_container():
|
||||||
|
logger.debug("container detected")
|
||||||
# cgroup v1
|
# cgroup v1
|
||||||
if os.path.exists(
|
if os.path.exists(
|
||||||
'/sys/fs/cgroup/memory/memory.limit_in_bytes'
|
'/sys/fs/cgroup/memory/memory.limit_in_bytes'
|
||||||
) and os.path.exists('/sys/fs/cgroup/memory/memory.usage_in_bytes'):
|
) and os.path.exists('/sys/fs/cgroup/memory/memory.usage_in_bytes'):
|
||||||
|
logger.debug("cgroup v1")
|
||||||
limit_file = '/sys/fs/cgroup/memory/memory.limit_in_bytes'
|
limit_file = '/sys/fs/cgroup/memory/memory.limit_in_bytes'
|
||||||
usage_file = '/sys/fs/cgroup/memory/memory.usage_in_bytes'
|
usage_file = '/sys/fs/cgroup/memory/memory.usage_in_bytes'
|
||||||
# cgroup v2
|
# cgroup v2
|
||||||
elif os.path.exists(
|
elif os.path.exists(
|
||||||
'/sys/fs/cgroup/memory.current'
|
'/sys/fs/cgroup/memory.current'
|
||||||
) and os.path.exists('/sys/fs/cgroup/memory.max'):
|
) and os.path.exists('/sys/fs/cgroup/memory.max'):
|
||||||
|
logger.debug("cgroup v2")
|
||||||
limit_file = '/sys/fs/cgroup/memory.max'
|
limit_file = '/sys/fs/cgroup/memory.max'
|
||||||
usage_file = '/sys/fs/cgroup/memory.current'
|
usage_file = '/sys/fs/cgroup/memory.current'
|
||||||
else:
|
else:
|
||||||
@ -1105,11 +1108,14 @@ def check_available_memory(ca=False):
|
|||||||
if limit != 'max':
|
if limit != 'max':
|
||||||
available = int(limit) - used
|
available = int(limit) - used
|
||||||
|
|
||||||
|
logger.debug("Max RAM %s, used RAM %s", limit, used)
|
||||||
|
|
||||||
if available is None:
|
if available is None:
|
||||||
# delay import of psutil. On import it opens files in /proc and
|
# delay import of psutil. On import it opens files in /proc and
|
||||||
# can trigger a SELinux violation.
|
# can trigger a SELinux violation.
|
||||||
import psutil
|
import psutil
|
||||||
available = psutil.virtual_memory().available
|
available = psutil.virtual_memory().available
|
||||||
|
logger.debug(psutil.virtual_memory())
|
||||||
|
|
||||||
if available is None:
|
if available is None:
|
||||||
raise ScriptError(
|
raise ScriptError(
|
||||||
|
Loading…
Reference in New Issue
Block a user