spec: open fuse with --device .*/fuse

If the container uses the /dev/fuse device, attempt to load the fuse
kernel module first so that nested containers can use it.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1872240

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2020-08-26 12:47:10 +02:00
parent defd427503
commit 4f7da3274b
3 changed files with 15 additions and 0 deletions

View File

@ -248,6 +248,13 @@ func addDevice(g *generate.Generator, device string) error {
}
g.Config.Mounts = append(g.Config.Mounts, devMnt)
return nil
} else if src == "/dev/fuse" {
// if the user is asking for fuse inside the container
// make sure the module is loaded.
f, err := unix.Open(src, unix.O_RDONLY|unix.O_NONBLOCK, 0)
if err == nil {
unix.Close(f)
}
}
dev.Path = dst
g.AddDevice(*dev)