kata_agent: Don't use dax if virtio_fs_cache is 0

If always using dax, even if virtio_fs_cache is 0, the following error
would happen:

```
[root@f32 runtime]# podman run --security-opt label=disable  --runtime=/usr/local/bin/kata-runtime --rm -id fedora sh
Error: rpc error: code = Internal desc = Could not mount kataShared to /run/kata-containers/shared/containers/: invalid argument: OCI runtime error
```

Fixes: #2464

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2020-02-19 11:00:51 +01:00 committed by Archana Shinde
parent 6218b2a558
commit ab8050c5e0

View File

@ -879,7 +879,10 @@ func setupStorages(sandbox *Sandbox) []*grpc.Storage {
// options should not contain 'dax' lest the virtio-fs daemon crashing
// with an invalid address reference.
if sandbox.config.HypervisorConfig.VirtioFSCache != typeVirtioFSNoCache {
sharedDirVirtioFSOptions = append(sharedDirVirtioFSOptions, sharedDirVirtioFSDaxOptions)
// If virtio_fs_cache_size = 0, dax should not be used.
if sandbox.config.HypervisorConfig.VirtioFSCacheSize != 0 {
sharedDirVirtioFSOptions = append(sharedDirVirtioFSOptions, sharedDirVirtioFSDaxOptions)
}
}
sharedVolume := &grpc.Storage{
Driver: kataVirtioFSDevType,