mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
config: Add block aio as a supported annotation
Allow Block AIO to be passed as a per pod annotation. Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
ed0f1d0b32
commit
e1b49d7586
@ -683,6 +683,22 @@ func addHypervisorBlockOverrides(ocispec specs.Spec, sbConfig *vc.SandboxConfig)
|
||||
}
|
||||
}
|
||||
|
||||
if value, ok := ocispec.Annotations[vcAnnotations.BlockDeviceAIO]; ok {
|
||||
supportedAIO := []string{config.AIONative, config.AIOThreads, config.AIOIOUring}
|
||||
|
||||
valid := false
|
||||
for _, b := range supportedAIO {
|
||||
if b == value {
|
||||
sbConfig.HypervisorConfig.BlockDeviceAIO = value
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
|
||||
if !valid {
|
||||
return fmt.Errorf("Invalid AIO mechanism %v specified in annotation (supported IO mechanism : %v)", value, supportedAIO)
|
||||
}
|
||||
}
|
||||
|
||||
if err := newAnnotationConfiguration(ocispec, vcAnnotations.DisableBlockDeviceUse).setBool(func(disableBlockDeviceUse bool) {
|
||||
sbConfig.HypervisorConfig.DisableBlockDeviceUse = disableBlockDeviceUse
|
||||
}); err != nil {
|
||||
|
@ -642,6 +642,7 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
||||
ocispec.Annotations[vcAnnotations.HugePages] = "true"
|
||||
ocispec.Annotations[vcAnnotations.IOMMU] = "true"
|
||||
ocispec.Annotations[vcAnnotations.BlockDeviceDriver] = "virtio-scsi"
|
||||
ocispec.Annotations[vcAnnotations.BlockDeviceAIO] = "io_uring"
|
||||
ocispec.Annotations[vcAnnotations.DisableBlockDeviceUse] = "true"
|
||||
ocispec.Annotations[vcAnnotations.EnableIOThreads] = "true"
|
||||
ocispec.Annotations[vcAnnotations.BlockDeviceCacheSet] = "true"
|
||||
@ -679,6 +680,7 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
||||
assert.Equal(config.HypervisorConfig.HugePages, true)
|
||||
assert.Equal(config.HypervisorConfig.IOMMU, true)
|
||||
assert.Equal(config.HypervisorConfig.BlockDeviceDriver, "virtio-scsi")
|
||||
assert.Equal(config.HypervisorConfig.BlockDeviceAIO, "io_uring")
|
||||
assert.Equal(config.HypervisorConfig.DisableBlockDeviceUse, true)
|
||||
assert.Equal(config.HypervisorConfig.EnableIOThreads, true)
|
||||
assert.Equal(config.HypervisorConfig.BlockDeviceCacheSet, true)
|
||||
|
@ -203,6 +203,9 @@ const (
|
||||
// BlockDeviceDriver specifies the driver to be used for block device either VirtioSCSI or VirtioBlock
|
||||
BlockDeviceDriver = kataAnnotHypervisorPrefix + "block_device_driver"
|
||||
|
||||
// BlockDeviceAIO specifies I/O mechanism to be used with VirtioBlock for qemu
|
||||
BlockDeviceAIO = kataAnnotHypervisorPrefix + "block_device_aio"
|
||||
|
||||
// DisableBlockDeviceUse is a sandbox annotation that disallows a block device from being used.
|
||||
DisableBlockDeviceUse = kataAnnotHypervisorPrefix + "disable_block_device_use"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user