Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c4658c3
api: To watch the vm console in FetchSandbox api
lifupan Jun 22, 2018
fdf1312
create: Remove redundant logging code
Jul 4, 2018
371dc14
logging: Add function to handle external loggers
Jul 4, 2018
9774c2a
logging: Reset external loggers when cid+sid available
Jul 4, 2018
61607e7
ci: reconstructure image-type and initrd for architecture-independant
Pennyzct Jul 3, 2018
3dda260
tests: Refactor CC proxy test for Kata
Jul 6, 2018
d10b1d8
virtcontainers: Set ppc64le maxmem depending on qemu version
nitkon Jun 19, 2018
9868cf2
api: To stop its monitor after a sandbox paused
lifupan Jul 6, 2018
e640655
ci: no-exit: Document and echo what the check is
Jul 10, 2018
1b23e15
ci: no-exit: Skip check if no files to check
Jul 10, 2018
b71cae0
ci: no-exit: Allow path override for os.Exit check
Jul 10, 2018
b4595ae
ci: no-exit: Do not run no-exit check on test files
Jul 10, 2018
b21646a
kata-env: Add ability to output as JSON
Jul 6, 2018
89e22e5
kata-env: Fix test cases for kata-env JSON
Jul 10, 2018
ceac6fd
kata-env: Do not leave temp files on test
Jul 11, 2018
8a1469b
kata-env: tests: add JSON out/in verify test
Jul 11, 2018
8c5be51
makefile: update PREFIX to remove redundant slash
Jul 16, 2018
a712155
kata_agent: print request details
bergwolf Jul 17, 2018
b0e5614
cli: update_test: defer remove tmpfile
Jul 13, 2018
9fac082
cli: tests: remove the tmpdir to the config.json
Jul 18, 2018
a3b11df
cli: tests: Clarify who cleans up tmpdir
Jul 18, 2018
b2d9d95
sandbox: change container slice to a map
bergwolf Jul 23, 2018
3438a11
codecov: Explicitly disable codecov/patch coverage
Jul 24, 2018
7ca24d6
cli: add AMD support to kata-check
gkennedy12 Jul 25, 2018
28b299f
kata-agent: Improve error message.
jcvenegas Jul 26, 2018
e4ccf03
agent: check: Increase timeout check request.
jcvenegas Jul 26, 2018
21ae323
codecov: remove codecov.yml
bergwolf Aug 1, 2018
f9446e5
kernel: Remove initcall_debug boot option
Jul 27, 2018
7b5f920
virtcontainers: ppc64le: Add nvdimm to defaultQemuMachineOption
nitkon Aug 9, 2018
a6668af
network: Error out when host-networking is requested
amshinde Jul 23, 2018
4021697
cli: Make message of using initrd OR rootfs clearer
nitkon Aug 10, 2018
a4de4e6
vc: cni: add SPDX license to OWNERS file
Aug 22, 2018
bd5c8fe
virtcontainers: add kata-proxy rollback
flyflypeng Jun 19, 2018
01906ee
virtcontainers: add qemu process rollback
flyflypeng Jun 19, 2018
85b1627
virtcontainers: fix kata-agent fail to start
flyflypeng Jun 19, 2018
3bbcdbc
virtcontainers: add rollback to remove sandbox network
flyflypeng Jun 19, 2018
35a9430
virtconainers: rollback the NetNs when createNetwork failed
lifupan Jul 24, 2018
6374e40
main: Pass runtime CLI command to vc logger
Jun 27, 2018
d3dfdaa
versions: Update CRI-O supported version
chavafg Jul 12, 2018
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
17 changes: 12 additions & 5 deletions .ci/go-no-os-exit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# Check there are no os.Exit() calls creeping into the code
# We don't use that exit path in the Kata codebase.

# Allow the path to check to be over-ridden.
# Default to the current directory.
go_packages=${1:-.}

go_packages=.
echo "Checking for no os.Exit() calls for package [${go_packages}]"

