diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/README.md | 4 | ||||
-rw-r--r-- | cmd/podman/common.go | 4 | ||||
-rw-r--r-- | cmd/podman/shared/create.go | 1 | ||||
-rw-r--r-- | cmd/podman/shared/intermediate.go | 2 | ||||
-rw-r--r-- | cmd/podman/shared/volumes_shared.go | 47 | ||||
-rw-r--r-- | cmd/podman/varlink/io.podman.varlink | 4 | ||||
-rw-r--r-- | cmd/podman/volume_rm.go | 18 |
7 files changed, 61 insertions, 19 deletions
diff --git a/cmd/podman/README.md b/cmd/podman/README.md index 0fee7eafa..937eef510 100644 --- a/cmd/podman/README.md +++ b/cmd/podman/README.md @@ -1,5 +1,5 @@ -# podman - Simple debugging tool for pods and images -podman is a daemonless container runtime for managing containers, pods, and container images. +# Podman - Simple debugging tool for pods and images +Podman is a daemonless container runtime for managing containers, pods, and container images. It is intended as a counterpart to CRI-O, to provide low-level debugging not available through the CRI interface used by Kubernetes. It can also act as a container runtime independent of CRI-O, creating and managing its own set of containers. diff --git a/cmd/podman/common.go b/cmd/podman/common.go index 9724d18c6..0115e6ef1 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -135,6 +135,10 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { "cgroup namespace to use", ) createFlags.String( + "cgroups", "enabled", + "control container cgroup configuration", + ) + createFlags.String( "cgroup-parent", "", "Optional parent cgroup for the container", ) diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go index acbd53dba..fc8197721 100644 --- a/cmd/podman/shared/create.go +++ b/cmd/podman/shared/create.go @@ -695,6 +695,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod. CapDrop: c.StringSlice("cap-drop"), CidFile: c.String("cidfile"), Cgroupns: c.String("cgroupns"), + Cgroups: c.String("cgroups"), CgroupParent: c.String("cgroup-parent"), Command: command, UserCommand: userCommand, diff --git a/cmd/podman/shared/intermediate.go b/cmd/podman/shared/intermediate.go index 5aaac8687..cccdd1bea 100644 --- a/cmd/podman/shared/intermediate.go +++ b/cmd/podman/shared/intermediate.go @@ -370,6 +370,8 @@ func NewIntermediateLayer(c *cliconfig.PodmanCommand, remote bool) GenericCLIRes m["blkio-weight-device"] = newCRStringSlice(c, "blkio-weight-device") m["cap-add"] = newCRStringSlice(c, "cap-add") m["cap-drop"] = newCRStringSlice(c, "cap-drop") + m["cgroupns"] = newCRString(c, "cgroupns") + m["cgroups"] = newCRString(c, "cgroups") m["cgroup-parent"] = newCRString(c, "cgroup-parent") m["cidfile"] = newCRString(c, "cidfile") m["conmon-pidfile"] = newCRString(c, "conmon-pidfile") diff --git a/cmd/podman/shared/volumes_shared.go b/cmd/podman/shared/volumes_shared.go new file mode 100644 index 000000000..912615cad --- /dev/null +++ b/cmd/podman/shared/volumes_shared.go @@ -0,0 +1,47 @@ +package shared + +import ( + "context" + + "github.com/containers/libpod/libpod" +) + +// Remove given set of volumes +func SharedRemoveVolumes(ctx context.Context, runtime *libpod.Runtime, vols []string, all, force bool) ([]string, map[string]error, error) { + var ( + toRemove []*libpod.Volume + success []string + failed map[string]error + ) + + failed = make(map[string]error) + + if all { + vols, err := runtime.Volumes() + if err != nil { + return nil, nil, err + } + toRemove = vols + } else { + for _, v := range vols { + vol, err := runtime.LookupVolume(v) + if err != nil { + failed[v] = err + continue + } + toRemove = append(toRemove, vol) + } + } + + // We could parallelize this, but I haven't heard anyone complain about + // performance here yet, so hold off. + for _, vol := range toRemove { + if err := runtime.RemoveVolume(ctx, vol, force); err != nil { + failed[vol.Name()] = err + continue + } + success = append(success, vol.Name()) + } + + return success, failed, nil +} diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index 752e28256..4692525e3 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -249,7 +249,7 @@ type InfoStore ( run_root: string ) -# InfoPodman provides details on the podman binary +# InfoPodman provides details on the Podman binary type InfoPodmanBinary ( compiler: string, go_version: string, @@ -1212,7 +1212,7 @@ method ReceiveFile(path: string, delete: bool) -> (len: int) method VolumeCreate(options: VolumeCreateOpts) -> (volumeName: string) # VolumeRemove removes a volume on a remote host -method VolumeRemove(options: VolumeRemoveOpts) -> (volumeNames: []string) +method VolumeRemove(options: VolumeRemoveOpts) -> (successes: []string, failures: [string]string) # GetVolumes gets slice of the volumes on a remote host method GetVolumes(args: []string, all: bool) -> (volumes: []Volume) diff --git a/cmd/podman/volume_rm.go b/cmd/podman/volume_rm.go index 0141d06da..2fa6a8d03 100644 --- a/cmd/podman/volume_rm.go +++ b/cmd/podman/volume_rm.go @@ -1,8 +1,6 @@ package main import ( - "fmt" - "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/pkg/adapter" "github.com/pkg/errors" @@ -52,19 +50,9 @@ func volumeRmCmd(c *cliconfig.VolumeRmValues) error { return errors.Wrapf(err, "error creating libpod runtime") } defer runtime.DeferredShutdown(false) - deletedVolumeNames, err := runtime.RemoveVolumes(getContext(), c) + deletedVolumeNames, deletedVolumeErrors, err := runtime.RemoveVolumes(getContext(), c) if err != nil { - if len(deletedVolumeNames) > 0 { - printDeleteVolumes(deletedVolumeNames) - return err - } - } - printDeleteVolumes(deletedVolumeNames) - return err -} - -func printDeleteVolumes(volumes []string) { - for _, v := range volumes { - fmt.Println(v) + return err } + return printCmdResults(deletedVolumeNames, deletedVolumeErrors) } |