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