candidates=`go list -f '{{.Dir}}/*.go' $go_packages`
for f in $candidates; do
filename=`basename $f`
# skip all go test files
[[ $filename == *_test.go ]] && continue
# skip exit.go where, the only file we should call os.Exit() from.
[[ $filename == "exit.go" ]] && continue
# skip exit_test.go
[[ $filename == "exit_test.go" ]] && continue
# skip main_test.go
[[ $filename == "main_test.go" ]] && continue
files="$f $files"
done

[ -z "$files" ] && echo "No files to check, skipping" && exit 0

if egrep -n '\<os\.Exit\>' $files; then
echo "Direct calls to os.Exit() are forbidden, please use exit() so atexit() works"
exit 1
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DESTDIR := /
installing = $(findstring install,$(MAKECMDGOALS))

ifeq ($(PREFIX),)
PREFIX := /usr/
PREFIX := /usr
EXEC_PREFIX := $(PREFIX)/local
else
EXEC_PREFIX := $(PREFIX)
Expand Down Expand Up @@ -395,7 +395,8 @@ go-test: $(GENERATED_FILES)

check-go-static:
$(QUIET_CHECK).ci/static-checks.sh
$(QUIET_CHECK).ci/go-no-os-exit.sh
$(QUIET_CHECK).ci/go-no-os-exit.sh ./cli
$(QUIET_CHECK).ci/go-no-os-exit.sh ./virtcontainers

coverage:
$(QUIET_TEST).ci/go-test.sh html-coverage
Expand Down
2 changes: 1 addition & 1 deletion cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {

if image != "" && initrd != "" {
return vc.HypervisorConfig{},
errors.New("cannot specify an image and an initrd in configuration file")
errors.New("having both an image and an initrd defined in the configuration file is not supported")
}

firmware, err := h.firmware()
Expand Down
10 changes: 4 additions & 6 deletions cli/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)

Expand Down Expand Up @@ -90,6 +89,7 @@ func create(containerID, bundlePath, console, pidFilePath string, detach bool,
var err error

kataLog = kataLog.WithField("container", containerID)
setExternalLoggers(kataLog)

// Checks the MUST and MUST NOT from OCI runtime specification
if bundlePath, err = validCreateParams(containerID, bundlePath); err != nil {
Expand Down Expand Up @@ -241,6 +241,7 @@ func createSandbox(ociSpec oci.CompatOCISpec, runtimeConfig oci.RuntimeConfig,
}

kataLog = kataLog.WithField("sandbox", sandbox.ID())
setExternalLoggers(kataLog)

containers := sandbox.GetAllContainers()
if len(containers) != 1 {
Expand Down Expand Up @@ -268,6 +269,7 @@ func createContainer(ociSpec oci.CompatOCISpec, containerID, bundlePath,
}

kataLog = kataLog.WithField("sandbox", sandboxID)
setExternalLoggers(kataLog)

_, c, err := vci.CreateContainer(sandboxID, contConfig)
if err != nil {
Expand All @@ -283,11 +285,7 @@ func createContainer(ociSpec oci.CompatOCISpec, containerID, bundlePath,

func createCgroupsFiles(containerID string, cgroupsDirPath string, cgroupsPathList []string, pid int) error {
if len(cgroupsPathList) == 0 {
fields := logrus.Fields{
"container": containerID,
"pid": pid,
}
kataLog.WithFields(fields).Info("Cgroups files not created because cgroupsPath was empty")
kataLog.WithField("pid", pid).Info("Cgroups files not created because cgroupsPath was empty")
return nil
}

Expand Down
2 changes: 2 additions & 0 deletions cli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func delete(containerID string, force bool) error {
"sandbox": sandboxID,
})

setExternalLoggers(kataLog)

containerID = status.ID

containerType, err := oci.GetContainerType(status.Annotations)
Expand Down
24 changes: 15 additions & 9 deletions cli/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestDeleteInvalidConfig(t *testing.T) {
assert.False(vcmock.IsMockError(err))
}

func testConfigSetup(t *testing.T) string {
func testConfigSetup(t *testing.T) (rootPath string, configPath string) {
assert := assert.New(t)

tmpdir, err := ioutil.TempDir("", "")
Expand All @@ -135,8 +135,8 @@ func testConfigSetup(t *testing.T) string {
assert.NoError(err)

// config json path
configPath := filepath.Join(bundlePath, "config.json")
return configPath
configPath = filepath.Join(bundlePath, "config.json")
return tmpdir, configPath
}

func TestDeleteSandbox(t *testing.T) {
Expand All @@ -146,7 +146,8 @@ func TestDeleteSandbox(t *testing.T) {
MockID: testSandboxID,
}

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -223,7 +224,8 @@ func TestDeleteInvalidContainerType(t *testing.T) {
MockID: testSandboxID,
}

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -261,7 +263,8 @@ func TestDeleteSandboxRunning(t *testing.T) {
MockID: testSandboxID,
}

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -340,7 +343,8 @@ func TestDeleteRunningContainer(t *testing.T) {
},
}

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -422,7 +426,8 @@ func TestDeleteContainer(t *testing.T) {
},
}

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -523,7 +528,8 @@ func TestDeleteCLIFunctionSuccess(t *testing.T) {
},
}

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down
2 changes: 2 additions & 0 deletions cli/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ information is displayed once every 5 seconds.`,
"sandbox": sandboxID,
})

setExternalLoggers(kataLog)

if status.State.State == vc.StateStopped {
return fmt.Errorf("container with id %s is not running", status.ID)
}
Expand Down
2 changes: 2 additions & 0 deletions cli/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ func execute(context *cli.Context) error {
"sandbox": sandboxID,
})

setExternalLoggers(kataLog)

// Retrieve OCI spec configuration.
ociSpec, err := oci.GetOCIConfig(status)
if err != nil {
Expand Down
24 changes: 16 additions & 8 deletions cli/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func TestExecuteErrors(t *testing.T) {
assert.False(vcmock.IsMockError(err))

// Container state undefined
configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -147,7 +148,8 @@ func TestExecuteErrorReadingProcessJson(t *testing.T) {
flagSet.Parse([]string{testContainerID})
ctx := cli.NewContext(cli.NewApp(), flagSet, nil)

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -195,7 +197,8 @@ func TestExecuteErrorOpeningConsole(t *testing.T) {
flagSet.Parse([]string{testContainerID})
ctx := cli.NewContext(cli.NewApp(), flagSet, nil)

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -261,7 +264,8 @@ func TestExecuteWithFlags(t *testing.T) {
flagSet.Parse([]string{testContainerID, "/tmp/foo"})
ctx := cli.NewContext(cli.NewApp(), flagSet, nil)

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -349,7 +353,8 @@ func TestExecuteWithFlagsDetached(t *testing.T) {
flagSet.Parse([]string{testContainerID, "/tmp/foo"})
ctx := cli.NewContext(cli.NewApp(), flagSet, nil)

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -427,7 +432,8 @@ func TestExecuteWithInvalidProcessJson(t *testing.T) {
flagSet.Parse([]string{testContainerID})
ctx := cli.NewContext(cli.NewApp(), flagSet, nil)

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -478,7 +484,8 @@ func TestExecuteWithValidProcessJson(t *testing.T) {
flagSet.Parse([]string{testContainerID, "/tmp/foo"})
ctx := cli.NewContext(cli.NewApp(), flagSet, nil)

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down Expand Up @@ -578,7 +585,8 @@ func TestExecuteWithEmptyEnvironmentValue(t *testing.T) {
flagSet.Parse([]string{testContainerID})
ctx := cli.NewContext(cli.NewApp(), flagSet, nil)

configPath := testConfigSetup(t)
rootPath, configPath := testConfigSetup(t)
defer os.RemoveAll(rootPath)
configJSON, err := readOCIConfigJSON(configPath)
assert.NoError(err)

Expand Down
2 changes: 2 additions & 0 deletions cli/kata-check.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ var kataCheckCLICommand = cli.Command{
Usage: "tests if system can run " + project,
Action: func(context *cli.Context) error {

setCPUtype()

details := vmContainerCapableDetails{
cpuInfoFile: procCPUInfo,
requiredCPUFlags: archRequiredCPUFlags,
Expand Down
Loading