Support adding devices by dir

This enables cases where devices exist in a subdirectory of /dev,
particularly where those device names are not portable across machines,
which makes it problematic to specify from a runtime such as cri.

Added this to `ctr` as well so I could test that the code at least
works.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2020-12-15 01:28:34 +00:00
parent a1138182d5
commit 7776e5ef2a
8 changed files with 217 additions and 45 deletions

View File

@@ -264,7 +264,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
opts = append(opts, oci.WithMemoryLimit(limit))
}
for _, dev := range context.StringSlice("device") {
opts = append(opts, oci.WithLinuxDevice(dev, "rwm"))
opts = append(opts, oci.WithDevices(dev, "", "rwm"))
}
}