From 7e3642dbbb1b1c79bd7fd1c4b1bf2048bd80fd8d Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 10 Jan 2025 10:18:15 +0100 Subject: [PATCH] Add no-cntlibs CLI option to nvidia-container-cli This change adds a --no-cntlibs option to the configure and info commands of the nvidia-container-cli. This allows the no-cntlibs option to be set via the commandline. If this option is set, the CUDA compat libraries are not mounted into the container but are still available to the user. Signed-off-by: Evan Lezar --- src/cli/configure.c | 5 +++++ src/cli/list.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/cli/configure.c b/src/cli/configure.c index 1f47c169..54e243a4 100644 --- a/src/cli/configure.c +++ b/src/cli/configure.c @@ -36,6 +36,7 @@ const struct argp configure_usage = { {"no-persistenced", 0x86, NULL, 0, "Don't include the NVIDIA persistenced socket", -1}, {"no-fabricmanager", 0x87, NULL, 0, "Don't include the NVIDIA fabricmanager socket", -1}, {"no-gsp-firmware", 0x88, NULL, 0, "Don't include GSP Firmware", -1}, + {"no-cntlibs", 0x89, NULL, 0, "Don't overwrite host mounts with CUDA compat libs from the container", -1}, {0}, }, configure_parser, @@ -165,6 +166,10 @@ configure_parser(int key, char *arg, struct argp_state *state) if (str_join(&err, &ctx->driver_opts, "no-gsp-firmware", " ") < 0) goto fatal; break; + case 0x89: + if (str_join(&err, &ctx->container_flags, "no-cntlibs", " ") < 0) + goto fatal; + break; case ARGP_KEY_ARG: if (state->arg_num > 0) argp_usage(state); diff --git a/src/cli/list.c b/src/cli/list.c index 0f33ab0c..3517af14 100644 --- a/src/cli/list.c +++ b/src/cli/list.c @@ -25,6 +25,7 @@ const struct argp list_usage = { {"no-persistenced", 0x84, NULL, 0, "Don't include the NVIDIA persistenced socket", -1}, {"no-fabricmanager", 0x85, NULL, 0, "Don't include the NVIDIA fabricmanager socket", -1}, {"no-gsp-firmware", 0x86, NULL, 0, "Don't include GSP Firmware", -1}, + {"no-cntlibs", 0x87, NULL, 0, "Don't overwrite host mounts with CUDA compat libs from the container", -1}, {0}, }, list_parser, @@ -86,6 +87,10 @@ list_parser(int key, char *arg, struct argp_state *state) goto fatal; ctx->list_firmwares = false; break; + case 0x87: + if (str_join(&err, &ctx->container_flags, "no-cntlibs", " ") < 0) + goto fatal; + break; case ARGP_KEY_END: if (state->argc == 1 || (state->argc == 2 && ctx->imex_channels != NULL)) { if ((ctx->devices = xstrdup(&err, "all")) == NULL)