Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 7542405

Browse files
c3dfidencio
authored andcommitted
config: Add hypervisor path override through annotations
The annotation is provided, so it should be respected. Furthermore, it is important to implement it with the appropriate protetions similar to what was done for virtiofsd. Fixes: #3004 Signed-off-by: Christophe de Dinechin <[email protected]>
1 parent 0330aa0 commit 7542405

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

virtcontainers/pkg/oci/utils.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ func addHypervisorConfigOverrides(ocispec specs.Spec, config *vc.SandboxConfig,
402402
return err
403403
}
404404

405+
if value, ok := ocispec.Annotations[vcAnnotations.HypervisorPath]; ok {
406+
if !regexpContains(runtime.HypervisorConfig.HypervisorPathList, value) {
407+
return fmt.Errorf("hypervisor %v required from annotation is not valid", value)
408+
}
409+
config.HypervisorConfig.HypervisorPath = value
410+
}
411+
405412
if value, ok := ocispec.Annotations[vcAnnotations.KernelParams]; ok {
406413
if value != "" {
407414
params := vc.DeserializeParams(strings.Fields(value))

0 commit comments

Comments
 (0)