-
Notifications
You must be signed in to change notification settings - Fork 530
Fix nvidia-cdi-refresh systemd packaging #1827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
elezar
wants to merge
1
commit into
NVIDIA:main
Choose a base branch
from
elezar:fix-cdi-refresh-systemd-packaging
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| enable nvidia-cdi-refresh.path | ||
| enable nvidia-cdi-refresh.service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| nvidia-container-runtime /usr/bin | ||
| nvidia-ctk /usr/bin | ||
| nvidia-cdi-hook /usr/bin | ||
| nvidia-cdi-refresh.service /etc/systemd/system/ | ||
| nvidia-cdi-refresh.path /etc/systemd/system/ | ||
| nvidia-cdi-refresh.service /lib/systemd/system/ | ||
| nvidia-cdi-refresh.path /lib/systemd/system/ | ||
| nvidia-cdi-refresh.env /etc/nvidia-container-toolkit/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| rm_conffile /etc/systemd/system/nvidia-cdi-refresh.service @VERSION@~ nvidia-container-toolkit-base | ||
| rm_conffile /etc/systemd/system/nvidia-cdi-refresh.path @VERSION@~ nvidia-container-toolkit-base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,13 @@ Source6: nvidia-cdi-hook | |
| Source7: nvidia-cdi-refresh.service | ||
| Source8: nvidia-cdi-refresh.path | ||
| Source9: nvidia-cdi-refresh.env | ||
| Source10: 90-nvidia-container-toolkit.preset | ||
|
|
||
| %if 0%{?rhel} == 7 || 0%{?amzn} == 2 | ||
| BuildRequires: systemd | ||
| %else | ||
| BuildRequires: systemd-rpm-macros | ||
| %endif | ||
|
|
||
| Obsoletes: nvidia-container-runtime <= 3.5.0-1, nvidia-container-runtime-hook <= 1.4.0-2 | ||
| Provides: nvidia-container-runtime | ||
|
|
@@ -31,11 +38,12 @@ Requires: nvidia-container-toolkit-base == %{version}-%{release} | |
| Provides tools and utilities to enable GPU support in containers. | ||
|
|
||
| %prep | ||
| cp %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE8} %{SOURCE9} . | ||
| cp %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE8} %{SOURCE9} %{SOURCE10} . | ||
|
|
||
| %install | ||
| mkdir -p %{buildroot}%{_bindir} | ||
| mkdir -p %{buildroot}%{_sysconfdir}/systemd/system/ | ||
| mkdir -p %{buildroot}%{_unitdir} | ||
| mkdir -p %{buildroot}%{_presetdir} | ||
| mkdir -p %{buildroot}%{_sysconfdir}/nvidia-container-toolkit | ||
|
|
||
| install -m 755 -t %{buildroot}%{_bindir} nvidia-container-runtime-hook | ||
|
|
@@ -44,8 +52,9 @@ install -m 755 -t %{buildroot}%{_bindir} nvidia-container-runtime.cdi | |
| install -m 755 -t %{buildroot}%{_bindir} nvidia-container-runtime.legacy | ||
| install -m 755 -t %{buildroot}%{_bindir} nvidia-ctk | ||
| install -m 755 -t %{buildroot}%{_bindir} nvidia-cdi-hook | ||
| install -m 644 -t %{buildroot}%{_sysconfdir}/systemd/system nvidia-cdi-refresh.service | ||
| install -m 644 -t %{buildroot}%{_sysconfdir}/systemd/system nvidia-cdi-refresh.path | ||
| install -m 644 -t %{buildroot}%{_unitdir} nvidia-cdi-refresh.service | ||
| install -m 644 -t %{buildroot}%{_unitdir} nvidia-cdi-refresh.path | ||
| install -m 644 -t %{buildroot}%{_presetdir} 90-nvidia-container-toolkit.preset | ||
| install -m 644 -t %{buildroot}%{_sysconfdir}/nvidia-container-toolkit nvidia-cdi-refresh.env | ||
|
|
||
| %post | ||
|
|
@@ -94,29 +103,29 @@ Provides tools such as the NVIDIA Container Runtime and NVIDIA Container Toolkit | |
| # Generate the default config; If this file already exists no changes are made. | ||
| %{_bindir}/nvidia-ctk --quiet config --config-file=%{_sysconfdir}/nvidia-container-runtime/config.toml --in-place | ||
|
|
||
| # Reload systemd unit cache and enable nvidia-cdi-refresh services on both install and upgrade | ||
| %systemd_post nvidia-cdi-refresh.path nvidia-cdi-refresh.service | ||
|
|
||
| # Trigger CDI refresh on running systemd hosts without making install depend on | ||
| # the current system state. | ||
| if command -v systemctl >/dev/null 2>&1; then | ||
| SYSTEMD_STATE=$(systemctl is-system-running 2>/dev/null || true) | ||
| case "$SYSTEMD_STATE" in | ||
| running|degraded) | ||
| systemctl daemon-reload || echo "Warning: Failed to reload systemd daemon" >&2 | ||
| systemctl enable --now nvidia-cdi-refresh.path || echo "Warning: Failed to enable nvidia-cdi-refresh.path" >&2 | ||
| systemctl enable --now nvidia-cdi-refresh.service || echo "Warning: Failed to enable nvidia-cdi-refresh.service" >&2 | ||
|
|
||
| # Trigger CDI spec regeneration immediately after install/upgrade | ||
| echo "Regenerating NVIDIA CDI specification..." | ||
| systemctl start nvidia-cdi-refresh.service || echo "Warning: Failed to trigger CDI refresh" >&2 | ||
| ;; | ||
| esac | ||
| systemctl start nvidia-cdi-refresh.path >/dev/null 2>&1 || : | ||
| systemctl start nvidia-cdi-refresh.service >/dev/null 2>&1 || : | ||
|
Comment on lines
+111
to
+112
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question -- what's the rationale behind not running |
||
| fi | ||
|
|
||
| %preun base | ||
| %systemd_preun nvidia-cdi-refresh.path nvidia-cdi-refresh.service | ||
|
|
||
| %postun base | ||
| %systemd_postun nvidia-cdi-refresh.path nvidia-cdi-refresh.service | ||
|
|
||
| %files base | ||
| %license LICENSE | ||
| %{_bindir}/nvidia-container-runtime | ||
| %{_bindir}/nvidia-ctk | ||
| %{_bindir}/nvidia-cdi-hook | ||
| %{_sysconfdir}/systemd/system/nvidia-cdi-refresh.service | ||
| %{_sysconfdir}/systemd/system/nvidia-cdi-refresh.path | ||
| %{_unitdir}/nvidia-cdi-refresh.service | ||
| %{_unitdir}/nvidia-cdi-refresh.path | ||
| %{_presetdir}/90-nvidia-container-toolkit.preset | ||
| %config(noreplace) %{_sysconfdir}/nvidia-container-toolkit/nvidia-cdi-refresh.env | ||
|
|
||
| # The OPERATOR EXTENSIONS package consists of components that are required to enable GPU support in Kubernetes. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question -- these are build-time constraints that only apply when building the RPM packages, correct?