Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cli/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/urfave/cli"

vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/hypervisor"
)

func TestFactoryCLIFunctionNoRuntimeConfig(t *testing.T) {
Expand Down Expand Up @@ -64,7 +65,7 @@ func TestFactoryCLIFunctionInit(t *testing.T) {

// With template
runtimeConfig.FactoryConfig.Template = true
runtimeConfig.HypervisorType = vc.MockHypervisor
runtimeConfig.HypervisorType = hypervisor.Mock
runtimeConfig.AgentType = vc.NoopAgentType
ctx.App.Metadata["runtimeConfig"] = runtimeConfig
fn, ok = initFactoryCommand.Action.(func(context *cli.Context) error)
Expand Down Expand Up @@ -99,7 +100,7 @@ func TestFactoryCLIFunctionDestroy(t *testing.T) {

// With template
runtimeConfig.FactoryConfig.Template = true
runtimeConfig.HypervisorType = vc.MockHypervisor
runtimeConfig.HypervisorType = hypervisor.Mock
runtimeConfig.AgentType = vc.NoopAgentType
ctx.App.Metadata["runtimeConfig"] = runtimeConfig
fn, ok = destroyFactoryCommand.Action.(func(context *cli.Context) error)
Expand Down Expand Up @@ -135,7 +136,7 @@ func TestFactoryCLIFunctionStatus(t *testing.T) {

// With template
runtimeConfig.FactoryConfig.Template = true
runtimeConfig.HypervisorType = vc.MockHypervisor
runtimeConfig.HypervisorType = hypervisor.Mock
runtimeConfig.AgentType = vc.NoopAgentType
ctx.App.Metadata["runtimeConfig"] = runtimeConfig
err = fn(ctx)
Expand Down
4 changes: 2 additions & 2 deletions cli/kata-check.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"syscall"

"github.com/kata-containers/runtime/pkg/katautils"
vc "github.com/kata-containers/runtime/virtcontainers"
vcHypervisor "github.com/kata-containers/runtime/virtcontainers/hypervisor"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
Expand Down Expand Up @@ -186,7 +186,7 @@ type kernelParamHandler func(onVMM bool, fields logrus.Fields, msg string) bool
// the number of module errors (all of which are logged by this
// function). Only fatal errors result in an error return.
func checkKernelModules(modules map[string]kernelModule, handler kernelParamHandler) (count uint32, err error) {
onVMM, err := vc.RunningOnVMM(procCPUInfo)
onVMM, err := vcHypervisor.RunningOnVMM(procCPUInfo)
if err != nil {
return 0, err
}
Expand Down
4 changes: 2 additions & 2 deletions cli/kata-check_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"io/ioutil"
"strings"

vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/hypervisor"
)

const (
Expand Down Expand Up @@ -55,7 +55,7 @@ func setCPUtype() error {
return fmt.Errorf("Unknow CPU Type")
} else if cpuType == cpuTypeIntel {
var kvmIntelParams map[string]string
onVMM, err := vc.RunningOnVMM(procCPUInfo)
onVMM, err := hypervisor.RunningOnVMM(procCPUInfo)
if err != nil && !onVMM {
kvmIntelParams = map[string]string{
// "VMX Unrestricted mode support". This is used
Expand Down
3 changes: 2 additions & 1 deletion cli/kata-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/BurntSushi/toml"
"github.com/kata-containers/runtime/pkg/katautils"
vc "github.com/kata-containers/runtime/virtcontainers"
vcHypervisor "github.com/kata-containers/runtime/virtcontainers/hypervisor"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
vcUtils "github.com/kata-containers/runtime/virtcontainers/utils"
specs "github.com/opencontainers/runtime-spec/specs-go"
Expand Down Expand Up @@ -368,7 +369,7 @@ func getEnvInfo(configFile string, config oci.RuntimeConfig) (env EnvInfo, err e

kernel := KernelInfo{
Path: config.HypervisorConfig.KernelPath,
Parameters: strings.Join(vc.SerializeParams(config.HypervisorConfig.KernelParams, "="), " "),
Parameters: strings.Join(vcHypervisor.SerializeParams(config.HypervisorConfig.KernelParams, "="), " "),
}

initrd := InitrdInfo{
Expand Down
3 changes: 2 additions & 1 deletion cli/kata-env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/BurntSushi/toml"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/hypervisor"
vcUtils "github.com/kata-containers/runtime/virtcontainers/utils"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/urfave/cli"
Expand Down Expand Up @@ -344,7 +345,7 @@ func getExpectedImage(config oci.RuntimeConfig) ImageInfo {
func getExpectedKernel(config oci.RuntimeConfig) KernelInfo {
return KernelInfo{
Path: config.HypervisorConfig.KernelPath,
Parameters: strings.Join(vc.SerializeParams(config.HypervisorConfig.KernelParams, "="), " "),
Parameters: strings.Join(hypervisor.SerializeParams(config.HypervisorConfig.KernelParams, "="), " "),
}
}

Expand Down
4 changes: 2 additions & 2 deletions cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/urfave/cli"

"github.com/kata-containers/runtime/pkg/katautils"
vc "github.com/kata-containers/runtime/virtcontainers"
vcHypervisor "github.com/kata-containers/runtime/virtcontainers/hypervisor"
oci "github.com/kata-containers/runtime/virtcontainers/pkg/oci"
)

Expand Down Expand Up @@ -360,7 +360,7 @@ func getContainers(ctx context.Context, context *cli.Context) ([]fullContainerSt

// getHypervisorDetails returns details of the latest version of the
// hypervisor and the associated assets.
func getHypervisorDetails(hypervisorConfig *vc.HypervisorConfig) hypervisorDetails {
func getHypervisorDetails(hypervisorConfig *vcHypervisor.Config) hypervisorDetails {
hypervisorPath, err := hypervisorConfig.HypervisorAssetPath()
if err != nil {
hypervisorPath = hypervisorConfig.HypervisorPath
Expand Down
9 changes: 5 additions & 4 deletions cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/dlespiau/covertool/pkg/cover"
"github.com/kata-containers/runtime/pkg/katautils"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/hypervisor"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/kata-containers/runtime/virtcontainers/types"
Expand Down Expand Up @@ -206,7 +207,7 @@ func grep(pattern, file string) error {
//
// Note: no parameter validation in case caller wishes to create an invalid
// object.
func newTestHypervisorConfig(dir string, create bool) (vc.HypervisorConfig, error) {
func newTestHypervisorConfig(dir string, create bool) (hypervisor.Config, error) {
kernelPath := path.Join(dir, "kernel")
imagePath := path.Join(dir, "image")
hypervisorPath := path.Join(dir, "hypervisor")
Expand All @@ -215,12 +216,12 @@ func newTestHypervisorConfig(dir string, create bool) (vc.HypervisorConfig, erro
for _, file := range []string{kernelPath, imagePath, hypervisorPath} {
err := createEmptyFile(file)
if err != nil {
return vc.HypervisorConfig{}, err
return hypervisor.Config{}, err
}
}
}

return vc.HypervisorConfig{
return hypervisor.Config{
KernelPath: kernelPath,
ImagePath: imagePath,
HypervisorPath: hypervisorPath,
Expand All @@ -240,7 +241,7 @@ func newTestRuntimeConfig(dir, consolePath string, create bool) (oci.RuntimeConf
}

return oci.RuntimeConfig{
HypervisorType: vc.QemuHypervisor,
HypervisorType: hypervisor.Qemu,
HypervisorConfig: hypervisorConfig,
AgentType: vc.KataContainersAgent,
ProxyType: vc.CCProxyType,
Expand Down
9 changes: 5 additions & 4 deletions containerd-shim-v2/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/kata-containers/runtime/pkg/katautils"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/hypervisor"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
)
Expand Down Expand Up @@ -160,7 +161,7 @@ func createEmptyFile(path string) (err error) {
//
// Note: no parameter validation in case caller wishes to create an invalid
// object.
func newTestHypervisorConfig(dir string, create bool) (vc.HypervisorConfig, error) {
func newTestHypervisorConfig(dir string, create bool) (hypervisor.Config, error) {
kernelPath := path.Join(dir, "kernel")
imagePath := path.Join(dir, "image")
hypervisorPath := path.Join(dir, "hypervisor")
Expand All @@ -169,12 +170,12 @@ func newTestHypervisorConfig(dir string, create bool) (vc.HypervisorConfig, erro
for _, file := range []string{kernelPath, imagePath, hypervisorPath} {
err := createEmptyFile(file)
if err != nil {
return vc.HypervisorConfig{}, err
return hypervisor.Config{}, err
}
}
}

return vc.HypervisorConfig{
return hypervisor.Config{
KernelPath: kernelPath,
ImagePath: imagePath,
HypervisorPath: hypervisorPath,
Expand All @@ -194,7 +195,7 @@ func newTestRuntimeConfig(dir, consolePath string, create bool) (oci.RuntimeConf
}

return oci.RuntimeConfig{
HypervisorType: vc.QemuHypervisor,
HypervisorType: hypervisor.Qemu,
HypervisorConfig: hypervisorConfig,
AgentType: vc.KataContainersAgent,
ProxyType: vc.KataBuiltInProxyType,
Expand Down
Loading