aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-10-03 11:35:13 -0700
committerGitHub <noreply@github.com>2018-10-03 11:35:13 -0700
commit3750b35ae2a22e7f7bc0070c5c2dadf1ef437074 (patch)
treec5eee413a0cd57375f464084581704fc6bd22b00
parent2a3e3e7f25d9a7bbe5e6f3f35027ccbe6521961f (diff)
parent14473270d7af520dae006605ab798ad9db34f184 (diff)
downloadpodman-3750b35ae2a22e7f7bc0070c5c2dadf1ef437074.tar.gz
podman-3750b35ae2a22e7f7bc0070c5c2dadf1ef437074.tar.bz2
podman-3750b35ae2a22e7f7bc0070c5c2dadf1ef437074.zip
Merge pull request #1578 from baude/addubuntuci
Add Ubuntu-18.04 to CI testing
-rw-r--r--.travis.yml23
-rw-r--r--.ubuntu_prepare.sh71
-rw-r--r--libpod/container_internal.go7
-rw-r--r--libpod/runtime_pod_linux.go3
-rw-r--r--libpod/stats.go7
-rw-r--r--libpod/util.go25
-rw-r--r--test/e2e/libpod_suite_test.go17
-rw-r--r--test/e2e/run_cgroup_parent_test.go4
-rw-r--r--test/e2e/run_memory_test.go3
9 files changed, 130 insertions, 30 deletions
diff --git a/.travis.yml b/.travis.yml
index 2ede77a93..86744f728 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -28,35 +28,12 @@ jobs:
include:
- stage: Build and Verify
script:
- - make gofmt
- - make lint
- go: 1.10.x
- - script:
- - make gofmt
- - make lint
- go: 1.10.x
- os: osx
- - script:
- - make testunit
- go: 1.9.x
- - stage: Build and Verify
- script:
- make testunit
go: 1.10.x
- - script:
- - make --keep-going local-cross
- go: 1.10.x
- - script:
- - make --keep-going local-cross
- go: 1.10.x
- os: osx
- env: ALLOWED_TO_FAIL=true
- stage: Integration Test
script:
- make integration
go: 1.9.x
- allow_failures:
- - env: ALLOWED_TO_FAIL=true
notifications:
irc: "chat.freenode.net#podman"
diff --git a/.ubuntu_prepare.sh b/.ubuntu_prepare.sh
new file mode 100644
index 000000000..7b7dd1bb1
--- /dev/null
+++ b/.ubuntu_prepare.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+set -xeuo pipefail
+
+export GOPATH=/go
+export PATH=$HOME/gopath/bin:$PATH:$GOPATH/bin
+
+runc=0
+conmon=0
+cni=0
+podman_conf=0
+
+conmon_source=/go/src/github.com/containers/conmon
+cni_source=/go/src/github.com/containernetworking/plugins
+runc_source=/go/src/github.com/opencontainers/runc
+podman_source=/var/tmp/checkout
+
+while getopts "cnrf" opt; do
+ case "$opt" in
+ c) conmon=1
+ ;;
+ f) podman_conf=1
+ ;;
+ n) cni=1
+ ;;
+ r) runc=1
+ ;;
+ *) echo "Nothing to do ... exiting."
+ exit 0
+ ;;
+ esac
+done
+
+if [ $conmon -eq 1 ]; then
+ # Build and install conmon from source
+ echo "Building conmon ..."
+ git clone http://github.com/containers/conmon $conmon_source
+ cd $conmon_source && make install PREFIX=/usr
+fi
+
+
+if [ $cni -eq 1 ]; then
+ # Build and install containernetworking plugins from source
+ echo "Building containernetworking-plugins..."
+ git clone http://github.com/containernetworking/plugins $cni_source
+ cd $cni_source
+ ./build.sh
+ mkdir -p /usr/libexec/cni
+ cp -v bin/* /usr/libexec/cni/
+fi
+
+
+if [ $runc -eq 1 ]; then
+ # Build and install runc
+ echo "Building runc..."
+ git clone http://github.com/opencontainers/runc $runc_source
+ cd $runc_source
+ make install PREFIX=/usr
+fi
+
+if [ $podman_conf -eq 1 ]; then
+ # Install various configuration files required by libpod
+
+ # Install CNI conf file for podman
+ mkdir -p /etc/cni/net.d
+ cp -v $podman_source/cni/87-podman-bridge.conflist /etc/cni/net.d/
+
+ # Install registries.conf
+ mkdir -p /etc/containers
+ cp -v $podman_source/test/registries.conf /etc/containers/
+ cp -v $podman_source/test/policy.json /etc/containers/
+fi
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 71a3c4caf..033426817 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1333,3 +1333,10 @@ func (c *Container) unmount(force bool) error {
return nil
}
+
+// getExcludedCGroups returns a string slice of cgroups we want to exclude
+// because runc or other components are unaware of them.
+func getExcludedCGroups() (excludes []string) {
+ excludes = []string{"rdma"}
+ return
+}
diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go
index 974cd2b68..eb3d471dd 100644
--- a/libpod/runtime_pod_linux.go
+++ b/libpod/runtime_pod_linux.go
@@ -265,7 +265,8 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool)
}
case CgroupfsCgroupsManager:
// Delete the cgroupfs cgroup
- cgroup, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(p.state.CgroupPath))
+ v1CGroups := GetV1CGroups(getExcludedCGroups())
+ cgroup, err := cgroups.Load(v1CGroups, cgroups.StaticPath(p.state.CgroupPath))
if err != nil && err != cgroups.ErrCgroupDeleted {
return err
} else if err == nil {
diff --git a/libpod/stats.go b/libpod/stats.go
index 9d5efd993..c58a46135 100644
--- a/libpod/stats.go
+++ b/libpod/stats.go
@@ -33,13 +33,14 @@ func (c *Container) GetContainerStats(previousStats *ContainerStats) (*Container
if err != nil {
return nil, err
}
-
- cgroup, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(cgroupPath))
+ v1CGroups := GetV1CGroups(getExcludedCGroups())
+ cgroup, err := cgroups.Load(v1CGroups, cgroups.StaticPath(cgroupPath))
if err != nil {
return stats, errors.Wrapf(err, "unable to load cgroup at %s", cgroupPath)
}
- cgroupStats, err := cgroup.Stat()
+ // Ubuntu does not have swap memory in cgroups because swap is often not enabled.
+ cgroupStats, err := cgroup.Stat(cgroups.IgnoreNotExist)
if err != nil {
return stats, errors.Wrapf(err, "unable to obtain cgroup stats")
}
diff --git a/libpod/util.go b/libpod/util.go
index 17325f6e4..3b51e4fcc 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -9,8 +9,10 @@ import (
"strings"
"time"
+ "github.com/containerd/cgroups"
"github.com/containers/image/signature"
"github.com/containers/image/types"
+ "github.com/containers/libpod/pkg/util"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)
@@ -160,3 +162,26 @@ func validPodNSOption(p *Pod, ctrPod string) error {
}
return nil
}
+
+// GetV1CGroups gets the V1 cgroup subsystems and then "filters"
+// out any subsystems that are provided by the caller. Passing nil
+// for excludes will return the subsystems unfiltered.
+//func GetV1CGroups(excludes []string) ([]cgroups.Subsystem, error) {
+func GetV1CGroups(excludes []string) cgroups.Hierarchy {
+ return func() ([]cgroups.Subsystem, error) {
+ var filtered []cgroups.Subsystem
+
+ subSystem, err := cgroups.V1()
+ if err != nil {
+ return nil, err
+ }
+ for _, s := range subSystem {
+ // If the name of the subsystem is not in the list of excludes, then
+ // add it as a keeper.
+ if !util.StringInSlice(string(s.Name()), excludes) {
+ filtered = append(filtered, s)
+ }
+ }
+ return filtered, nil
+ }
+}
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 485b14ba5..d521632d7 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -63,6 +63,7 @@ type PodmanTest struct {
ArtifactPath string
TempDir string
CgroupManager string
+ Host HostOS
}
// HostOS is a simple struct for the test os
@@ -126,6 +127,7 @@ func CreateTempDirInTempDir() (string, error) {
// PodmanCreate creates a PodmanTest instance for the tests
func PodmanCreate(tempDir string) PodmanTest {
+ host := GetHostDistributionInfo()
cwd, _ := os.Getwd()
podmanBinary := filepath.Join(cwd, "../../bin/podman")
@@ -149,7 +151,19 @@ func PodmanCreate(tempDir string) PodmanTest {
cgroupManager = os.Getenv("CGROUP_MANAGER")
}
- runCBinary := "/usr/bin/runc"
+ // Ubuntu doesn't use systemd cgroups
+ if host.Distribution == "ubuntu" {
+ cgroupManager = "cgroupfs"
+ }
+
+ runCBinary, err := exec.LookPath("runc")
+ // If we cannot find the runc binary, setting to something static as we have no way
+ // to return an error. The tests will fail and point out that the runc binary could
+ // not be found nicely.
+ if err != nil {
+ runCBinary = "/usr/bin/runc"
+ }
+
CNIConfigDir := "/etc/cni/net.d"
p := PodmanTest{
@@ -164,6 +178,7 @@ func PodmanCreate(tempDir string) PodmanTest {
ArtifactPath: ARTIFACT_DIR,
TempDir: tempDir,
CgroupManager: cgroupManager,
+ Host: host,
}
// Setup registries.conf ENV variable
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go
index 00b8d952d..f266fafa4 100644
--- a/test/e2e/run_cgroup_parent_test.go
+++ b/test/e2e/run_cgroup_parent_test.go
@@ -45,7 +45,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
Specify("no --cgroup-parent", func() {
cgroup := "/libpod_parent"
- if !containerized() {
+ if !containerized() && podmanTest.CgroupManager != "cgroupfs" {
cgroup = "/machine.slice"
}
run := podmanTest.Podman([]string{"run", fedoraMinimal, "cat", "/proc/self/cgroup"})
@@ -56,7 +56,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
})
Specify("valid --cgroup-parent using slice", func() {
- if containerized() {
+ if containerized() || podmanTest.CgroupManager == "cgroupfs" {
Skip("Requires Systemd cgroup manager support")
}
cgroup := "aaaa.slice"
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index cc2b969a9..d1768138b 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -39,6 +39,9 @@ var _ = Describe("Podman run memory", func() {
})
It("podman run memory-reservation test", func() {
+ if podmanTest.Host.Distribution == "ubuntu" {
+ Skip("Unable to perform test on Ubuntu distributions due to memory management")
+ }
session := podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))