Skip to content

Commit

Permalink
Merge commit from fork
Browse files Browse the repository at this point in the history
Add no-cntlibs CLI option to nvidia-container-cli
  • Loading branch information
elezar authored Jan 23, 2025
2 parents 16f37fc + 7e3642d commit f23e5e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/cli/configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/cli/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/nvc_container.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "xfuncs.h"

static char *find_namespace_path(struct error *, const struct nvc_container *, const char *);
static int find_library_paths(struct error *, struct nvc_container *);
static int find_compat_library_paths(struct error *, struct nvc_container *);
static int lookup_owner(struct error *, struct nvc_container *);
static int copy_config(struct error *, struct nvc_container *, const struct nvc_container_config *);

Expand Down Expand Up @@ -58,7 +58,7 @@ find_namespace_path(struct error *err, const struct nvc_container *cnt, const ch
}

static int
find_library_paths(struct error *err, struct nvc_container *cnt)
find_compat_library_paths(struct error *err, struct nvc_container *cnt)
{
char path[PATH_MAX];
glob_t gl;
Expand Down Expand Up @@ -247,7 +247,7 @@ nvc_container_new(struct nvc_context *ctx, const struct nvc_container_config *cf
if (lookup_owner(&ctx->err, cnt) < 0)
goto fail;
if (!(flags & OPT_NO_CNTLIBS)) {
if (find_library_paths(&ctx->err, cnt) < 0)
if (find_compat_library_paths(&ctx->err, cnt) < 0)
goto fail;
}
if ((cnt->mnt_ns = find_namespace_path(&ctx->err, cnt, "mnt")) == NULL)
Expand Down

0 comments on commit f23e5e5

Please # to comment.