runtime: bind-mount mounted block device into container

When the mounted block device isn't a layer, we want to mount it into
containers, but since it's already mounted with the correct fs (e.g.,
tar, ext4, etc.) in the pod, we just bind-mount it into the container.

Fixes: #7536

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
This commit is contained in:
Wedson Almeida Filho 2023-06-16 00:44:34 -03:00
parent 7e1b1949d4
commit 4fbe0a3a53

View File

@ -1662,6 +1662,10 @@ func (k *kataAgent) handleBlkOCIMounts(c *Container, spec *specs.Spec) ([]*grpc.
"new-source": path,
}).Debug("Replacing OCI mount source")
spec.Mounts[idx].Source = path
if HasOption(spec.Mounts[idx].Options, vcAnnotations.IsFileBlockDevice) {
// The device is already mounted, just bind to path in container.
spec.Mounts[idx].Options = []string{"bind"}
}
break
}