Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions deployments/systemd/hooks-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ hooks:
- workdir: "/etc/nvidia-mig-manager"
command: "/bin/bash"
args: ["-x", "-c", "source hooks.sh; apply-exit"]
- workdir: "/etc/nvidia-mig-manager"
command: "/bin/bash"
args: ["-x", "-c", "source hooks.sh; refresh-cdi"]
12 changes: 12 additions & 0 deletions deployments/systemd/hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,15 @@ function stop_k8s_pods() {
fi
return 0
}

# refresh-cdi triggers the nvidia-cdi-refresh service to regenerate CDI
# specifications, making updated GPU devices available to container runtimes.
function refresh-cdi() {
# Check if nvidia-cdi-refresh.service exists
if systemctl list-unit-files nvidia-cdi-refresh.service --quiet; then
echo "Found nvidia-cdi-refresh.service, calling systemctl..." >&2
if ! systemctl restart nvidia-cdi-refresh.service; then
echo "Error: Failed to start nvidia-cdi-refresh.service" >&2
fi
fi
}