Merge pull request #7141 from bpradipt/fix-7140

runtime: Add support for key annotations to remote hyp
This commit is contained in:
GabyCT 2023-06-23 16:47:20 -06:00 committed by GitHub
commit 4b8229c252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -1147,6 +1147,7 @@ func newRemoteHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
// No valid value so avoid to append block device to list in kata_agent.appendDevices // No valid value so avoid to append block device to list in kata_agent.appendDevices
BlockDeviceDriver: "dummy", BlockDeviceDriver: "dummy",
EnableAnnotations: h.EnableAnnotations,
}, nil }, nil
} }

View File

@ -8,12 +8,14 @@ import (
"fmt" "fmt"
"net" "net"
"os" "os"
"strconv"
"time" "time"
cri "github.com/containerd/containerd/pkg/cri/annotations" cri "github.com/containerd/containerd/pkg/cri/annotations"
"github.com/containerd/ttrpc" "github.com/containerd/ttrpc"
persistapi "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors" persistapi "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors"
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/hypervisor" pb "github.com/kata-containers/kata-containers/src/runtime/protocols/hypervisor"
hypannotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -74,6 +76,9 @@ func (rh *remoteHypervisor) CreateVM(ctx context.Context, id string, network Net
annotations := map[string]string{} annotations := map[string]string{}
annotations[cri.SandboxName] = hypervisorConfig.SandboxName annotations[cri.SandboxName] = hypervisorConfig.SandboxName
annotations[cri.SandboxNamespace] = hypervisorConfig.SandboxNamespace annotations[cri.SandboxNamespace] = hypervisorConfig.SandboxNamespace
annotations[hypannotations.MachineType] = hypervisorConfig.HypervisorMachineType
annotations[hypannotations.DefaultVCPUs] = strconv.FormatUint(uint64(hypervisorConfig.NumVCPUs), 10)
annotations[hypannotations.DefaultMemory] = strconv.FormatUint(uint64(hypervisorConfig.MemorySize), 10)
req := &pb.CreateVMRequest{ req := &pb.CreateVMRequest{
Id: id, Id: id,