Skip to content

Commit

Permalink
Support cgroup fs head path on distros where unified is default
Browse files Browse the repository at this point in the history
deb11
rhel9
...
  • Loading branch information
cvaroqui committed Nov 15, 2021
1 parent cb1c03a commit 91221a4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions opensvc/drivers/pg/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
import core.exceptions as ex
from utilities.converters import convert_size

UNIFIED_MNT = "/sys/fs/cgroup/unified"
UNIFIED = os.path.exists(UNIFIED_MNT)
DRIVER_BASENAME = 'pg'

if os.path.exists("/sys/fs/cgroup/cgroup.procs"):
UNIFIED_MNT = "/sys/fs/cgroup"
UNIFIED = True
elif os.path.exists("/sys/fs/cgroup/unified"):
UNIFIED_MNT = "/sys/fs/cgroup/unified"
UNIFIED = True
else:
UNIFIED_MNT = "/sys/fs/cgroup/unified"
UNIFIED = False

CONTROLLERS = [
"blkio",
"cpu",
Expand All @@ -25,7 +33,7 @@
]

def get_cgroup_mntpt(t):
if UNIFIED and t is None:
if UNIFIED:
return UNIFIED_MNT
p = '/proc/mounts'
if not os.path.exists(p):
Expand Down

0 comments on commit 91221a4

Please sign in to comment.