fc: Add support for noflush cache option

Firecracker supports noflush semantic via Unsafe cache type.
There is no support for direct i/o, remove it from config file

Fixes: #7823

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
This commit is contained in:
Alexandru Matei 2023-09-01 12:49:18 +03:00
parent 2ca781518a
commit d507d189bb
2 changed files with 11 additions and 5 deletions

View File

@ -126,11 +126,6 @@ block_device_driver = "@DEFBLOCKSTORAGEDRIVER_FC@"
# Default false
#block_device_cache_set = true
# Specifies cache-related options for block devices.
# Denotes whether use of O_DIRECT (bypass the host page cache) is enabled.
# Default false
#block_device_cache_direct = true
# Specifies cache-related options for block devices.
# Denotes whether flush requests for the device are ignored.
# Default false

View File

@ -835,6 +835,17 @@ func (fc *firecracker) createDiskPool(ctx context.Context) error {
PathOnHost: &jailedDrive,
}
if fc.config.BlockDeviceCacheSet {
var cacheOption string
if fc.config.BlockDeviceCacheNoflush {
cacheOption = models.DriveCacheTypeUnsafe
} else {
cacheOption = models.DriveCacheTypeWriteback
}
drive.CacheType = &cacheOption
}
fc.fcConfig.Drives = append(fc.fcConfig.Drives, drive)
}