You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can we add support for systemd-detect-virt on our systemd lib?
That is important, e.g. when we want to use sysctl lib and some of the options may be applicable, but others cannot.
Proposal:
import subprocess
...
def running_as_vm():
try:
return subprocess.run(["systemd-detect-virt", "--vm"]).returncode == 0
except FileNotFoundError:
# No systemd! Either this is a docker container OR a very old distro
return False
def running_as_lxc():
try:
return subprocess.run(["systemd-detect-virt", "--container"]).returncode == 0
except FileNotFoundError:
# No systemd! Either this is a docker container OR a very old distro
return False
def running_as_container():
try:
return subprocess.run(["systemd-detect-virt", "--container"]).returncode == 0
except FileNotFoundError:
return True
The text was updated successfully, but these errors were encountered:
We kept it systemd agnostic however - e.g. didn't include it in the systemd charm library - as some of our routines/applications won't work if inside an LXD container but aren't managed directly by systemd.
Can we add support for
systemd-detect-virt
on oursystemd
lib?That is important, e.g. when we want to use sysctl lib and some of the options may be applicable, but others cannot.
Proposal:
The text was updated successfully, but these errors were encountered: