diff options
-rw-r--r-- | docs/source/markdown/podman-machine-init.1.md | 5 | ||||
-rw-r--r-- | pkg/api/server/register_images.go | 6 | ||||
-rw-r--r-- | test/e2e/run_test.go | 30 |
3 files changed, 25 insertions, 16 deletions
diff --git a/docs/source/markdown/podman-machine-init.1.md b/docs/source/markdown/podman-machine-init.1.md index 740897666..c864a87ef 100644 --- a/docs/source/markdown/podman-machine-init.1.md +++ b/docs/source/markdown/podman-machine-init.1.md @@ -54,13 +54,14 @@ Print usage statement. ## EXAMPLES ``` +$ podman machine init $ podman machine init myvm -$ podman machine init --device=/dev/xvdc:rw myvm +$ podman machine init --disk-size 50 $ podman machine init --memory=1024 myvm ``` ## SEE ALSO -podman-machine (1) +podman-machine(1) ## HISTORY March 2021, Originally compiled by Ashley Cui <acui@redhat.com> diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 2630acac2..95981226c 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -1038,6 +1038,12 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // description: Remove images that are not being used by a container // parameters: // - in: query + // name: all + // default: false + // type: boolean + // description: | + // Remove all images not in use by containers, not just dangling ones + // - in: query // name: filters // type: string // description: | diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 846da283d..cb61aba21 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -11,6 +11,7 @@ import ( "syscall" "time" + "github.com/containers/podman/v3/pkg/cgroups" . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" "github.com/mrunalp/fileutils" @@ -1323,35 +1324,36 @@ USER mail`, BB) }) It("podman run with cgroups=disabled runs without cgroups", func() { - SkipIfRootless("FIXME: I believe this should work but need to fix this test") SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users") // Only works on crun if !strings.Contains(podmanTest.OCIRuntime, "crun") { Skip("Test only works on crun") } + ownsCgroup, err := cgroups.UserOwnsCurrentSystemdCgroup() + Expect(err).ShouldNot(HaveOccurred()) + if !ownsCgroup { + // Podman moves itself to a new cgroup if it doesn't own the current cgroup + Skip("Test only works when Podman owns the current cgroup") + } + + trim := func(i string) string { + return strings.TrimSuffix(i, "\n") + } + curCgroupsBytes, err := ioutil.ReadFile("/proc/self/cgroup") Expect(err).ShouldNot(HaveOccurred()) - var curCgroups = string(curCgroupsBytes) + curCgroups := trim(string(curCgroupsBytes)) fmt.Printf("Output:\n%s\n", curCgroups) Expect(curCgroups).ToNot(Equal("")) - ctrName := "testctr" - container := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--cgroups=disabled", ALPINE, "top"}) + container := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroups=disabled", ALPINE, "cat", "/proc/self/cgroup"}) container.WaitWithDefaultTimeout() Expect(container).Should(Exit(0)) - // Get PID and get cgroups of that PID - inspectOut := podmanTest.InspectContainer(ctrName) - Expect(len(inspectOut)).To(Equal(1)) - pid := inspectOut[0].State.Pid - Expect(pid).ToNot(Equal(0)) - Expect(inspectOut[0].HostConfig.CgroupParent).To(Equal("")) - - ctrCgroupsBytes, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid)) - Expect(err).ShouldNot(HaveOccurred()) - var ctrCgroups = string(ctrCgroupsBytes) + ctrCgroups := trim(container.OutputToString()) fmt.Printf("Output\n:%s\n", ctrCgroups) + Expect(ctrCgroups).To(Equal(curCgroups)) }) |