mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-14 14:14:15 +00:00
annotations: add disable_image_nvdimm
So that users can use annotations to set it. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
parent
652bb76dde
commit
7c7a4a3b11
@ -90,6 +90,9 @@ const (
|
|||||||
// UseVSock is a sandbox annotation to specify use of vsock for agent communication.
|
// UseVSock is a sandbox annotation to specify use of vsock for agent communication.
|
||||||
UseVSock = kataAnnotHypervisorPrefix + "use_vsock"
|
UseVSock = kataAnnotHypervisorPrefix + "use_vsock"
|
||||||
|
|
||||||
|
// DisableImageNvdimm is a sandbox annotation to specify use of nvdimm device for guest rootfs image.
|
||||||
|
DisableImageNvdimm = kataAnnotHypervisorPrefix + "disable_image_nvdimm"
|
||||||
|
|
||||||
// HotplugVFIOOnRootBus is a sandbox annotation used to indicate if devices need to be hotplugged on the
|
// HotplugVFIOOnRootBus is a sandbox annotation used to indicate if devices need to be hotplugged on the
|
||||||
// root bus instead of a bridge.
|
// root bus instead of a bridge.
|
||||||
HotplugVFIOOnRootBus = kataAnnotHypervisorPrefix + "hotplug_vfio_on_root_bus"
|
HotplugVFIOOnRootBus = kataAnnotHypervisorPrefix + "hotplug_vfio_on_root_bus"
|
||||||
|
@ -429,6 +429,15 @@ func addHypervisorConfigOverrides(ocispec specs.Spec, config *vc.SandboxConfig)
|
|||||||
config.HypervisorConfig.UseVSock = useVsock
|
config.HypervisorConfig.UseVSock = useVsock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if value, ok := ocispec.Annotations[vcAnnotations.DisableImageNvdimm]; ok {
|
||||||
|
disableNvdimm, err := strconv.ParseBool(value)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error parsing annotation for use_nvdimm: Please specify boolean value 'true|false'")
|
||||||
|
}
|
||||||
|
|
||||||
|
config.HypervisorConfig.DisableImageNvdimm = disableNvdimm
|
||||||
|
}
|
||||||
|
|
||||||
if value, ok := ocispec.Annotations[vcAnnotations.HotplugVFIOOnRootBus]; ok {
|
if value, ok := ocispec.Annotations[vcAnnotations.HotplugVFIOOnRootBus]; ok {
|
||||||
hotplugVFIOOnRootBus, err := strconv.ParseBool(value)
|
hotplugVFIOOnRootBus, err := strconv.ParseBool(value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -745,6 +745,7 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
|||||||
ocispec.Annotations[vcAnnotations.DisableVhostNet] = "true"
|
ocispec.Annotations[vcAnnotations.DisableVhostNet] = "true"
|
||||||
ocispec.Annotations[vcAnnotations.GuestHookPath] = "/usr/bin/"
|
ocispec.Annotations[vcAnnotations.GuestHookPath] = "/usr/bin/"
|
||||||
ocispec.Annotations[vcAnnotations.UseVSock] = "true"
|
ocispec.Annotations[vcAnnotations.UseVSock] = "true"
|
||||||
|
ocispec.Annotations[vcAnnotations.DisableImageNvdimm] = "true"
|
||||||
ocispec.Annotations[vcAnnotations.HotplugVFIOOnRootBus] = "true"
|
ocispec.Annotations[vcAnnotations.HotplugVFIOOnRootBus] = "true"
|
||||||
ocispec.Annotations[vcAnnotations.EntropySource] = "/dev/urandom"
|
ocispec.Annotations[vcAnnotations.EntropySource] = "/dev/urandom"
|
||||||
|
|
||||||
@ -773,6 +774,7 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
|||||||
assert.Equal(config.HypervisorConfig.DisableVhostNet, true)
|
assert.Equal(config.HypervisorConfig.DisableVhostNet, true)
|
||||||
assert.Equal(config.HypervisorConfig.GuestHookPath, "/usr/bin/")
|
assert.Equal(config.HypervisorConfig.GuestHookPath, "/usr/bin/")
|
||||||
assert.Equal(config.HypervisorConfig.UseVSock, true)
|
assert.Equal(config.HypervisorConfig.UseVSock, true)
|
||||||
|
assert.Equal(config.HypervisorConfig.DisableImageNvdimm, true)
|
||||||
assert.Equal(config.HypervisorConfig.HotplugVFIOOnRootBus, true)
|
assert.Equal(config.HypervisorConfig.HotplugVFIOOnRootBus, true)
|
||||||
assert.Equal(config.HypervisorConfig.EntropySource, "/dev/urandom")
|
assert.Equal(config.HypervisorConfig.EntropySource, "/dev/urandom")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user