Just ask for GPU passthrough

This commit is contained in:
Jip-Hop 2024-01-27 04:23:46 +01:00
parent bf54fea9a1
commit ae23b13301
1 changed files with 7 additions and 21 deletions

View File

@ -330,7 +330,7 @@ def start_jail(jail_name, check_startup_enabled=False):
# - how to call the option to enable ip_forward and bridge-nf-call?
# TODO: always add --bind-ro=/sys/module? Or only for privileged jails?
# https://manpages.debian.org/bookworm/manpages/sysfs.5.en.html
if config.get("docker_compatible") == "1":
# Enable ip forwarding on the host (docker needs it)
print(1, file=open("/proc/sys/net/ipv4/ip_forward", "w"))
@ -720,29 +720,15 @@ def create_jail(jail_name, distro="debian", release="bookworm"):
gpu_passthrough_intel = 0
if os.path.exists("/dev/dri"):
print("Detected the presence of an intel GPU.\n")
if agree("Passthrough the intel GPU?", "n"):
gpu_passthrough_intel = 1
if agree("Passthrough the intel GPU (if present)?", "n"):
gpu_passthrough_intel = 1
print()
gpu_passthrough_nvidia = 0
if (
subprocess.run(
["modprobe", "nvidia-current-uvm"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
).returncode
== 0
):
nvidia_detected = True
else:
nvidia_detected = False
if nvidia_detected:
print("Detected the presence of an nvidia GPU.\n")
if agree("Passthrough the nvidia GPU?", "n"):
gpu_passthrough_nvidia = 1
if agree("Passthrough the nvidia GPU (if present)?", "n"):
gpu_passthrough_nvidia = 1
print(
dedent(