From a47f7b3984667dd5ea45dcc78400c7afc6ad857b Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Thu, 29 Oct 2020 09:23:21 +0000 Subject: [PATCH] annotations: Add missing hypervisor control annotation Add missing annotation definitions for a hypervisor control binary: - `io.katacontainers.config.hypervisor.ctlpath` - `io.katacontainers.config.hypervisor.hypervisorctl_hash` This is a partial cherry-pick. The test changes in asset_test.go have not been included since the tests structure has changed in newer branches. Signed-off-by: James O. D. Hunt (cherry picked from commit 7d9860d53c0376d4594bf46ef9f912499437746f) --- virtcontainers/pkg/annotations/annotations.go | 6 ++++++ virtcontainers/types/asset.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/virtcontainers/pkg/annotations/annotations.go b/virtcontainers/pkg/annotations/annotations.go index 10ce7833e2..33eaaa0c2b 100644 --- a/virtcontainers/pkg/annotations/annotations.go +++ b/virtcontainers/pkg/annotations/annotations.go @@ -41,6 +41,9 @@ const ( // HypervisorPath is a sandbox annotation for passing a per container path pointing at the hypervisor that will run the container VM. HypervisorPath = kataAnnotHypervisorPrefix + "path" + // HypervisorCtlPath is a sandbox annotation for passing a per container path pointing at the hypervisor control binary that will run the container VM. + HypervisorCtlPath = kataAnnotHypervisorPrefix + "ctlpath" + // JailerPath is a sandbox annotation for passing a per container path pointing at the jailer that will constrain the container VM. JailerPath = kataAnnotHypervisorPrefix + "jailer_path" @@ -59,6 +62,9 @@ const ( // HypervisorHash is an sandbox annotation for passing a container hypervisor binary SHA-512 hash value. HypervisorHash = kataAnnotHypervisorPrefix + "hypervisor_hash" + // HypervisorCtlHash is a sandbox annotation for passing a container hypervisor control binary SHA-512 hash value. + HypervisorCtlHash = kataAnnotHypervisorPrefix + "hypervisorctl_hash" + // JailerHash is an sandbox annotation for passing a jailer binary SHA-512 hash value. JailerHash = kataAnnotHypervisorPrefix + "jailer_hash" diff --git a/virtcontainers/types/asset.go b/virtcontainers/types/asset.go index cac7d4b0d3..6f6241e3f0 100644 --- a/virtcontainers/types/asset.go +++ b/virtcontainers/types/asset.go @@ -29,6 +29,8 @@ func (t AssetType) Annotations() (string, string, error) { return annotations.InitrdPath, annotations.InitrdHash, nil case HypervisorAsset: return annotations.HypervisorPath, annotations.HypervisorHash, nil + case HypervisorCtlAsset: + return annotations.HypervisorCtlPath, annotations.HypervisorCtlHash, nil case JailerAsset: return annotations.JailerPath, annotations.JailerHash, nil case FirmwareAsset: @@ -93,6 +95,8 @@ func (a *Asset) Valid() bool { return true case HypervisorAsset: return true + case HypervisorCtlAsset: + return true case JailerAsset: return true case FirmwareAsset: