mirror of
https://github.com/containers/podman.git
synced 2025-06-24 19:42:56 +08:00
Merge branch 'master' of github.com:containers/libpod into vendor
This commit is contained in:
@ -20,7 +20,7 @@ env:
|
||||
CNI_COMMIT: "7480240de9749f9a0a5c8614b17f1f03e0c06ab9"
|
||||
CRIO_COMMIT: "662dbb31b5d4f5ed54511a47cde7190c61c28677"
|
||||
CRIU_COMMIT: "584cbe4643c3fc7dc901ff08bf923ca0fe7326f9"
|
||||
RUNC_COMMIT: "ad0f5255060d36872be04de22f8731f38ef2d7b1"
|
||||
RUNC_COMMIT: "78ef28e63bec2ee4c139b5e3e0d691eb9bdc748d"
|
||||
# File to update in home-dir with task-specific env. var values
|
||||
ENVLIB: ".bash_profile"
|
||||
# Overrides default location (/tmp/cirrus) for repo clone
|
||||
@ -42,7 +42,7 @@ full_vm_testing_task:
|
||||
# 'matrix' combinations. All run in parallel.
|
||||
matrix:
|
||||
# Images are generated separetly, from build_images_task (below)
|
||||
image_name: "ubuntu-1804-bionic-v20180911-libpod-fce09afe"
|
||||
image_name: "ubuntu-1804-bionic-v20180911-libpod-63a86a18"
|
||||
# TODO: Make these work (also build_images_task below)
|
||||
#image_name: "rhel-server-ec2-7-5-165-1-libpod-fce09afe"
|
||||
#image_name: "centos-7-v20180911-libpod-fce09afe"
|
||||
|
@ -52,11 +52,80 @@ too since in the end the entire PR will be reviewed anyway. When in doubt,
|
||||
squash.
|
||||
|
||||
PRs that fix issues should include a reference like `Closes #XXXX` in the
|
||||
commit message so that github will automatically close the referenced issue
|
||||
commit message so that GitHub will automatically close the referenced issue
|
||||
when the PR is merged.
|
||||
|
||||
PRs will be approved by an [approver][owners] listed in [`OWNERS`](OWNERS).
|
||||
|
||||
### Describe your Changes in Commit Messages
|
||||
|
||||
Describe your problem. Whether your patch is a one-line bug fix or 5000 lines
|
||||
of a new feature, there must be an underlying problem that motivated you to do
|
||||
this work. Convince the reviewer that there is a problem worth fixing and that
|
||||
it makes sense for them to read past the first paragraph.
|
||||
|
||||
Describe user-visible impact. Straight up crashes and lockups are pretty
|
||||
convincing, but not all bugs are that blatant. Even if the problem was spotted
|
||||
during code review, describe the impact you think it can have on users. Keep in
|
||||
mind that the majority of users run packages provided by distributions, so
|
||||
include anything that could help route your change downstream.
|
||||
|
||||
Quantify optimizations and trade-offs. If you claim improvements in
|
||||
performance, memory consumption, stack footprint, or binary size, include
|
||||
numbers that back them up. But also describe non-obvious costs. Optimizations
|
||||
usually aren’t free but trade-offs between CPU, memory, and readability; or,
|
||||
when it comes to heuristics, between different workloads. Describe the expected
|
||||
downsides of your optimization so that the reviewer can weigh costs against
|
||||
benefits.
|
||||
|
||||
Once the problem is established, describe what you are actually doing about it
|
||||
in technical detail. It’s important to describe the change in plain English for
|
||||
the reviewer to verify that the code is behaving as you intend it to.
|
||||
|
||||
Solve only one problem per patch. If your description starts to get long,
|
||||
that’s a sign that you probably need to split up your patch.
|
||||
|
||||
If the patch fixes a logged bug entry, refer to that bug entry by number and
|
||||
URL. If the patch follows from a mailing list discussion, give a URL to the
|
||||
mailing list archive.
|
||||
|
||||
However, try to make your explanation understandable without external
|
||||
resources. In addition to giving a URL to a mailing list archive or bug,
|
||||
summarize the relevant points of the discussion that led to the patch as
|
||||
submitted.
|
||||
|
||||
If you want to refer to a specific commit, don’t just refer to the SHA-1 ID of
|
||||
the commit. Please also include the oneline summary of the commit, to make it
|
||||
easier for reviewers to know what it is about. Example:
|
||||
|
||||
```
|
||||
Commit f641c2d9384e ("fix bug in rm -fa parallel deletes") [...]
|
||||
```
|
||||
|
||||
You should also be sure to use at least the first twelve characters of the
|
||||
SHA-1 ID. The libpod repository holds a lot of objects, making collisions with
|
||||
shorter IDs a real possibility. Bear in mind that, even if there is no
|
||||
collision with your six-character ID now, that condition may change five years
|
||||
from now.
|
||||
|
||||
If your patch fixes a bug in a specific commit, e.g. you found an issue using
|
||||
git bisect, please use the ‘Fixes:’ tag with the first 12 characters of the
|
||||
SHA-1 ID, and the one line summary. For example:
|
||||
|
||||
```
|
||||
Fixes: f641c2d9384e ("fix bug in rm -fa parallel deletes")
|
||||
```
|
||||
|
||||
The following git config settings can be used to add a pretty format for
|
||||
outputting the above style in the git log or git show commands:
|
||||
|
||||
```
|
||||
[core]
|
||||
abbrev = 12
|
||||
[pretty]
|
||||
fixes = Fixes: %h (\"%s\")
|
||||
```
|
||||
|
||||
### Sign your PRs
|
||||
|
||||
The sign-off is a line at the end of the explanation for the patch. Your
|
||||
@ -127,7 +196,7 @@ Integration Tests [README.md](test/README.md).
|
||||
For general questions and discussion, please use the
|
||||
IRC `#podman` channel on `irc.freenode.net`.
|
||||
|
||||
For discussions around issues/bugs and features, you can use the github
|
||||
For discussions around issues/bugs and features, you can use the GitHub
|
||||
[issues](https://github.com/containers/libpod/issues)
|
||||
and
|
||||
[PRs](https://github.com/containers/libpod/pulls)
|
||||
|
@ -52,7 +52,7 @@ ADD . /go/src/github.com/containers/libpod
|
||||
RUN set -x && cd /go/src/github.com/containers/libpod && make install.libseccomp.sudo
|
||||
|
||||
# Install runc
|
||||
ENV RUNC_COMMIT ad0f5255060d36872be04de22f8731f38ef2d7b1
|
||||
ENV RUNC_COMMIT 78ef28e63bec2ee4c139b5e3e0d691eb9bdc748d
|
||||
RUN set -x \
|
||||
&& export GOPATH="$(mktemp -d)" \
|
||||
&& git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
|
||||
|
@ -329,16 +329,12 @@ func psCmd(c *cli.Context) error {
|
||||
}
|
||||
|
||||
// Define a tab writer with stdout as the output
|
||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
|
||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||
defer w.Flush()
|
||||
|
||||
// Output standard PS headers
|
||||
if !opts.Namespace {
|
||||
fmt.Fprintf(w, "\n%s\t%s\t%s\t%s\t%s\t%s\t%s", hid, himage, hcommand, hcreated, hstatus, hports, hnames)
|
||||
// If the user does not want size OR pod info, we print the isInfra bool
|
||||
if !opts.Size && !opts.Pod {
|
||||
fmt.Fprintf(w, "\t%s", hinfra)
|
||||
}
|
||||
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s", hid, himage, hcommand, hcreated, hstatus, hports, hnames)
|
||||
// User wants pod info
|
||||
if opts.Pod {
|
||||
fmt.Fprintf(w, "\t%s", hpod)
|
||||
@ -349,22 +345,15 @@ func psCmd(c *cli.Context) error {
|
||||
}
|
||||
} else {
|
||||
// Output Namespace headers
|
||||
fmt.Fprintf(w, "\n%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s", hid, hnames, nspid, nscgroup, nsipc, nsmnt, nsnet, nspidns, nsuserns, nsuts)
|
||||
}
|
||||
if len(pss) == 0 {
|
||||
fmt.Fprint(w, "\n")
|
||||
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s", hid, hnames, nspid, nscgroup, nsipc, nsmnt, nsnet, nspidns, nsuserns, nsuts)
|
||||
}
|
||||
|
||||
// Now iterate each container and output its information
|
||||
for _, container := range pss {
|
||||
|
||||
// Standard PS output
|
||||
if !opts.Namespace {
|
||||
fmt.Fprintf(w, "\n%s\t%s\t%s\t%s\t%s\t%s\t%s", container.ID, container.Image, container.Command, container.Created, container.Status, container.Ports, container.Names)
|
||||
|
||||
// If not size and not pod info, do isInfra
|
||||
if !opts.Size && !opts.Pod {
|
||||
fmt.Fprintf(w, "\t%t", container.IsInfra)
|
||||
}
|
||||
// User wants pod info
|
||||
if opts.Pod {
|
||||
fmt.Fprintf(w, "\t%s", container.Pod)
|
||||
@ -387,6 +376,7 @@ func psCmd(c *cli.Context) error {
|
||||
}
|
||||
|
||||
}
|
||||
fmt.Fprint(w, "\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
const (
|
||||
cidTruncLength = 12
|
||||
podTruncLength = 12
|
||||
cmdTruncLength = 17
|
||||
)
|
||||
|
||||
// PsOptions describes the struct being formed for ps
|
||||
@ -191,9 +192,12 @@ func NewBatchContainer(ctr *libpod.Container, opts PsOptions) (PsContainerOutput
|
||||
pod := ctr.PodID()
|
||||
if !opts.NoTrunc {
|
||||
cid = cid[0:cidTruncLength]
|
||||
if len(pod) > 12 {
|
||||
if len(pod) > podTruncLength {
|
||||
pod = pod[0:podTruncLength]
|
||||
}
|
||||
if len(command) > cmdTruncLength {
|
||||
command = command[0:cmdTruncLength] + "..."
|
||||
}
|
||||
}
|
||||
|
||||
pso.ID = cid
|
||||
|
@ -453,22 +453,19 @@ func (c *Container) Unmount(force bool) error {
|
||||
}
|
||||
}
|
||||
|
||||
if c.state.State == ContainerStateRunning || c.state.State == ContainerStatePaused {
|
||||
return errors.Wrapf(ErrCtrStateInvalid, "cannot unmount storage for container %s as it is running or paused", c.ID())
|
||||
}
|
||||
|
||||
// Check if we have active exec sessions
|
||||
if len(c.state.ExecSessions) != 0 {
|
||||
return errors.Wrapf(ErrCtrStateInvalid, "container %s has active exec sessions, refusing to unmount", c.ID())
|
||||
}
|
||||
|
||||
if c.state.Mounted {
|
||||
mounted, err := c.runtime.storageService.MountedContainerImage(c.ID())
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "can't determine how many times %s is mounted, refusing to unmount", c.ID())
|
||||
}
|
||||
if mounted == 1 {
|
||||
return errors.Wrapf(err, "can't unmount %s last mount, it is still in use", c.ID())
|
||||
if c.state.State == ContainerStateRunning || c.state.State == ContainerStatePaused {
|
||||
return errors.Wrapf(ErrCtrStateInvalid, "cannot unmount storage for container %s as it is running or paused", c.ID())
|
||||
}
|
||||
if len(c.state.ExecSessions) != 0 {
|
||||
return errors.Wrapf(ErrCtrStateInvalid, "container %s has active exec sessions, refusing to unmount", c.ID())
|
||||
}
|
||||
return errors.Wrapf(ErrInternal, "can't unmount %s last mount, it is still in use", c.ID())
|
||||
}
|
||||
}
|
||||
return c.unmount(force)
|
||||
|
@ -184,6 +184,8 @@ var (
|
||||
RuntimePath: []string{
|
||||
"/usr/bin/runc",
|
||||
"/usr/sbin/runc",
|
||||
"/usr/local/bin/runc",
|
||||
"/usr/local/sbin/runc",
|
||||
"/sbin/runc",
|
||||
"/bin/runc",
|
||||
"/usr/lib/cri-o-runc/sbin/runc",
|
||||
@ -191,6 +193,7 @@ var (
|
||||
ConmonPath: []string{
|
||||
"/usr/libexec/podman/conmon",
|
||||
"/usr/libexec/crio/conmon",
|
||||
"/usr/local/lib/podman/conmon",
|
||||
"/usr/local/libexec/crio/conmon",
|
||||
"/usr/bin/conmon",
|
||||
"/usr/sbin/conmon",
|
||||
@ -206,7 +209,7 @@ var (
|
||||
MaxLogSize: -1,
|
||||
NoPivotRoot: false,
|
||||
CNIConfigDir: "/etc/cni/net.d/",
|
||||
CNIPluginDir: []string{"/usr/libexec/cni", "/usr/lib/cni", "/opt/cni/bin"},
|
||||
CNIPluginDir: []string{"/usr/libexec/cni", "/usr/lib/cni", "/usr/local/lib/cni", "/opt/cni/bin"},
|
||||
InfraCommand: DefaultInfraCommand,
|
||||
InfraImage: DefaultInfraImage,
|
||||
EnablePortReservation: true,
|
||||
|
@ -28,7 +28,7 @@ func Device(d *configs.Device) spec.LinuxDevice {
|
||||
}
|
||||
|
||||
func addDevice(g *generate.Generator, device string) error {
|
||||
src, dst, permissions, err := parseDevice(device)
|
||||
src, dst, permissions, err := ParseDevice(device)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -148,21 +148,21 @@ func getLoggingPath(opts []string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// parseDevice parses device mapping string to a src, dest & permissions string
|
||||
func parseDevice(device string) (string, string, string, error) { //nolint
|
||||
// ParseDevice parses device mapping string to a src, dest & permissions string
|
||||
func ParseDevice(device string) (string, string, string, error) { //nolint
|
||||
src := ""
|
||||
dst := ""
|
||||
permissions := "rwm"
|
||||
arr := strings.Split(device, ":")
|
||||
switch len(arr) {
|
||||
case 3:
|
||||
if !validDeviceMode(arr[2]) {
|
||||
if !IsValidDeviceMode(arr[2]) {
|
||||
return "", "", "", fmt.Errorf("invalid device mode: %s", arr[2])
|
||||
}
|
||||
permissions = arr[2]
|
||||
fallthrough
|
||||
case 2:
|
||||
if validDeviceMode(arr[1]) {
|
||||
if IsValidDeviceMode(arr[1]) {
|
||||
permissions = arr[1]
|
||||
} else {
|
||||
if arr[1][0] != '/' {
|
||||
@ -183,9 +183,9 @@ func parseDevice(device string) (string, string, string, error) { //nolint
|
||||
return src, dst, permissions, nil
|
||||
}
|
||||
|
||||
// validDeviceMode checks if the mode for device is valid or not.
|
||||
// Valid mode is a composition of r (read), w (write), and m (mknod).
|
||||
func validDeviceMode(mode string) bool {
|
||||
// IsValidDeviceMode checks if the mode for device is valid or not.
|
||||
// IsValid mode is a composition of r (read), w (write), and m (mknod).
|
||||
func IsValidDeviceMode(mode string) bool {
|
||||
var legalDeviceMode = map[rune]bool{
|
||||
'r': true,
|
||||
'w': true,
|
||||
|
Reference in New Issue
Block a user