mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
cli: Leverage the new support for ppc64le
Fixes #302 Signed-off-by: Nitesh Konkar niteshkonkar@in.ibm.com
This commit is contained in:
parent
baa553da07
commit
12e4dbe4ca
9
Makefile
9
Makefile
@ -61,6 +61,12 @@ ifeq (,$(installing))
|
|||||||
EXTRA_DEPS = clean
|
EXTRA_DEPS = clean
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq (uncompressed,$(KERNELTYPE))
|
||||||
|
KERNEL_NAME = vmlinux.container
|
||||||
|
else
|
||||||
|
KERNEL_NAME = vmlinuz.container
|
||||||
|
endif
|
||||||
|
|
||||||
LIBEXECDIR := $(PREFIX)/libexec
|
LIBEXECDIR := $(PREFIX)/libexec
|
||||||
SHAREDIR := $(PREFIX)/share
|
SHAREDIR := $(PREFIX)/share
|
||||||
DEFAULTSDIR := $(SHAREDIR)/defaults
|
DEFAULTSDIR := $(SHAREDIR)/defaults
|
||||||
@ -77,7 +83,7 @@ PKGLIBDIR := $(LOCALSTATEDIR)/lib/$(PROJECT_DIR)
|
|||||||
PKGRUNDIR := $(LOCALSTATEDIR)/run/$(PROJECT_DIR)
|
PKGRUNDIR := $(LOCALSTATEDIR)/run/$(PROJECT_DIR)
|
||||||
PKGLIBEXECDIR := $(LIBEXECDIR)/$(PROJECT_DIR)
|
PKGLIBEXECDIR := $(LIBEXECDIR)/$(PROJECT_DIR)
|
||||||
|
|
||||||
KERNELPATH := $(PKGDATADIR)/vmlinuz.container
|
KERNELPATH := $(PKGDATADIR)/$(KERNEL_NAME)
|
||||||
INITRDPATH := $(PKGDATADIR)/$(INITRDNAME)
|
INITRDPATH := $(PKGDATADIR)/$(INITRDNAME)
|
||||||
IMAGEPATH := $(PKGDATADIR)/$(IMAGENAME)
|
IMAGEPATH := $(PKGDATADIR)/$(IMAGENAME)
|
||||||
FIRMWAREPATH :=
|
FIRMWAREPATH :=
|
||||||
@ -150,6 +156,7 @@ USER_VARS += INITRDNAME
|
|||||||
USER_VARS += INITRDPATH
|
USER_VARS += INITRDPATH
|
||||||
USER_VARS += MACHINETYPE
|
USER_VARS += MACHINETYPE
|
||||||
USER_VARS += KERNELPATH
|
USER_VARS += KERNELPATH
|
||||||
|
USER_VARS += KERNELTYPE
|
||||||
USER_VARS += FIRMWAREPATH
|
USER_VARS += FIRMWAREPATH
|
||||||
USER_VARS += MACHINEACCELERATORS
|
USER_VARS += MACHINEACCELERATORS
|
||||||
USER_VARS += KERNELPARAMS
|
USER_VARS += KERNELPARAMS
|
||||||
|
12
arch/ppc64le-options.mk
Normal file
12
arch/ppc64le-options.mk
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (c) 2018 IBM
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
# Power ppc64le settings
|
||||||
|
|
||||||
|
MACHINETYPE := pseries
|
||||||
|
KERNELPARAMS :=
|
||||||
|
MACHINEACCELERATORS :=
|
||||||
|
KERNELTYPE := uncompressed #This architecture must use an uncompressed kernel.
|
||||||
|
QEMUCMD := qemu-system-ppc64le
|
65
cli/kata-check_ppc64le.go
Normal file
65
cli/kata-check_ppc64le.go
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// Copyright (c) 2018 IBM
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// archRequiredCPUFlags maps a CPU flag value to search for and a
|
||||||
|
// human-readable description of that value.
|
||||||
|
var archRequiredCPUFlags = map[string]string{}
|
||||||
|
|
||||||
|
// archRequiredCPUAttribs maps a CPU (non-CPU flag) attribute value to search for
|
||||||
|
// and a human-readable description of that value.
|
||||||
|
var archRequiredCPUAttribs = map[string]string{}
|
||||||
|
|
||||||
|
// archRequiredKernelModules maps a required module name to a human-readable
|
||||||
|
// description of the modules functionality and an optional list of
|
||||||
|
// required module parameters.
|
||||||
|
var archRequiredKernelModules = map[string]kernelModule{
|
||||||
|
"kvm": {
|
||||||
|
desc: "Kernel-based Virtual Machine",
|
||||||
|
},
|
||||||
|
"kvm_hv": {
|
||||||
|
desc: "Kernel-based Virtual Machine hardware virtualization",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func archHostCanCreateVMContainer() error {
|
||||||
|
return kvmIsUsable()
|
||||||
|
}
|
||||||
|
|
||||||
|
// hostIsVMContainerCapable checks to see if the host is theoretically capable
|
||||||
|
// of creating a VM container.
|
||||||
|
func hostIsVMContainerCapable(details vmContainerCapableDetails) error {
|
||||||
|
_, err := getCPUInfo(details.cpuInfoFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
count, err := checkKernelModules(details.requiredKernelModules, archKernelParamHandler)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if count == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Errorf("ERROR: %s", failMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// kvmIsUsable determines if it will be possible to create a full virtual machine
|
||||||
|
// by creating a minimal VM and then deleting it.
|
||||||
|
func kvmIsUsable() error {
|
||||||
|
return genericKvmIsUsable()
|
||||||
|
}
|
||||||
|
|
||||||
|
func archKernelParamHandler(onVMM bool, fields logrus.Fields, msg string) bool {
|
||||||
|
return genericArchKernelParamHandler(onVMM, fields, msg)
|
||||||
|
}
|
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
runtim "runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Semantic version for the output of the command.
|
// Semantic version for the output of the command.
|
||||||
@ -173,6 +174,9 @@ func getHostInfo() (HostInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hostVMContainerCapable := true
|
hostVMContainerCapable := true
|
||||||
|
if runtim.GOARCH == "ppc64le" {
|
||||||
|
hostVMContainerCapable = false
|
||||||
|
}
|
||||||
|
|
||||||
details := vmContainerCapableDetails{
|
details := vmContainerCapableDetails{
|
||||||
cpuInfoFile: procCPUInfo,
|
cpuInfoFile: procCPUInfo,
|
||||||
|
Loading…
Reference in New Issue
Block a user