summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--cmd/podman/images/scp.go43
-rw-r--r--cmd/podman/pods/create.go4
-rw-r--r--cmd/podman/system/connection/add.go7
-rw-r--r--cmd/podman/system/connection/remove.go27
-rw-r--r--cmd/podman/system/connection/shared.go9
-rw-r--r--cmd/podman/validate/args.go3
-rw-r--r--contrib/cirrus/lib.sh50
-rwxr-xr-xcontrib/cirrus/pr-should-include-tests8
-rw-r--r--docs/source/markdown/podman-build.1.md12
-rw-r--r--docs/source/markdown/podman-create.1.md12
-rw-r--r--docs/source/markdown/podman-image-scp.1.md18
-rw-r--r--docs/source/markdown/podman-pull.1.md2
-rw-r--r--docs/source/markdown/podman-run.1.md12
-rw-r--r--docs/source/markdown/podman-system-connection-remove.1.md8
-rw-r--r--go.mod7
-rw-r--r--go.sum16
-rwxr-xr-xhack/install_catatonit.sh2
-rw-r--r--libpod/container_internal.go24
-rw-r--r--libpod/container_internal_linux.go8
-rw-r--r--libpod/lock/shm/shm_lock.go11
-rw-r--r--libpod/runtime_ctr.go9
-rw-r--r--libpod/runtime_pod_linux.go40
-rw-r--r--nix/default-arm64.nix3
-rw-r--r--nix/default.nix3
-rw-r--r--pkg/checkpoint/checkpoint_restore.go2
-rw-r--r--pkg/domain/entities/engine_image.go1
-rw-r--r--pkg/domain/entities/images.go4
-rw-r--r--pkg/domain/infra/abi/images.go65
-rw-r--r--pkg/domain/infra/tunnel/images.go5
-rw-r--r--test/e2e/checkpoint_test.go53
-rw-r--r--test/e2e/common_test.go76
-rw-r--r--test/e2e/config/containers-netns.conf3
-rw-r--r--test/e2e/healthcheck_run_test.go12
-rw-r--r--test/e2e/image_scp_test.go22
-rw-r--r--test/e2e/libpod_suite_remote_test.go8
-rw-r--r--test/e2e/libpod_suite_test.go3
-rw-r--r--test/e2e/pod_create_test.go18
-rw-r--r--test/e2e/system_connection_test.go395
-rw-r--r--test/system/001-basic.bats4
-rw-r--r--test/system/015-help.bats4
-rw-r--r--test/system/272-system-connection.bats5
-rw-r--r--test/system/500-networking.bats7
-rw-r--r--test/utils/matchers.go153
-rw-r--r--test/utils/utils.go12
-rw-r--r--vendor/github.com/checkpoint-restore/go-criu/v5/magic/types.go12
-rw-r--r--vendor/github.com/checkpoint-restore/go-criu/v5/stats/stats.pb.go462
-rw-r--r--vendor/github.com/checkpoint-restore/go-criu/v5/stats/stats.proto40
-rw-r--r--vendor/github.com/checkpoint-restore/go-criu/v5/stats/types.go6
-rw-r--r--vendor/github.com/checkpoint-restore/go-criu/v5/stats/utils.go54
-rw-r--r--vendor/github.com/containers/common/libimage/inspect.go5
-rw-r--r--vendor/github.com/containers/common/pkg/config/config.go5
-rw-r--r--vendor/modules.txt6
53 files changed, 1422 insertions, 367 deletions
diff --git a/Makefile b/Makefile
index 00afd1dfd..47f30e5fa 100644
--- a/Makefile
+++ b/Makefile
@@ -62,10 +62,11 @@ PKG_MANAGER ?= $(shell command -v dnf yum|head -n1)
PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit pre-commit | head -n1)
# This isn't what we actually build; it's a superset, used for target
-# dependencies. Basically: all *.go files, except *_test.go, and except
-# anything in a dot subdirectory. If any of these files is newer than
-# our target (bin/podman{,-remote}), a rebuild is triggered.
-SOURCES = $(shell find . -path './.*' -prune -o \( -name '*.go' -a ! -name '*_test.go' \) -print)
+# dependencies. Basically: all *.go and *.c files, except *_test.go,
+# and except anything in a dot subdirectory. If any of these files is
+# newer than our target (bin/podman{,-remote}), a rebuild is
+# triggered.
+SOURCES = $(shell find . -path './.*' -prune -o \( \( -name '*.go' -o -name '*.c' \) -a ! -name '*_test.go' \) -print)
BUILDFLAGS := -mod=vendor $(BUILDFLAGS)
diff --git a/cmd/podman/images/scp.go b/cmd/podman/images/scp.go
index c89a090bf..67a531e6b 100644
--- a/cmd/podman/images/scp.go
+++ b/cmd/podman/images/scp.go
@@ -16,6 +16,7 @@ import (
"github.com/containers/podman/v3/cmd/podman/system/connection"
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/domain/entities"
+ "github.com/containers/podman/v3/pkg/rootless"
"github.com/docker/distribution/reference"
scpD "github.com/dtylman/scp"
"github.com/pkg/errors"
@@ -125,6 +126,11 @@ func scp(cmd *cobra.Command, args []string) (finalErr error) {
fmt.Println(rep)
// TODO: Add podman remote support
default: // else native load
+ scpOpts.Save.Format = "oci-archive"
+ _, err := os.Open(scpOpts.Save.Output)
+ if err != nil {
+ return err
+ }
if scpOpts.Tag != "" {
return errors.Wrapf(define.ErrInvalidArg, "Renaming of an image is currently not supported")
}
@@ -133,12 +139,20 @@ func scp(cmd *cobra.Command, args []string) (finalErr error) {
if abiErr != nil {
errors.Wrapf(abiErr, "could not save image as specified")
}
- rep, err := abiEng.Load(context.Background(), scpOpts.Load)
- if err != nil {
- return err
+ if !rootless.IsRootless() && scpOpts.Rootless {
+ err := abiEng.Transfer(context.Background(), scpOpts)
+ if err != nil {
+ return err
+ }
+ } else {
+ rep, err := abiEng.Load(context.Background(), scpOpts.Load)
+ if err != nil {
+ return err
+ }
+ fmt.Println("Loaded image(s): " + strings.Join(rep.Names, ","))
}
- fmt.Println("Loaded image(s): " + strings.Join(rep.Names, ","))
}
+
return nil
}
@@ -154,7 +168,7 @@ func loadToRemote(localFile string, tag string, url *urlP.URL, iden string) (str
n, err := scpD.CopyTo(dial, localFile, remoteFile)
if err != nil {
- errOut := (strconv.Itoa(int(n)) + " Bytes copied before error")
+ errOut := strconv.Itoa(int(n)) + " Bytes copied before error"
return " ", errors.Wrapf(err, errOut)
}
run := ""
@@ -167,7 +181,7 @@ func loadToRemote(localFile string, tag string, url *urlP.URL, iden string) (str
if err != nil {
return "", err
}
- return strings.TrimSuffix(out, "\n"), nil
+ return strings.TrimSuffix(string(out), "\n"), nil
}
// saveToRemote takes image information and remote connection information. it connects to the specified client
@@ -193,7 +207,7 @@ func saveToRemote(image, localFile string, tag string, uri *urlP.URL, iden strin
n, err := scpD.CopyFrom(dial, remoteFile, localFile)
connection.ExecRemoteCommand(dial, "rm "+remoteFile)
if err != nil {
- errOut := (strconv.Itoa(int(n)) + " Bytes copied before error")
+ errOut := strconv.Itoa(int(n)) + " Bytes copied before error"
return errors.Wrapf(err, errOut)
}
return nil
@@ -207,11 +221,7 @@ func makeRemoteFile(dial *ssh.Client) (string, error) {
if err != nil {
return "", err
}
- remoteFile = strings.TrimSuffix(remoteFile, "\n")
- if err != nil {
- return "", err
- }
- return remoteFile, nil
+ return strings.TrimSuffix(string(remoteFile), "\n"), nil
}
// createConnections takes a boolean determining which ssh client to dial
@@ -271,7 +281,14 @@ func parseArgs(args []string, cfg *config.Config) (map[string]config.Destination
scpOpts.SourceImageName = args[0]
}
case 2:
- if strings.Contains(args[0], "::") {
+ if strings.Contains(args[0], "localhost") || strings.Contains(args[1], "localhost") { // only supporting root to local using sudo at the moment
+ scpOpts.Rootless = true
+ scpOpts.User = strings.Split(args[1], "@")[0]
+ scpOpts.SourceImageName = strings.Split(args[0], "::")[1]
+ if strings.Split(args[0], "@")[0] != "root" {
+ return nil, errors.Wrapf(define.ErrInvalidArg, "cannot transfer images from any user besides root using sudo")
+ }
+ } else if strings.Contains(args[0], "::") {
if !(strings.Contains(args[1], "::")) && remoteArgLength(args[0], 1) == 0 { // if an image is specified, this mean we are loading to our client
cliConnections = append(cliConnections, args[0])
scpOpts.ToRemote = true
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index 0a0d43b53..b966706b4 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -117,7 +117,7 @@ func create(cmd *cobra.Command, args []string) error {
return fmt.Errorf("cannot specify no-hosts without an infra container")
}
flags := cmd.Flags()
- createOptions.Net, err = common.NetFlagsToNetOptions(nil, *flags, false)
+ createOptions.Net, err = common.NetFlagsToNetOptions(nil, *flags, createOptions.Infra)
if err != nil {
return err
}
@@ -134,7 +134,7 @@ func create(cmd *cobra.Command, args []string) error {
} else {
// reassign certain options for lbpod api, these need to be populated in spec
flags := cmd.Flags()
- infraOptions.Net, err = common.NetFlagsToNetOptions(nil, *flags, false)
+ infraOptions.Net, err = common.NetFlagsToNetOptions(nil, *flags, createOptions.Infra)
if err != nil {
return err
}
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go
index 290b3c245..ee237d7d0 100644
--- a/cmd/podman/system/connection/add.go
+++ b/cmd/podman/system/connection/add.go
@@ -226,12 +226,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL, iden string) (string, error) {
if v, found := os.LookupEnv("PODMAN_BINARY"); found {
podman = v
}
- run := podman + " info --format=json"
- out, err := ExecRemoteCommand(dial, run)
- if err != nil {
- return "", err
- }
- infoJSON, err := json.Marshal(out)
+ infoJSON, err := ExecRemoteCommand(dial, podman+" info --format=json")
if err != nil {
return "", err
}
diff --git a/cmd/podman/system/connection/remove.go b/cmd/podman/system/connection/remove.go
index 73bae4994..ffbea76c5 100644
--- a/cmd/podman/system/connection/remove.go
+++ b/cmd/podman/system/connection/remove.go
@@ -5,14 +5,14 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
+ "github.com/pkg/errors"
"github.com/spf13/cobra"
)
var (
// Skip creating engines since this command will obtain connection information to said engines
rmCmd = &cobra.Command{
- Use: "remove NAME",
- Args: cobra.ExactArgs(1),
+ Use: "remove [options] NAME",
Aliases: []string{"rm"},
Long: `Delete named destination from podman configuration`,
Short: "Delete named destination",
@@ -21,6 +21,10 @@ var (
Example: `podman system connection remove devl
podman system connection rm devl`,
}
+
+ rmOpts = struct {
+ All bool
+ }{}
)
func init() {
@@ -28,14 +32,31 @@ func init() {
Command: rmCmd,
Parent: system.ConnectionCmd,
})
+
+ flags := rmCmd.Flags()
+ flags.BoolVarP(&rmOpts.All, "all", "a", false, "Remove all connections")
}
-func rm(_ *cobra.Command, args []string) error {
+func rm(cmd *cobra.Command, args []string) error {
cfg, err := config.ReadCustomConfig()
if err != nil {
return err
}
+ if rmOpts.All {
+ if cfg.Engine.ServiceDestinations != nil {
+ for k := range cfg.Engine.ServiceDestinations {
+ delete(cfg.Engine.ServiceDestinations, k)
+ }
+ }
+ cfg.Engine.ActiveService = ""
+ return cfg.Write()
+ }
+
+ if len(args) != 1 {
+ return errors.New("accepts 1 arg(s), received 0")
+ }
+
if cfg.Engine.ServiceDestinations != nil {
delete(cfg.Engine.ServiceDestinations, args[0])
}
diff --git a/cmd/podman/system/connection/shared.go b/cmd/podman/system/connection/shared.go
index 3fd7c59fb..714ae827d 100644
--- a/cmd/podman/system/connection/shared.go
+++ b/cmd/podman/system/connection/shared.go
@@ -9,10 +9,10 @@ import (
// ExecRemoteCommand takes a ssh client connection and a command to run and executes the
// command on the specified client. The function returns the Stdout from the client or the Stderr
-func ExecRemoteCommand(dial *ssh.Client, run string) (string, error) {
+func ExecRemoteCommand(dial *ssh.Client, run string) ([]byte, error) {
sess, err := dial.NewSession() // new ssh client session
if err != nil {
- return "", err
+ return nil, err
}
defer sess.Close()
@@ -21,8 +21,7 @@ func ExecRemoteCommand(dial *ssh.Client, run string) (string, error) {
sess.Stdout = &buffer // output from client funneled into buffer
sess.Stderr = &bufferErr // err form client funneled into buffer
if err := sess.Run(run); err != nil { // run the command on the ssh client
- return "", errors.Wrapf(err, bufferErr.String())
+ return nil, errors.Wrapf(err, bufferErr.String())
}
- out := buffer.String() // output from command
- return out, nil
+ return buffer.Bytes(), nil
}
diff --git a/cmd/podman/validate/args.go b/cmd/podman/validate/args.go
index fc07a6acc..6b5425a69 100644
--- a/cmd/podman/validate/args.go
+++ b/cmd/podman/validate/args.go
@@ -27,7 +27,8 @@ func SubCommandExists(cmd *cobra.Command, args []string) error {
}
return errors.Errorf("unrecognized command `%[1]s %[2]s`\n\nDid you mean this?\n\t%[3]s\n\nTry '%[1]s --help' for more information.", cmd.CommandPath(), args[0], strings.Join(suggestions, "\n\t"))
}
- return errors.Errorf("missing command '%[1]s COMMAND'\nTry '%[1]s --help' for more information.", cmd.CommandPath())
+ cmd.Help()
+ return errors.Errorf("missing command '%[1]s COMMAND'", cmd.CommandPath())
}
// IDOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index 9b7c613f5..cff8f4b3f 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -166,30 +166,42 @@ setup_rootless() {
useradd -g $rootless_gid -u $rootless_uid --no-user-group --create-home $ROOTLESS_USER
chown -R $ROOTLESS_USER:$ROOTLESS_USER "$GOPATH" "$GOSRC"
- msg "creating ssh key pair for $USER"
+ mkdir -p "$HOME/.ssh" "/home/$ROOTLESS_USER/.ssh"
+
+ msg "Creating ssh key pairs"
[[ -r "$HOME/.ssh/id_rsa" ]] || \
- ssh-keygen -P "" -f "$HOME/.ssh/id_rsa"
+ ssh-keygen -t rsa -P "" -f "$HOME/.ssh/id_rsa"
+ ssh-keygen -t ed25519 -P "" -f "/home/$ROOTLESS_USER/.ssh/id_ed25519"
+ ssh-keygen -t rsa -P "" -f "/home/$ROOTLESS_USER/.ssh/id_rsa"
- msg "Allowing ssh key for $ROOTLESS_USER"
- akfilepath="/home/$ROOTLESS_USER/.ssh/authorized_keys"
- (umask 077 && mkdir "/home/$ROOTLESS_USER/.ssh")
- chown -R $ROOTLESS_USER:$ROOTLESS_USER "/home/$ROOTLESS_USER/.ssh"
- install -o $ROOTLESS_USER -g $ROOTLESS_USER -m 0600 \
- "$HOME/.ssh/id_rsa.pub" "$akfilepath"
- # Makes debugging easier
- cat /root/.ssh/authorized_keys >> "$akfilepath"
+ msg "Setup authorized_keys"
+ cat $HOME/.ssh/*.pub /home/$ROOTLESS_USER/.ssh/*.pub >> $HOME/.ssh/authorized_keys
+ cat $HOME/.ssh/*.pub /home/$ROOTLESS_USER/.ssh/*.pub >> /home/$ROOTLESS_USER/.ssh/authorized_keys
msg "Ensure the ssh daemon is up and running within 5 minutes"
systemctl start sshd
- sshcmd="ssh $ROOTLESS_USER@localhost
- -o UserKnownHostsFile=/dev/null
- -o StrictHostKeyChecking=no
- -o CheckHostIP=no"
- lilto $sshcmd true # retry until sshd is up
-
- msg "Configuring rootless user self-access to ssh to localhost"
- $sshcmd ssh-keygen -P '""' -f "/home/$ROOTLESS_USER/.ssh/id_rsa"
- cat "/home/$ROOTLESS_USER/.ssh/id_rsa" >> "$akfilepath"
+ lilto systemctl is-active sshd
+
+ msg "Configure ssh file permissions"
+ chmod -R 700 "$HOME/.ssh"
+ chmod -R 700 "/home/$ROOTLESS_USER/.ssh"
+ chown -R $ROOTLESS_USER:$ROOTLESS_USER "/home/$ROOTLESS_USER/.ssh"
+
+ msg " setup known_hosts for $USER"
+ ssh -q root@localhost \
+ -o UserKnownHostsFile=/root/.ssh/known_hosts \
+ -o UpdateHostKeys=yes \
+ -o StrictHostKeyChecking=no \
+ -o CheckHostIP=no \
+ true
+
+ msg " setup known_hosts for $ROOTLESS_USER"
+ su $ROOTLESS_USER -c "ssh -q $ROOTLESS_USER@localhost \
+ -o UserKnownHostsFile=/home/$ROOTLESS_USER/.ssh/known_hosts \
+ -o UpdateHostKeys=yes \
+ -o StrictHostKeyChecking=no \
+ -o CheckHostIP=no \
+ true"
}
install_test_configs() {
diff --git a/contrib/cirrus/pr-should-include-tests b/contrib/cirrus/pr-should-include-tests
index 4b6329311..8103df41d 100755
--- a/contrib/cirrus/pr-should-include-tests
+++ b/contrib/cirrus/pr-should-include-tests
@@ -12,9 +12,6 @@ fi
if [[ "${CIRRUS_CHANGE_MESSAGE}" =~ NO.NEW.TESTS.NEEDED ]]; then
exit 0
fi
-if [[ "${CIRRUS_CHANGE_MESSAGE}" =~ NO.TESTS.NEEDED ]]; then
- exit 0
-fi
# HEAD should be good enough, but the CIRRUS envariable allows us to test
head=${CIRRUS_CHANGE_IN_REPO:-HEAD}
@@ -52,14 +49,11 @@ if [[ -z "$filtered_changes" ]]; then
exit 0
fi
-# One last chance: perhaps the developer included the magic '[NO (NEW) TESTS NEEDED]'
+# One last chance: perhaps the developer included the magic '[NO NEW TESTS NEEDED]'
# string in an amended commit.
if git log --format=%B ${base}..${head} | fgrep '[NO NEW TESTS NEEDED]'; then
exit 0
fi
-if git log --format=%B ${base}..${head} | fgrep '[NO TESTS NEEDED]'; then
- exit 0
-fi
cat <<EOF
$(basename $0): PR does not include changes in the 'tests' directory
diff --git a/docs/source/markdown/podman-build.1.md b/docs/source/markdown/podman-build.1.md
index 5a867c574..13fd3982f 100644
--- a/docs/source/markdown/podman-build.1.md
+++ b/docs/source/markdown/podman-build.1.md
@@ -241,7 +241,7 @@ Note: if _host_device_ is a symbolic link then it will be resolved first.
The container will only store the major and minor numbers of the host device.
Note: if the user only has access rights via a group, accessing the device
-from inside a rootless container will fail. The **crun**(1) runtime offers a
+from inside a rootless container will fail. The **[crun(1)](https://github.com/containers/crun/tree/main/crun.1.md)** runtime offers a
workaround for this by adding the option
#### **--annotation run.oci.keep_original_groups=1**.
@@ -774,6 +774,14 @@ content label. Shared volume labels allow all containers to read/write content.
The `Z` option tells Podman to label the content with a private unshared label.
Only the current container can use a private volume.
+Note: Do not relabel system files and directories. Relabeling system content
+might cause other confined services on your machine to fail. For these types
+of containers, disabling SELinux separation is recommended. The option
+`--security-opt label=disable` disables SELinux separation for the container.
+For example, if a user wanted to volume mount their entire home directory into the build containers, they need to disable SELinux separation.
+
+ $ podman build --security-opt label=disable -v $HOME:/home/user .
+
`Overlay Volume Mounts`
The `:O` flag tells Podman to mount the directory from the host as a
@@ -1013,7 +1021,7 @@ If you are using `useradd` within your build script, you should pass the
useradd to stop creating the lastlog file.
## SEE ALSO
-podman(1), buildah(1), containers-certs.d(5), containers-registries.conf(5), crun(8), runc(8), useradd(8), podman-ps(1), podman-rm(1), Containerfile(5), containerignore(5)
+**[podman(1)](podman.1.md)**, **[buildah(1)](https://github.com/containers/buildah/blob/main/docs/buildah.1.md)**, **[containers-certs.d(5)](https://github.com/containers/image/blob/main/docs/containers-certs.d.5.md)**, **[containers-registries.conf(5)](https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md)**, **[crun(1)](https://github.com/containers/crun/tree/main/crun.1.md)**, **[runc(8)](https://github.com/opencontainers/runc/blob/master/man/runc.8.md)**, **[useradd(8)](https://www.unix.com/man-page/redhat/8/useradd)**, **[podman-ps(1)](podman-ps.1.md)**, **[podman-rm(1)](podman-rm.1.md)**, **[Containerfile(5)](https://github.com/containers/buildah/blob/main/docs/Containerfile.5.md)**, **[containerignore(5)](https://github.com/containers/buildah/blob/main/docs//containerignore.5.md)**
## HISTORY
Aug 2020, Additional options and .containerignore added by Dan Walsh `<dwalsh@redhat.com>`
diff --git a/docs/source/markdown/podman-create.1.md b/docs/source/markdown/podman-create.1.md
index 3ff736adb..d40e425aa 100644
--- a/docs/source/markdown/podman-create.1.md
+++ b/docs/source/markdown/podman-create.1.md
@@ -1249,6 +1249,15 @@ content label. Shared volume labels allow all containers to read/write content.
The `Z` option tells Podman to label the content with a private unshared label.
Only the current container can use a private volume.
+Note: Do not relabel system files and directories. Relabeling system content
+might cause other confined services on your machine to fail. For these types
+of containers we recommend that disable SELinux separation. The option
+`--security-opt label=disable` disables SELinux separation for containers used in the build.
+For example if a user wanted to volume mount their entire home directory into a
+container, they need to disable SELinux separation.
+
+ $ podman create --security-opt label=disable -v $HOME:/home/user fedora touch /home/user/file
+
`Overlay Volume Mounts`
The `:O` flag tells Podman to mount the directory from the host as a
@@ -1528,8 +1537,7 @@ page.
NOTE: Use the environment variable `TMPDIR` to change the temporary storage location of downloaded container images. Podman defaults to use `/var/tmp`.
## SEE ALSO
-**podman**(1), **podman-secret**(1), **podman-save**(1), **podman-ps**(1), **podman-attach**(1), **podman-pod-create**(1), **podman-port**(1), **podman-start*(1), **podman-kill**(1), **podman-stop**(1),
-**podman-generate-systemd**(1) **podman-rm**(1), **subgid**(5), **subuid**(5), **containers.conf**(5), **systemd.unit**(5), **setsebool**(8), **slirp4netns**(1), **fuse-overlayfs**(1), **proc**(5), **conmon**(8), **personality**(2).
+**[podman(1)](podman.1.md)**, **[podman-save(1)](podman-save.1.md)**, **[podman-ps(1)](podman-ps.1.md)**, **[podman-attach(1)](podman-attach.1.md)**, **[podman-pod-create(1)](podman-create.1.md)**, **[podman-port(1)](podman--port.1.md)**, **[podman-start(1)](podman-start.1.md)**, **[podman-kill(1)](podman-kill.1.md)**, **[podman-stop(1)](podman-stop.1.md)**, **[podman-generate-systemd(1)](podman-generate-systemd.1.md)**, **[podman-rm(1)](podman-rm.1.md)**, **[subgid(5)](https://www.unix.com/man-page/linux/5/subuid)**, **[subuid(5)](https://www.unix.com/man-page/linux/5/subuid)**, **[containers.conf(5)]https://github.com/containers/common/blob/main/docs/containers.conf.5.md**, **[systemd.unit(5)](https://www.freedesktop.org/software/systemd/man/systemd.unit.html)**, **[setsebool(8)](https://man7.org/linux/man-pages/man8/setsebool.8.html)**, **[slirp4netns(1)](https://github.com/rootless-containers/slirp4netns/blob/master/slirp4netns.1.md)**, **[fuse-overlayfs(1)](https://github.com/containers/fuse-overlayfs/blob/main/fuse-overlayfs.1.md)**, **proc(5)**, **[conmon(8)](https://github.com/containers/conmon/blob/main/docs/conmon.5.md)**, **personality(2)**.
## HISTORY
October 2017, converted from Docker documentation to Podman by Dan Walsh for Podman `<dwalsh@redhat.com>`
diff --git a/docs/source/markdown/podman-image-scp.1.md b/docs/source/markdown/podman-image-scp.1.md
index 420452a4d..4dd79f3d2 100644
--- a/docs/source/markdown/podman-image-scp.1.md
+++ b/docs/source/markdown/podman-image-scp.1.md
@@ -8,7 +8,7 @@ podman-image-scp - Securely copy an image from one host to another
## DESCRIPTION
**podman image scp** copies container images between hosts on a network. You can load to the remote host or from the remote host as well as in between two remote hosts.
-Note: `::` is used to specify the image name depending on if you are saving or loading.
+Note: `::` is used to specify the image name depending on if you are saving or loading. Images can also be transferred from rootful to rootless storage on the same machine without using sshd. This feature is not supported on the remote client.
**podman image scp [GLOBAL OPTIONS]**
@@ -62,6 +62,22 @@ Storing signatures
Loaded image(s): docker.io/library/alpine:latest
```
+```
+$ sudo podman image scp root@localhost::alpine username@localhost::
+Copying blob e2eb06d8af82 done
+Copying config 696d33ca15 done
+Writing manifest to image destination
+Storing signatures
+Run Directory Obtained: /run/user/1000/
+[Run Root: /var/tmp/containers-user-1000/containers Graph Root: /root/.local/share/containers/storage DB Path: /root/.local/share/containers/storage/libpod/bolt_state.db]
+Getting image source signatures
+Copying blob 5eb901baf107 skipped: already exists
+Copying config 696d33ca15 done
+Writing manifest to image destination
+Storing signatures
+Loaded image(s): docker.io/library/alpine:latest
+```
+
## SEE ALSO
podman(1), podman-load(1), podman-save(1), podman-remote(1), podman-system-connection-add(1), containers.conf(5), containers-transports(5)
diff --git a/docs/source/markdown/podman-pull.1.md b/docs/source/markdown/podman-pull.1.md
index 7fd9732d6..d91571799 100644
--- a/docs/source/markdown/podman-pull.1.md
+++ b/docs/source/markdown/podman-pull.1.md
@@ -234,7 +234,7 @@ Storing signatures
```
## SEE ALSO
-**[podman(1)](podman.1.md)**, **[podman-push(1)](podman-push.1.md)**, **[podman-login(1)](podman-login.1.md)**, **[containers-certs.d(5)](https://github.com/containers/image/blob/main/docs/containers-certs.d.5.md)**, **[containers-registries.conf(5)](https://github.com/containers/image/blob/main/docs/containers-registries.d.5.md)**, **[containers-transports(5)](https://github.com/containers/image/blob/main/docs/containers-transports.5.md)**
+**[podman(1)](podman.1.md)**, **[podman-push(1)](podman-push.1.md)**, **[podman-login(1)](podman-login.1.md)**, **[containers-certs.d(5)](https://github.com/containers/image/blob/main/docs/containers-certs.d.5.md)**, **[containers-registries.conf(5)](https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md)**, **[containers-transports(5)](https://github.com/containers/image/blob/main/docs/containers-transports.5.md)**
## HISTORY
July 2017, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>
diff --git a/docs/source/markdown/podman-run.1.md b/docs/source/markdown/podman-run.1.md
index a1170253f..68eb0f0e5 100644
--- a/docs/source/markdown/podman-run.1.md
+++ b/docs/source/markdown/podman-run.1.md
@@ -1314,6 +1314,15 @@ share the volume content. As a result, Podman labels the content with a shared
content label. Shared volume labels allow all containers to read/write content.
The **Z** option tells Podman to label the content with a private unshared label.
+Note: Do not relabel system files and directories. Relabeling system content
+might cause other confined services on your machine to fail. For these types
+of containers we recommend that disable SELinux separation. The option
+`--security-opt label=disable` disables SELinux separation for the container.
+For example if a user wanted to volume mount their entire home directory into a
+container, they need to disable SELinux separation.
+
+ $ podman run --security-opt label=disable -v $HOME:/home/user fedora touch /home/user/file
+
`Overlay Volume Mounts`
The `:O` flag tells Podman to mount the directory from the host as a
@@ -1882,8 +1891,7 @@ page.
NOTE: Use the environment variable `TMPDIR` to change the temporary storage location of downloaded container images. Podman defaults to use `/var/tmp`.
## SEE ALSO
-**podman**(1), **podman-save**(1), **podman-ps**(1), **podman-attach**(1), **podman-pod-create**(1), **podman-port**(1), **podman-start**(1), **podman-kill**(1), **podman-stop**(1),
-**podman-generate-systemd**(1) **podman-rm**(1), **subgid**(5), **subuid**(5), **containers.conf**(5), **systemd.unit**(5), **setsebool**(8), **slirp4netns**(1), **fuse-overlayfs**(1), **proc**(5), **conmon**(8), **personality**(2).
+**[podman(1)](podman.1.md)**, **[podman-save(1)](podman-save.1.md)**, **[podman-ps(1)](podman-ps.1.md)**, **[podman-attach(1)](podman-attach.1.md)**, **[podman-pod-create(1)](podman-create.1.md)**, **[podman-port(1)](podman--port.1.md)**, **[podman-start(1)](podman-start.1.md)**, **[podman-kill(1)](podman-kill.1.md)**, **[podman-stop(1)](podman-stop.1.md)**, **[podman-generate-systemd(1)](podman-generate-systemd.1.md)**, **[podman-rm(1)](podman-rm.1.md)**, **[subgid(5)](https://www.unix.com/man-page/linux/5/subuid)**, **[subuid(5)](https://www.unix.com/man-page/linux/5/subuid)**, **[containers.conf(5)]https://github.com/containers/common/blob/main/docs/containers.conf.5.md**, **[systemd.unit(5)](https://www.freedesktop.org/software/systemd/man/systemd.unit.html)**, **[setsebool(8)](https://man7.org/linux/man-pages/man8/setsebool.8.html)**, **[slirp4netns(1)](https://github.com/rootless-containers/slirp4netns/blob/master/slirp4netns.1.md)**, **[fuse-overlayfs(1)](https://github.com/containers/fuse-overlayfs/blob/main/fuse-overlayfs.1.md)**, **proc(5)**, **[conmon(8)](https://github.com/containers/conmon/blob/main/docs/conmon.5.md)**, **personality(2)**.
## HISTORY
September 2018, updated by Kunal Kushwaha `<kushwaha_kunal_v7@lab.ntt.co.jp>`
diff --git a/docs/source/markdown/podman-system-connection-remove.1.md b/docs/source/markdown/podman-system-connection-remove.1.md
index faa767176..0af05649c 100644
--- a/docs/source/markdown/podman-system-connection-remove.1.md
+++ b/docs/source/markdown/podman-system-connection-remove.1.md
@@ -4,11 +4,17 @@
podman\-system\-connection\-remove - Delete named destination
## SYNOPSIS
-**podman system connection remove** *name*
+**podman system connection remove** [*options*] *name*
## DESCRIPTION
Delete named ssh destination.
+## OPTIONS
+
+#### **--all**=*false*, **-a**
+
+Remove all connections.
+
## EXAMPLE
```
$ podman system connection remove production
diff --git a/go.mod b/go.mod
index fc66db35f..91c13f596 100644
--- a/go.mod
+++ b/go.mod
@@ -12,7 +12,7 @@ require (
github.com/containernetworking/cni v1.0.1
github.com/containernetworking/plugins v1.0.1
github.com/containers/buildah v1.23.1
- github.com/containers/common v0.46.1-0.20211026130826-7abfd453c86f
+ github.com/containers/common v0.46.1-0.20211109131927-c342e496bf76
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.16.1
github.com/containers/ocicrypt v1.1.2
@@ -45,7 +45,7 @@ require (
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
github.com/mrunalp/fileutils v0.5.0
github.com/onsi/ginkgo v1.16.5
- github.com/onsi/gomega v1.16.0
+ github.com/onsi/gomega v1.17.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.2-0.20210819154149-5ad6f50d6283
github.com/opencontainers/runc v1.0.2
@@ -67,7 +67,10 @@ require (
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0
+ gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
k8s.io/api v0.22.3
k8s.io/apimachinery v0.22.3
)
+
+replace github.com/onsi/gomega => github.com/onsi/gomega v1.16.0
diff --git a/go.sum b/go.sum
index a4029058c..4329531be 100644
--- a/go.sum
+++ b/go.sum
@@ -258,8 +258,8 @@ github.com/containernetworking/plugins v1.0.1/go.mod h1:QHCfGpaTwYTbbH+nZXKVTxNB
github.com/containers/buildah v1.23.1 h1:Tpc9DsRuU+0Oofewpxb6OJVNQjCu7yloN/obUqzfDTY=
github.com/containers/buildah v1.23.1/go.mod h1:4WnrN0yrA7ab0ppgunixu2WM1rlD2rG8QLJAKbEkZlQ=
github.com/containers/common v0.44.2/go.mod h1:7sdP4vmI5Bm6FPFxb3lvAh1Iktb6tiO1MzjUzhxdoGo=
-github.com/containers/common v0.46.1-0.20211026130826-7abfd453c86f h1:jFFIV8QvsPgwkJHh3tjfREFRwSeMq5M8lt8vklkZaOk=
-github.com/containers/common v0.46.1-0.20211026130826-7abfd453c86f/go.mod h1:pVvmLTLCOZE300e4rex/QDmpnRmEM/5aZ/YfCkkjgZo=
+github.com/containers/common v0.46.1-0.20211109131927-c342e496bf76 h1:5aDACNS6Rz+6f6rpgbv5tVG/zv1rFoPX1CYAy4Vv6ZI=
+github.com/containers/common v0.46.1-0.20211109131927-c342e496bf76/go.mod h1:bu8gizEkgAz6gXHvUw2cMtI5ErxB+fn/hv49RWk5N1A=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/image/v5 v5.16.0/go.mod h1:XgTpfAPLRGOd1XYyCU5cISFr777bLmOerCSpt/v7+Q4=
@@ -735,7 +735,6 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -747,15 +746,6 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
-github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
-github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
-github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
-github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
-github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
-github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
-github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c=
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
@@ -1099,12 +1089,10 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
-golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
-golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
diff --git a/hack/install_catatonit.sh b/hack/install_catatonit.sh
index 8837db3a8..0a02b75ab 100755
--- a/hack/install_catatonit.sh
+++ b/hack/install_catatonit.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
BASE_PATH="/usr/libexec/podman"
CATATONIT_PATH="${BASE_PATH}/catatonit"
-CATATONIT_VERSION="v0.1.4"
+CATATONIT_VERSION="v0.1.7"
set -e
if [ -f $CATATONIT_PATH ]; then
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 19b48e14b..fbc2c1f38 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -496,9 +496,27 @@ func (c *Container) setupStorage(ctx context.Context) error {
c.setupStorageMapping(&options.IDMappingOptions, &c.config.IDMappings)
- containerInfo, err := c.runtime.storageService.CreateContainerStorage(ctx, c.runtime.imageContext, c.config.RootfsImageName, c.config.RootfsImageID, c.config.Name, c.config.ID, options)
- if err != nil {
- return errors.Wrapf(err, "error creating container storage")
+ // Unless the user has specified a name, use a randomly generated one.
+ // Note that name conflicts may occur (see #11735), so we need to loop.
+ generateName := c.config.Name == ""
+ var containerInfo ContainerInfo
+ var containerInfoErr error
+ for {
+ if generateName {
+ name, err := c.runtime.generateName()
+ if err != nil {
+ return err
+ }
+ c.config.Name = name
+ }
+ containerInfo, containerInfoErr = c.runtime.storageService.CreateContainerStorage(ctx, c.runtime.imageContext, c.config.RootfsImageName, c.config.RootfsImageID, c.config.Name, c.config.ID, options)
+
+ if !generateName || errors.Cause(containerInfoErr) != storage.ErrDuplicateName {
+ break
+ }
+ }
+ if containerInfoErr != nil {
+ return errors.Wrapf(containerInfoErr, "error creating container storage")
}
// only reconfig IDMappings if layer was mounted from storage
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 2fd519990..3187724ca 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -21,6 +21,7 @@ import (
"time"
metadata "github.com/checkpoint-restore/checkpointctl/lib"
+ "github.com/checkpoint-restore/go-criu/v5/stats"
cdi "github.com/container-orchestrated-devices/container-device-interface/pkg"
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containers/buildah/pkg/chrootuser"
@@ -1013,6 +1014,7 @@ func (c *Container) exportCheckpoint(options ContainerCheckpointOptions) error {
metadata.ConfigDumpFile,
metadata.SpecDumpFile,
metadata.NetworkStatusFile,
+ stats.StatsDump,
}
if c.LogDriver() == define.KubernetesLogging ||
@@ -1197,7 +1199,7 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO
if !options.Keep && !options.PreCheckPoint {
cleanup := []string{
"dump.log",
- "stats-dump",
+ stats.StatsDump,
metadata.ConfigDumpFile,
metadata.SpecDumpFile,
}
@@ -1564,8 +1566,8 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
cleanup := [...]string{
"restore.log",
"dump.log",
- "stats-dump",
- "stats-restore",
+ stats.StatsDump,
+ stats.StatsRestore,
metadata.NetworkStatusFile,
metadata.RootFsDiffTar,
metadata.DeletedFilesFile,
diff --git a/libpod/lock/shm/shm_lock.go b/libpod/lock/shm/shm_lock.go
index 322e92a8f..fea02a619 100644
--- a/libpod/lock/shm/shm_lock.go
+++ b/libpod/lock/shm/shm_lock.go
@@ -130,8 +130,17 @@ func (locks *SHMLocks) AllocateSemaphore() (uint32, error) {
// semaphore indexes, and can still return error codes.
retCode := C.allocate_semaphore(locks.lockStruct)
if retCode < 0 {
+ var err = syscall.Errno(-1 * retCode)
// Negative errno returned
- return 0, syscall.Errno(-1 * retCode)
+ if errors.Is(err, syscall.ENOSPC) {
+ // ENOSPC expands to "no space left on device". While it is technically true
+ // that there's no room in the SHM inn for this lock, this tends to send normal people
+ // down the path of checking disk-space which is not actually their problem.
+ // Give a clue that it's actually due to num_locks filling up.
+ var errFull = errors.Errorf("allocation failed; exceeded num_locks (%d)", locks.maxLocks)
+ return uint32(retCode), errFull
+ }
+ return uint32(retCode), syscall.Errno(-1 * retCode)
}
return uint32(retCode), nil
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 0a7db33f1..114bf9315 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -326,15 +326,6 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
}
}
- if ctr.config.Name == "" {
- name, err := r.generateName()
- if err != nil {
- return nil, err
- }
-
- ctr.config.Name = name
- }
-
// Check CGroup parent sanity, and set it if it was not set.
// Only if we're actually configuring CGroups.
if !ctr.config.NoCgroups {
diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go
index 7d7fef4d1..15050ef48 100644
--- a/libpod/runtime_pod_linux.go
+++ b/libpod/runtime_pod_linux.go
@@ -43,18 +43,6 @@ func (r *Runtime) NewPod(ctx context.Context, p specgen.PodSpecGenerator, option
}
}
- if pod.config.Name == "" {
- name, err := r.generateName()
- if err != nil {
- return nil, err
- }
- pod.config.Name = name
- }
-
- if p.InfraContainerSpec != nil && p.InfraContainerSpec.Hostname == "" {
- p.InfraContainerSpec.Hostname = pod.config.Name
- }
-
// Allocate a lock for the pod
lock, err := r.lockManager.AllocateLock()
if err != nil {
@@ -131,9 +119,33 @@ func (r *Runtime) NewPod(ctx context.Context, p specgen.PodSpecGenerator, option
logrus.Infof("Pod has an infra container, but shares no namespaces")
}
- if err := r.state.AddPod(pod); err != nil {
- return nil, errors.Wrapf(err, "error adding pod to state")
+ // Unless the user has specified a name, use a randomly generated one.
+ // Note that name conflicts may occur (see #11735), so we need to loop.
+ generateName := pod.config.Name == ""
+ var addPodErr error
+ for {
+ if generateName {
+ name, err := r.generateName()
+ if err != nil {
+ return nil, err
+ }
+ pod.config.Name = name
+ }
+
+ if p.InfraContainerSpec != nil && p.InfraContainerSpec.Hostname == "" {
+ p.InfraContainerSpec.Hostname = pod.config.Name
+ }
+ if addPodErr = r.state.AddPod(pod); addPodErr == nil {
+ return pod, nil
+ }
+ if !generateName || (errors.Cause(addPodErr) != define.ErrPodExists && errors.Cause(addPodErr) != define.ErrCtrExists) {
+ break
+ }
+ }
+ if addPodErr != nil {
+ return nil, errors.Wrapf(addPodErr, "error adding pod to state")
}
+
return pod, nil
}
diff --git a/nix/default-arm64.nix b/nix/default-arm64.nix
index bb958a193..fa076f27d 100644
--- a/nix/default-arm64.nix
+++ b/nix/default-arm64.nix
@@ -59,7 +59,8 @@ let
self = with pkgs; buildGoModule rec {
name = "podman";
- src = ./..;
+ src = builtins.filterSource
+ (path: type: !(type == "directory" && baseNameOf path == "bin")) ./..;
vendorSha256 = null;
doCheck = false;
enableParallelBuilding = true;
diff --git a/nix/default.nix b/nix/default.nix
index 1dc6f92b6..30ae21503 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -57,7 +57,8 @@ let
self = with pkgs; buildGoModule rec {
name = "podman";
- src = ./..;
+ src = builtins.filterSource
+ (path: type: !(type == "directory" && baseNameOf path == "bin")) ./..;
vendorSha256 = null;
doCheck = false;
enableParallelBuilding = true;
diff --git a/pkg/checkpoint/checkpoint_restore.go b/pkg/checkpoint/checkpoint_restore.go
index 637f1c0e8..da82c9745 100644
--- a/pkg/checkpoint/checkpoint_restore.go
+++ b/pkg/checkpoint/checkpoint_restore.go
@@ -6,6 +6,7 @@ import (
"os"
metadata "github.com/checkpoint-restore/checkpointctl/lib"
+ "github.com/checkpoint-restore/go-criu/v5/stats"
"github.com/containers/common/libimage"
"github.com/containers/common/pkg/config"
"github.com/containers/podman/v3/libpod"
@@ -39,6 +40,7 @@ func CRImportCheckpoint(ctx context.Context, runtime *libpod.Runtime, restoreOpt
"volumes",
"ctr.log",
"artifacts",
+ stats.StatsDump,
metadata.RootFsDiffTar,
metadata.DeletedFilesFile,
metadata.NetworkStatusFile,
diff --git a/pkg/domain/entities/engine_image.go b/pkg/domain/entities/engine_image.go
index b0f9ae408..d72f64b5e 100644
--- a/pkg/domain/entities/engine_image.go
+++ b/pkg/domain/entities/engine_image.go
@@ -27,6 +27,7 @@ type ImageEngine interface {
ShowTrust(ctx context.Context, args []string, options ShowTrustOptions) (*ShowTrustReport, error)
Shutdown(ctx context.Context)
Tag(ctx context.Context, nameOrID string, tags []string, options ImageTagOptions) error
+ Transfer(ctx context.Context, scpOpts ImageScpOptions) error
Tree(ctx context.Context, nameOrID string, options ImageTreeOptions) (*ImageTreeReport, error)
Unmount(ctx context.Context, images []string, options ImageUnmountOptions) ([]*ImageUnmountReport, error)
Untag(ctx context.Context, nameOrID string, tags []string, options ImageUntagOptions) error
diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go
index 38cdc8f2f..7583ce442 100644
--- a/pkg/domain/entities/images.go
+++ b/pkg/domain/entities/images.go
@@ -329,6 +329,10 @@ type ImageScpOptions struct {
Save ImageSaveOptions
// Load options used for the second half of the scp operation
Load ImageLoadOptions
+ // Rootless determines whether we are loading locally from root storage to rootless storage
+ Rootless bool
+ // User is used in conjunction with Rootless to determine which user to use to obtain the uid
+ User string
}
// ImageTreeOptions provides options for ImageEngine.Tree()
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go
index 7aa202334..5c0227986 100644
--- a/pkg/domain/infra/abi/images.go
+++ b/pkg/domain/infra/abi/images.go
@@ -6,9 +6,12 @@ import (
"io/ioutil"
"net/url"
"os"
+ "os/exec"
+ "os/user"
"path"
"path/filepath"
"strconv"
+ "strings"
"github.com/containers/common/libimage"
"github.com/containers/common/pkg/config"
@@ -18,6 +21,7 @@ import (
"github.com/containers/image/v5/signature"
"github.com/containers/image/v5/transports"
"github.com/containers/image/v5/transports/alltransports"
+ "github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/domain/entities/reports"
domainUtils "github.com/containers/podman/v3/pkg/domain/utils"
@@ -330,6 +334,67 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
return pushError
}
+// Transfer moves images from root to rootless storage so the user specified in the scp call can access and use the image modified by root
+func (ir *ImageEngine) Transfer(ctx context.Context, scpOpts entities.ImageScpOptions) error {
+ if scpOpts.User == "" {
+ return errors.Wrapf(define.ErrInvalidArg, "you must define a user when transferring from root to rootless storage")
+ }
+ var u *user.User
+ scpOpts.User = strings.Split(scpOpts.User, ":")[0] // split in case provided with uid:gid
+ _, err := strconv.Atoi(scpOpts.User)
+ if err != nil {
+ u, err = user.Lookup(scpOpts.User)
+ if err != nil {
+ return err
+ }
+ } else {
+ u, err = user.LookupId(scpOpts.User)
+ if err != nil {
+ return err
+ }
+ }
+ uid, err := strconv.Atoi(u.Uid)
+ if err != nil {
+ return err
+ }
+ gid, err := strconv.Atoi(u.Gid)
+ if err != nil {
+ return err
+ }
+ err = os.Chown(scpOpts.Save.Output, uid, gid) // chown the output because was created by root so we need to give th euser read access
+ if err != nil {
+ return err
+ }
+
+ podman, err := os.Executable()
+ if err != nil {
+ return err
+ }
+ machinectl, err := exec.LookPath("machinectl")
+ if err != nil {
+ logrus.Warn("defaulting to su since machinectl is not available, su will fail if no user session is available")
+ cmd := exec.Command("su", "-l", u.Username, "--command", podman+" --log-level="+logrus.GetLevel().String()+" --cgroup-manager=cgroupfs load --input="+scpOpts.Save.Output) // load the new image to the rootless storage
+ cmd.Stderr = os.Stderr
+ cmd.Stdout = os.Stdout
+ logrus.Debug("Executing load command su")
+ err = cmd.Run()
+ if err != nil {
+ return err
+ }
+ } else {
+ cmd := exec.Command(machinectl, "shell", "-q", u.Username+"@.host", podman, "--log-level="+logrus.GetLevel().String(), "--cgroup-manager=cgroupfs", "load", "--input", scpOpts.Save.Output) // load the new image to the rootless storage
+ cmd.Stderr = os.Stderr
+ cmd.Stdout = os.Stdout
+ logrus.Debug("Executing load command machinectl")
+ err = cmd.Run()
+ if err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, options entities.ImageTagOptions) error {
// Allow tagging manifest list instead of resolving instances from manifest
lookupOptions := &libimage.LookupImageOptions{ManifestList: true}
diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go
index e17f746a5..fde57972f 100644
--- a/pkg/domain/infra/tunnel/images.go
+++ b/pkg/domain/infra/tunnel/images.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/docker/reference"
"github.com/containers/image/v5/types"
+ "github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/bindings/images"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/domain/entities/reports"
@@ -122,6 +123,10 @@ func (ir *ImageEngine) Pull(ctx context.Context, rawImage string, opts entities.
return &entities.ImagePullReport{Images: pulledImages}, nil
}
+func (ir *ImageEngine) Transfer(ctx context.Context, scpOpts entities.ImageScpOptions) error {
+ return errors.Wrapf(define.ErrNotImplemented, "cannot use the remote client to transfer images between root and rootless storage")
+}
+
func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, opt entities.ImageTagOptions) error {
options := new(images.TagOptions)
for _, newTag := range tags {
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index a8efe1ca9..be6b782b5 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -5,9 +5,11 @@ import (
"net"
"os"
"os/exec"
+ "path/filepath"
"strings"
"time"
+ "github.com/checkpoint-restore/go-criu/v5/stats"
"github.com/containers/podman/v3/pkg/checkpoint/crutils"
"github.com/containers/podman/v3/pkg/criu"
. "github.com/containers/podman/v3/test/utils"
@@ -1191,4 +1193,55 @@ var _ = Describe("Podman checkpoint", func() {
// Remove exported checkpoint
os.Remove(fileName)
})
+
+ It("podman checkpoint container with export and statistics", func() {
+ localRunString := getRunString([]string{
+ "--rm",
+ ALPINE,
+ "top",
+ })
+ session := podmanTest.Podman(localRunString)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ cid := session.OutputToString()
+ fileName := "/tmp/checkpoint-" + cid + ".tar.gz"
+
+ result := podmanTest.Podman([]string{
+ "container",
+ "checkpoint",
+ "-l", "-e",
+ fileName,
+ })
+ result.WaitWithDefaultTimeout()
+
+ // As the container has been started with '--rm' it will be completely
+ // cleaned up after checkpointing.
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Extract checkpoint archive
+ destinationDirectory, err := CreateTempDirInTempDir()
+ Expect(err).ShouldNot(HaveOccurred())
+
+ tarsession := SystemExec(
+ "tar",
+ []string{
+ "xf",
+ fileName,
+ "-C",
+ destinationDirectory,
+ },
+ )
+ Expect(tarsession).Should(Exit(0))
+
+ _, err = os.Stat(filepath.Join(destinationDirectory, stats.StatsDump))
+ Expect(err).ShouldNot(HaveOccurred())
+
+ Expect(os.RemoveAll(destinationDirectory)).To(BeNil())
+
+ // Remove exported checkpoint
+ os.Remove(fileName)
+ })
})
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index e598f7ab9..200faae2d 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -208,9 +208,7 @@ var _ = SynchronizedAfterSuite(func() {},
// PodmanTestCreate creates a PodmanTestIntegration instance for the tests
func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
- var (
- podmanRemoteBinary string
- )
+ var podmanRemoteBinary string
host := GetHostDistributionInfo()
cwd, _ := os.Getwd()
@@ -220,12 +218,11 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
podmanBinary = os.Getenv("PODMAN_BINARY")
}
- if remote {
- podmanRemoteBinary = filepath.Join(cwd, "../../bin/podman-remote")
- if os.Getenv("PODMAN_REMOTE_BINARY") != "" {
- podmanRemoteBinary = os.Getenv("PODMAN_REMOTE_BINARY")
- }
+ podmanRemoteBinary = filepath.Join(cwd, "../../bin/podman-remote")
+ if os.Getenv("PODMAN_REMOTE_BINARY") != "" {
+ podmanRemoteBinary = os.Getenv("PODMAN_REMOTE_BINARY")
}
+
conmonBinary := filepath.Join("/usr/libexec/podman/conmon")
altConmonBinary := "/usr/bin/conmon"
if _, err := os.Stat(conmonBinary); os.IsNotExist(err) {
@@ -271,12 +268,13 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
p := &PodmanTestIntegration{
PodmanTest: PodmanTest{
- PodmanBinary: podmanBinary,
- ArtifactPath: ARTIFACT_DIR,
- TempDir: tempDir,
- RemoteTest: remote,
- ImageCacheFS: storageFs,
- ImageCacheDir: ImageCacheDir,
+ PodmanBinary: podmanBinary,
+ RemotePodmanBinary: podmanRemoteBinary,
+ ArtifactPath: ARTIFACT_DIR,
+ TempDir: tempDir,
+ RemoteTest: remote,
+ ImageCacheFS: storageFs,
+ ImageCacheDir: ImageCacheDir,
},
ConmonBinary: conmonBinary,
CrioRoot: filepath.Join(tempDir, "crio"),
@@ -289,8 +287,8 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
CgroupManager: cgroupManager,
Host: host,
}
+
if remote {
- p.PodmanTest.RemotePodmanBinary = podmanRemoteBinary
uuid := stringid.GenerateNonCryptoID()
if !rootless.IsRootless() {
p.RemoteSocket = fmt.Sprintf("unix:/run/podman/podman-%s.sock", uuid)
@@ -632,6 +630,19 @@ func SkipIfNotRootless(reason string) {
}
}
+func SkipIfSystemdNotRunning(reason string) {
+ checkReason(reason)
+
+ cmd := exec.Command("systemctl", "list-units")
+ err := cmd.Run()
+ if err != nil {
+ if _, ok := err.(*exec.Error); ok {
+ ginkgo.Skip("[notSystemd]: not running " + reason)
+ }
+ Expect(err).ToNot(HaveOccurred())
+ }
+}
+
func SkipIfNotSystemd(manager, reason string) {
checkReason(reason)
if manager != "systemd" {
@@ -683,6 +694,41 @@ func SkipIfContainerized(reason string) {
}
}
+func SkipIfRemote(reason string) {
+ checkReason(reason)
+ if !IsRemote() {
+ return
+ }
+ ginkgo.Skip("[remote]: " + reason)
+}
+
+// SkipIfInContainer skips a test if the test is run inside a container
+func SkipIfInContainer(reason string) {
+ checkReason(reason)
+ if os.Getenv("TEST_ENVIRON") == "container" {
+ Skip("[container]: " + reason)
+ }
+}
+
+// SkipIfNotActive skips a test if the given systemd unit is not active
+func SkipIfNotActive(unit string, reason string) {
+ checkReason(reason)
+
+ var buffer bytes.Buffer
+ cmd := exec.Command("systemctl", "is-active", unit)
+ cmd.Stdout = &buffer
+ err := cmd.Start()
+ Expect(err).ToNot(HaveOccurred())
+
+ err = cmd.Wait()
+ Expect(err).ToNot(HaveOccurred())
+
+ Expect(err).ToNot(HaveOccurred())
+ if strings.TrimSpace(buffer.String()) != "active" {
+ Skip(fmt.Sprintf("[systemd]: unit %s is not active: %s", unit, reason))
+ }
+}
+
// PodmanAsUser is the exec call to podman on the filesystem with the specified uid/gid and environment
func (p *PodmanTestIntegration) PodmanAsUser(args []string, uid, gid uint32, cwd string, env []string) *PodmanSessionIntegration {
podmanSession := p.PodmanAsUserBase(args, uid, gid, cwd, env, false, false, nil, nil)
diff --git a/test/e2e/config/containers-netns.conf b/test/e2e/config/containers-netns.conf
new file mode 100644
index 000000000..3f796f25d
--- /dev/null
+++ b/test/e2e/config/containers-netns.conf
@@ -0,0 +1,3 @@
+[containers]
+
+netns = "host"
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index b2666c789..c9a6f926f 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -52,6 +52,18 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(125))
})
+ It("podman healthcheck from image's config (not container config)", func() {
+ // Regression test for #12226: a health check may be defined in
+ // the container or the container-config of an image.
+ session := podmanTest.Podman([]string{"create", "--name", "hc", "quay.io/libpod/healthcheck:config-only", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ hc := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Healthcheck}}", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc).Should(Exit(0))
+ Expect(hc.OutputToString()).To(Equal("{[CMD-SHELL curl -f http://localhost/ || exit 1] 0s 5m0s 3s 0}"))
+ })
+
It("podman disable healthcheck with --health-cmd=none on valid container", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--health-cmd", "none", "--name", "hc", healthcheck})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/image_scp_test.go b/test/e2e/image_scp_test.go
index 9fd8d7e27..acea2993d 100644
--- a/test/e2e/image_scp_test.go
+++ b/test/e2e/image_scp_test.go
@@ -22,12 +22,14 @@ var _ = Describe("podman image scp", func() {
)
BeforeEach(func() {
+
ConfPath.Value, ConfPath.IsSet = os.LookupEnv("CONTAINERS_CONF")
conf, err := ioutil.TempFile("", "containersconf")
if err != nil {
panic(err)
}
os.Setenv("CONTAINERS_CONF", conf.Name())
+
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
@@ -38,6 +40,7 @@ var _ = Describe("podman image scp", func() {
AfterEach(func() {
podmanTest.Cleanup()
+
os.Remove(os.Getenv("CONTAINERS_CONF"))
if ConfPath.IsSet {
os.Setenv("CONTAINERS_CONF", ConfPath.Value)
@@ -58,6 +61,25 @@ var _ = Describe("podman image scp", func() {
Expect(scp).To(Exit(0))
})
+ It("podman image scp root to rootless transfer", func() {
+ SkipIfNotRootless("this is a rootless only test, transfering from root to rootless using PodmanAsUser")
+ if IsRemote() {
+ Skip("this test is only for non-remote")
+ }
+ env := os.Environ()
+ img := podmanTest.PodmanAsUser([]string{"image", "pull", ALPINE}, 0, 0, "", env) // pull image to root
+ img.WaitWithDefaultTimeout()
+ Expect(img).To(Exit(0))
+ scp := podmanTest.PodmanAsUser([]string{"image", "scp", "root@localhost::" + ALPINE, "1000:1000@localhost::"}, 0, 0, "", env) //transfer from root to rootless (us)
+ scp.WaitWithDefaultTimeout()
+ Expect(scp).To(Exit(0))
+
+ list := podmanTest.Podman([]string{"image", "list"}) // our image should now contain alpine loaded in from root
+ list.WaitWithDefaultTimeout()
+ Expect(list).To(Exit(0))
+ Expect(list.LineInOutputStartsWith("quay.io/libpod/alpine")).To(BeTrue())
+ })
+
It("podman image scp bogus image", func() {
if IsRemote() {
Skip("this test is only for non-remote")
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index ad511cc9e..1fa29daa1 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -16,20 +16,12 @@ import (
"time"
"github.com/containers/podman/v3/pkg/rootless"
- "github.com/onsi/ginkgo"
)
func IsRemote() bool {
return true
}
-func SkipIfRemote(reason string) {
- if len(reason) < 5 {
- panic("SkipIfRemote must specify a reason to skip")
- }
- ginkgo.Skip("[remote]: " + reason)
-}
-
// Podman is the exec call to podman on the filesystem
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
var remoteArgs = []string{"--remote", "--url", p.RemoteSocket}
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 6d2d3fee8..001a869b1 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -16,9 +16,6 @@ func IsRemote() bool {
return false
}
-func SkipIfRemote(string) {
-}
-
// Podman is the exec call to podman on the filesystem
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
podmanSession := p.PodmanBase(args, false, false)
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 34e879ed4..12aeffd1b 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -957,4 +957,22 @@ ENTRYPOINT ["sleep","99999"]
Expect(ctr3.OutputToString()).To(ContainSubstring("hello"))
})
+ It("podman pod create read network mode from config", func() {
+ confPath, err := filepath.Abs("config/containers-netns.conf")
+ Expect(err).ToNot(HaveOccurred())
+ os.Setenv("CONTAINERS_CONF", confPath)
+ defer os.Unsetenv("CONTAINERS_CONF")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+
+ pod := podmanTest.Podman([]string{"pod", "create", "--name", "test", "--infra-name", "test-infra"})
+ pod.WaitWithDefaultTimeout()
+ Expect(pod).Should(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.HostConfig.NetworkMode}}", "test-infra"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ Expect(inspect.OutputToString()).Should(Equal("host"))
+ })
})
diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go
index 842ae8df6..c0e29d525 100644
--- a/test/e2e/system_connection_test.go
+++ b/test/e2e/system_connection_test.go
@@ -3,7 +3,11 @@ package integration
import (
"fmt"
"io/ioutil"
+ "net/url"
"os"
+ "os/exec"
+ "os/user"
+ "path/filepath"
"github.com/containers/common/pkg/config"
. "github.com/containers/podman/v3/test/utils"
@@ -19,22 +23,16 @@ var _ = Describe("podman system connection", func() {
IsSet bool
}{}
- var (
- podmanTest *PodmanTestIntegration
- )
+ var podmanTest *PodmanTestIntegration
BeforeEach(func() {
ConfPath.Value, ConfPath.IsSet = os.LookupEnv("CONTAINERS_CONF")
conf, err := ioutil.TempFile("", "containersconf")
- if err != nil {
- panic(err)
- }
+ Expect(err).ToNot(HaveOccurred())
os.Setenv("CONTAINERS_CONF", conf.Name())
tempdir, err := CreateTempDirInTempDir()
- if err != nil {
- panic(err)
- }
+ Expect(err).ToNot(HaveOccurred())
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
})
@@ -49,196 +47,241 @@ var _ = Describe("podman system connection", func() {
}
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ GinkgoWriter.Write(
+ []byte(
+ fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())))
})
- It("add ssh://", func() {
- cmd := []string{"system", "connection", "add",
- "--default",
- "--identity", "~/.ssh/id_rsa",
- "QA",
- "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
- }
- session := podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.Out).Should(Say(""))
-
- cfg, err := config.ReadCustomConfig()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(cfg.Engine.ActiveService).To(Equal("QA"))
- Expect(cfg.Engine.ServiceDestinations["QA"]).To(Equal(
- config.Destination{
- URI: "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
- Identity: "~/.ssh/id_rsa",
- },
- ))
-
- cmd = []string{"system", "connection", "rename",
- "QA",
- "QE",
- }
- session = podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
-
- cfg, err = config.ReadCustomConfig()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(cfg.Engine.ActiveService).To(Equal("QE"))
- Expect(cfg.Engine.ServiceDestinations["QE"]).To(Equal(
- config.Destination{
- URI: "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
- Identity: "~/.ssh/id_rsa",
- },
- ))
- })
+ Context("without running API service", func() {
+ It("add ssh://", func() {
+ cmd := []string{"system", "connection", "add",
+ "--default",
+ "--identity", "~/.ssh/id_rsa",
+ "QA",
+ "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
+ }
+ session := podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.Out.Contents()).Should(BeEmpty())
- It("add UDS", func() {
- cmd := []string{"system", "connection", "add",
- "QA-UDS",
- "unix:///run/podman/podman.sock",
- }
- session := podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.Out).Should(Say(""))
-
- cfg, err := config.ReadCustomConfig()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(cfg.Engine.ActiveService).To(Equal("QA-UDS"))
- Expect(cfg.Engine.ServiceDestinations["QA-UDS"]).To(Equal(
- config.Destination{
- URI: "unix:///run/podman/podman.sock",
- Identity: "",
- },
- ))
-
- cmd = []string{"system", "connection", "add",
- "QA-UDS1",
- "--socket-path", "/run/user/podman/podman.sock",
- "unix:///run/podman/podman.sock",
- }
- session = podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.Out).Should(Say(""))
-
- cfg, err = config.ReadCustomConfig()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(cfg.Engine.ActiveService).To(Equal("QA-UDS"))
- Expect(cfg.Engine.ServiceDestinations["QA-UDS1"]).To(Equal(
- config.Destination{
- URI: "unix:///run/user/podman/podman.sock",
- Identity: "",
- },
- ))
- })
+ cfg, err := config.ReadCustomConfig()
+ Expect(err).ShouldNot(HaveOccurred())
+ Expect(cfg).To(HaveActiveService("QA"))
+ Expect(cfg).Should(VerifyService(
+ "QA",
+ "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
+ "~/.ssh/id_rsa",
+ ))
- It("add tcp", func() {
- cmd := []string{"system", "connection", "add",
- "QA-TCP",
- "tcp://localhost:8888",
- }
- session := podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.Out).Should(Say(""))
-
- cfg, err := config.ReadCustomConfig()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(cfg.Engine.ActiveService).To(Equal("QA-TCP"))
- Expect(cfg.Engine.ServiceDestinations["QA-TCP"]).To(Equal(
- config.Destination{
- URI: "tcp://localhost:8888",
- Identity: "",
- },
- ))
- })
+ cmd = []string{"system", "connection", "rename",
+ "QA",
+ "QE",
+ }
+ session = podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
- It("remove", func() {
- cmd := []string{"system", "connection", "add",
- "--default",
- "--identity", "~/.ssh/id_rsa",
- "QA",
- "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
- }
- session := podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
+ Expect(config.ReadCustomConfig()).To(HaveActiveService("QE"))
+ })
- for i := 0; i < 2; i++ {
- cmd = []string{"system", "connection", "remove", "QA"}
+ It("add UDS", func() {
+ cmd := []string{"system", "connection", "add",
+ "QA-UDS",
+ "unix:///run/podman/podman.sock",
+ }
+ session := podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.Out.Contents()).Should(BeEmpty())
+
+ Expect(config.ReadCustomConfig()).Should(VerifyService(
+ "QA-UDS",
+ "unix:///run/podman/podman.sock",
+ "",
+ ))
+
+ cmd = []string{"system", "connection", "add",
+ "QA-UDS1",
+ "--socket-path", "/run/user/podman/podman.sock",
+ "unix:///run/podman/podman.sock",
+ }
session = podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(session.Out).Should(Say(""))
+ Expect(session.Out.Contents()).Should(BeEmpty())
- cfg, err := config.ReadCustomConfig()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(cfg.Engine.ActiveService).To(BeEmpty())
- Expect(cfg.Engine.ServiceDestinations).To(BeEmpty())
- }
- })
+ Expect(config.ReadCustomConfig()).Should(HaveActiveService("QA-UDS"))
+ Expect(config.ReadCustomConfig()).Should(VerifyService(
+ "QA-UDS1",
+ "unix:///run/user/podman/podman.sock",
+ "",
+ ))
+ })
- It("default", func() {
- for _, name := range []string{"devl", "qe"} {
+ It("add tcp", func() {
cmd := []string{"system", "connection", "add",
+ "QA-TCP",
+ "tcp://localhost:8888",
+ }
+ session := podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.Out.Contents()).Should(BeEmpty())
+
+ Expect(config.ReadCustomConfig()).Should(VerifyService(
+ "QA-TCP",
+ "tcp://localhost:8888",
+ "",
+ ))
+ })
+
+ It("remove", func() {
+ session := podmanTest.Podman([]string{"system", "connection", "add",
+ "--default",
+ "--identity", "~/.ssh/id_rsa",
+ "QA",
+ "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
+ })
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ // two passes to test that removing non-existent connection is not an error
+ for i := 0; i < 2; i++ {
+ session = podmanTest.Podman([]string{"system", "connection", "remove", "QA"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.Out.Contents()).Should(BeEmpty())
+
+ cfg, err := config.ReadCustomConfig()
+ Expect(err).ShouldNot(HaveOccurred())
+ Expect(cfg.Engine.ActiveService).To(BeEmpty())
+ Expect(cfg.Engine.ServiceDestinations).To(BeEmpty())
+ }
+ })
+
+ It("remove --all", func() {
+ session := podmanTest.Podman([]string{"system", "connection", "add",
"--default",
"--identity", "~/.ssh/id_rsa",
- name,
+ "QA",
"ssh://root@server.fubar.com:2222/run/podman/podman.sock",
+ })
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"system", "connection", "remove", "--all"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.Out.Contents()).Should(BeEmpty())
+ Expect(session.Err.Contents()).Should(BeEmpty())
+
+ session = podmanTest.Podman([]string{"system", "connection", "list"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ })
+
+ It("default", func() {
+ for _, name := range []string{"devl", "qe"} {
+ cmd := []string{"system", "connection", "add",
+ "--default",
+ "--identity", "~/.ssh/id_rsa",
+ name,
+ "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
+ }
+ session := podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
}
+
+ cmd := []string{"system", "connection", "default", "devl"}
session := podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- }
+ Expect(session.Out.Contents()).Should(BeEmpty())
- cmd := []string{"system", "connection", "default", "devl"}
- session := podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.Out).Should(Say(""))
-
- cfg, err := config.ReadCustomConfig()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(cfg.Engine.ActiveService).To(Equal("devl"))
-
- cmd = []string{"system", "connection", "list"}
- session = podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.Out).Should(Say("Name *URI *Identity *Default"))
-
- cmd = []string{"system", "connection", "list", "--format", "{{.Name}}"}
- session = podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.OutputToString()).Should(Equal("devl qe"))
- })
+ Expect(config.ReadCustomConfig()).Should(HaveActiveService("devl"))
- It("failed default", func() {
- cmd := []string{"system", "connection", "default", "devl"}
- session := podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).ShouldNot(Exit(0))
- Expect(session.Err).Should(Say("destination is not defined"))
- })
+ cmd = []string{"system", "connection", "list"}
+ session = podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.Out).Should(Say("Name *URI *Identity *Default"))
+
+ cmd = []string{"system", "connection", "list", "--format", "{{.Name}}"}
+ session = podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).Should(Equal("devl qe"))
+ })
+
+ It("failed default", func() {
+ cmd := []string{"system", "connection", "default", "devl"}
+ session := podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).ShouldNot(Exit(0))
+ Expect(session.Err).Should(Say("destination is not defined"))
+ })
+
+ It("failed rename", func() {
+ cmd := []string{"system", "connection", "rename", "devl", "QE"}
+ session := podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).ShouldNot(Exit(0))
+ Expect(session.Err).Should(Say("destination is not defined"))
+ })
- It("failed rename", func() {
- cmd := []string{"system", "connection", "rename", "devl", "QE"}
- session := podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).ShouldNot(Exit(0))
- Expect(session.Err).Should(Say("destination is not defined"))
+ It("empty list", func() {
+ cmd := []string{"system", "connection", "list"}
+ session := podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.Out.Contents()).Should(BeEmpty())
+ Expect(session.Err.Contents()).Should(BeEmpty())
+ })
})
- It("empty list", func() {
- cmd := []string{"system", "connection", "list"}
- session := podmanTest.Podman(cmd)
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.Out).Should(Say(""))
- Expect(session.Err).Should(Say(""))
+ Context("sshd and API services required", func() {
+ BeforeEach(func() {
+ // These tests are unique in as much as they require podman, podman-remote, systemd and sshd.
+ // podman-remote commands will be executed by ginkgo directly.
+ SkipIfContainerized("sshd is not available when running in a container")
+ SkipIfRemote("connection heuristic requires both podman and podman-remote binaries")
+ SkipIfNotRootless("FIXME: setup ssh keys when root")
+ SkipIfSystemdNotRunning("cannot test connection heuristic if systemd is not running")
+ SkipIfNotActive("sshd", "cannot test connection heuristic if sshd is not running")
+ })
+
+ It("add ssh:// socket path using connection heuristic", func() {
+ u, err := user.Current()
+ Expect(err).ShouldNot(HaveOccurred())
+
+ cmd := exec.Command(podmanTest.RemotePodmanBinary,
+ "system", "connection", "add",
+ "--default",
+ "--identity", filepath.Join(u.HomeDir, ".ssh", "id_ed25519"),
+ "QA",
+ fmt.Sprintf("ssh://%s@localhost", u.Username))
+
+ session, err := Start(cmd, GinkgoWriter, GinkgoWriter)
+ Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("%q failed to execute", podmanTest.RemotePodmanBinary))
+ Eventually(session, DefaultWaitTimeout).Should(Exit(0))
+ Expect(session.Out.Contents()).Should(BeEmpty())
+ Expect(session.Err.Contents()).Should(BeEmpty())
+
+ uri := url.URL{
+ Scheme: "ssh",
+ User: url.User(u.Username),
+ Host: "localhost:22",
+ Path: fmt.Sprintf("/run/user/%s/podman/podman.sock", u.Uid),
+ }
+
+ Expect(config.ReadCustomConfig()).Should(HaveActiveService("QA"))
+ Expect(config.ReadCustomConfig()).Should(VerifyService(
+ "QA",
+ uri.String(),
+ filepath.Join(u.HomeDir, ".ssh", "id_ed25519"),
+ ))
+ })
})
})
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index 78b8ecdfd..03f07d602 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -120,9 +120,7 @@ function setup() {
fi
run_podman 125 --remote
- is "$output" "Error: missing command 'podman COMMAND'
-Try 'podman --help' for more information." \
- "podman --remote show usage message without running endpoint"
+ is "$output" ".*Usage:" "podman --remote show usage message without running endpoint"
}
# This is for development only; it's intended to make sure our timeout
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index b0795b524..a87081687 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -149,12 +149,12 @@ function check_help() {
count=$(expr $count + 1)
done
- # Any command that takes subcommands, must throw error if called
+ # Any command that takes subcommands, prints its help and errors if called
# without one.
dprint "podman $@"
run_podman '?' "$@"
is "$status" 125 "'podman $*' without any subcommand - exit status"
- is "$output" "Error: missing command .*$@ COMMAND" \
+ is "$output" ".*Usage:.*Error: missing command '.*$@ COMMAND'" \
"'podman $*' without any subcommand - expected error message"
# Assume that 'NoSuchCommand' is not a command
diff --git a/test/system/272-system-connection.bats b/test/system/272-system-connection.bats
index 5a90d9398..14c4f6664 100644
--- a/test/system/272-system-connection.bats
+++ b/test/system/272-system-connection.bats
@@ -34,10 +34,7 @@ function teardown() {
| xargs -l1 --no-run-if-empty umount
# Remove all system connections
- run_podman system connection ls --format json
- while read name; do
- run_podman system connection rm "$name"
- done < <(jq -r '.[].Name' <<<"$output")
+ run_podman system connection rm --all
basic_teardown
}
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index b3471b425..c86497f4c 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -167,6 +167,13 @@ load helpers
$IMAGE nc -l -n -v -p $myport
cid="$output"
+ # FIXME: debugging for #11871
+ run_podman exec $cid cat /etc/resolv.conf
+ if is_rootless; then
+ run_podman unshare --rootless-cni cat /etc/resolv.conf
+ fi
+ ps uxww
+
# check that dns is working inside the container
run_podman exec $cid nslookup google.com
diff --git a/test/utils/matchers.go b/test/utils/matchers.go
index 07c1232e7..17ff3ea75 100644
--- a/test/utils/matchers.go
+++ b/test/utils/matchers.go
@@ -2,57 +2,164 @@ package utils
import (
"fmt"
+ "net/url"
+ "github.com/containers/common/pkg/config"
+ . "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
"github.com/onsi/gomega/gexec"
+ "github.com/onsi/gomega/matchers"
+ "github.com/onsi/gomega/types"
)
+// HaveActiveService verifies the given service is the active service
+func HaveActiveService(name interface{}) OmegaMatcher {
+ return WithTransform(
+ func(cfg *config.Config) string {
+ return cfg.Engine.ActiveService
+ },
+ Equal(name))
+}
+
+type ServiceMatcher struct {
+ types.GomegaMatcher
+ Name interface{}
+ URI interface{}
+ Identity interface{}
+ failureMessage string
+ negatedFailureMessage string
+}
+
+func VerifyService(name, uri, identity interface{}) OmegaMatcher {
+ return &ServiceMatcher{
+ Name: name,
+ URI: uri,
+ Identity: identity,
+ }
+}
+
+func (matcher *ServiceMatcher) Match(actual interface{}) (success bool, err error) {
+ cfg, ok := actual.(*config.Config)
+ if !ok {
+ return false, fmt.Errorf("ServiceMatcher matcher expects a config.Config")
+ }
+
+ if _, err = url.Parse(matcher.URI.(string)); err != nil {
+ return false, err
+ }
+
+ success, err = HaveKey(matcher.Name).Match(cfg.Engine.ServiceDestinations)
+ if !success || err != nil {
+ matcher.failureMessage = HaveKey(matcher.Name).FailureMessage(cfg.Engine.ServiceDestinations)
+ matcher.negatedFailureMessage = HaveKey(matcher.Name).NegatedFailureMessage(cfg.Engine.ServiceDestinations)
+ return
+ }
+
+ sd := cfg.Engine.ServiceDestinations[matcher.Name.(string)]
+ success, err = Equal(matcher.URI).Match(sd.URI)
+ if !success || err != nil {
+ matcher.failureMessage = Equal(matcher.URI).FailureMessage(sd.URI)
+ matcher.negatedFailureMessage = Equal(matcher.URI).NegatedFailureMessage(sd.URI)
+ return
+ }
+
+ success, err = Equal(matcher.Identity).Match(sd.Identity)
+ if !success || err != nil {
+ matcher.failureMessage = Equal(matcher.Identity).FailureMessage(sd.Identity)
+ matcher.negatedFailureMessage = Equal(matcher.Identity).NegatedFailureMessage(sd.Identity)
+ return
+ }
+
+ return true, nil
+}
+
+func (matcher *ServiceMatcher) FailureMessage(_ interface{}) string {
+ return matcher.failureMessage
+}
+
+func (matcher *ServiceMatcher) NegatedFailureMessage(_ interface{}) string {
+ return matcher.negatedFailureMessage
+}
+
+type URLMatcher struct {
+ matchers.EqualMatcher
+}
+
+// VerifyURL matches when actual is a valid URL and matches expected
+func VerifyURL(uri interface{}) OmegaMatcher {
+ return &URLMatcher{matchers.EqualMatcher{Expected: uri}}
+}
+
+func (matcher *URLMatcher) Match(actual interface{}) (bool, error) {
+ e, ok := matcher.Expected.(string)
+ if !ok {
+ return false, fmt.Errorf("VerifyURL requires string inputs %T is not supported", matcher.Expected)
+ }
+ e_uri, err := url.Parse(e)
+ if err != nil {
+ return false, err
+ }
+
+ a, ok := actual.(string)
+ if !ok {
+ return false, fmt.Errorf("VerifyURL requires string inputs %T is not supported", actual)
+ }
+ a_uri, err := url.Parse(a)
+ if err != nil {
+ return false, err
+ }
+
+ return (&matchers.EqualMatcher{Expected: e_uri}).Match(a_uri)
+}
+
+type ExitMatcher struct {
+ types.GomegaMatcher
+ Expected int
+ Actual int
+}
+
// ExitWithError matches when assertion is > argument. Default 0
-// Modeled after the gomega Exit() matcher
-func ExitWithError(optionalExitCode ...int) *exitMatcher {
+// Modeled after the gomega Exit() matcher and also operates on sessions.
+func ExitWithError(optionalExitCode ...int) *ExitMatcher {
exitCode := 0
if len(optionalExitCode) > 0 {
exitCode = optionalExitCode[0]
}
- return &exitMatcher{exitCode: exitCode}
+ return &ExitMatcher{Expected: exitCode}
}
-type exitMatcher struct {
- exitCode int
- actualExitCode int
-}
-
-func (m *exitMatcher) Match(actual interface{}) (success bool, err error) {
+// Match follows gexec.Matcher interface
+func (matcher *ExitMatcher) Match(actual interface{}) (success bool, err error) {
exiter, ok := actual.(gexec.Exiter)
if !ok {
return false, fmt.Errorf("ExitWithError must be passed a gexec.Exiter (Missing method ExitCode() int) Got:\n#{format.Object(actual, 1)}")
}
- m.actualExitCode = exiter.ExitCode()
- if m.actualExitCode == -1 {
+ matcher.Actual = exiter.ExitCode()
+ if matcher.Actual == -1 {
return false, nil
}
- return m.actualExitCode > m.exitCode, nil
+ return matcher.Actual > matcher.Expected, nil
}
-func (m *exitMatcher) FailureMessage(actual interface{}) (message string) {
- if m.actualExitCode == -1 {
+func (matcher *ExitMatcher) FailureMessage(_ interface{}) (message string) {
+ if matcher.Actual == -1 {
return "Expected process to exit. It did not."
}
- return format.Message(m.actualExitCode, "to be greater than exit code:", m.exitCode)
+ return format.Message(matcher.Actual, "to be greater than exit code: ", matcher.Expected)
}
-func (m *exitMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- if m.actualExitCode == -1 {
+func (matcher *ExitMatcher) NegatedFailureMessage(_ interface{}) (message string) {
+ switch {
+ case matcher.Actual == -1:
return "you really shouldn't be able to see this!"
- } else {
- if m.exitCode == -1 {
- return "Expected process not to exit. It did."
- }
- return format.Message(m.actualExitCode, "is less than or equal to exit code:", m.exitCode)
+ case matcher.Expected == -1:
+ return "Expected process not to exit. It did."
}
+ return format.Message(matcher.Actual, "is less than or equal to exit code: ", matcher.Expected)
}
-func (m *exitMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
+
+func (matcher *ExitMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
session, ok := actual.(*gexec.Session)
if ok {
return session.ExitCode() == -1
diff --git a/test/utils/utils.go b/test/utils/utils.go
index d4d5e6e2f..8d1edb23a 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -397,7 +397,7 @@ func tagOutputToMap(imagesOutput []string) map[string]map[string]bool {
return m
}
-// GetHostDistributionInfo returns a struct with its distribution name and version
+// GetHostDistributionInfo returns a struct with its distribution Name and version
func GetHostDistributionInfo() HostOS {
f, err := os.Open(OSReleasePath)
defer f.Close()
@@ -491,13 +491,3 @@ func RandomString(n int) string {
}
return string(b)
}
-
-//SkipIfInContainer skips a test if the test is run inside a container
-func SkipIfInContainer(reason string) {
- if len(reason) < 5 {
- panic("SkipIfInContainer must specify a reason to skip")
- }
- if os.Getenv("TEST_ENVIRON") == "container" {
- Skip("[container]: " + reason)
- }
-}
diff --git a/vendor/github.com/checkpoint-restore/go-criu/v5/magic/types.go b/vendor/github.com/checkpoint-restore/go-criu/v5/magic/types.go
new file mode 100644
index 000000000..24cc3989a
--- /dev/null
+++ b/vendor/github.com/checkpoint-restore/go-criu/v5/magic/types.go
@@ -0,0 +1,12 @@
+package magic
+
+const (
+ ImgCommonMagic = 0x54564319 /* Sarov (a.k.a. Arzamas-16) */
+ ImgServiceMagic = 0x55105940 /* Zlatoust */
+ StatsMagic = 0x57093306 /* Ostashkov */
+
+ PrimaryMagicOffset = 0x0
+ SecondaryMagicOffset = 0x4
+ SizeOffset = 0x8
+ PayloadOffset = 0xC
+)
diff --git a/vendor/github.com/checkpoint-restore/go-criu/v5/stats/stats.pb.go b/vendor/github.com/checkpoint-restore/go-criu/v5/stats/stats.pb.go
new file mode 100644
index 000000000..ff011fc2c
--- /dev/null
+++ b/vendor/github.com/checkpoint-restore/go-criu/v5/stats/stats.pb.go
@@ -0,0 +1,462 @@
+// SPDX-License-Identifier: MIT
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.27.1
+// protoc v3.12.4
+// source: stats/stats.proto
+
+package stats
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// This one contains statistics about dump/restore process
+type DumpStatsEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ FreezingTime *uint32 `protobuf:"varint,1,req,name=freezing_time,json=freezingTime" json:"freezing_time,omitempty"`
+ FrozenTime *uint32 `protobuf:"varint,2,req,name=frozen_time,json=frozenTime" json:"frozen_time,omitempty"`
+ MemdumpTime *uint32 `protobuf:"varint,3,req,name=memdump_time,json=memdumpTime" json:"memdump_time,omitempty"`
+ MemwriteTime *uint32 `protobuf:"varint,4,req,name=memwrite_time,json=memwriteTime" json:"memwrite_time,omitempty"`
+ PagesScanned *uint64 `protobuf:"varint,5,req,name=pages_scanned,json=pagesScanned" json:"pages_scanned,omitempty"`
+ PagesSkippedParent *uint64 `protobuf:"varint,6,req,name=pages_skipped_parent,json=pagesSkippedParent" json:"pages_skipped_parent,omitempty"`
+ PagesWritten *uint64 `protobuf:"varint,7,req,name=pages_written,json=pagesWritten" json:"pages_written,omitempty"`
+ IrmapResolve *uint32 `protobuf:"varint,8,opt,name=irmap_resolve,json=irmapResolve" json:"irmap_resolve,omitempty"`
+ PagesLazy *uint64 `protobuf:"varint,9,req,name=pages_lazy,json=pagesLazy" json:"pages_lazy,omitempty"`
+ PagePipes *uint64 `protobuf:"varint,10,opt,name=page_pipes,json=pagePipes" json:"page_pipes,omitempty"`
+ PagePipeBufs *uint64 `protobuf:"varint,11,opt,name=page_pipe_bufs,json=pagePipeBufs" json:"page_pipe_bufs,omitempty"`
+ ShpagesScanned *uint64 `protobuf:"varint,12,opt,name=shpages_scanned,json=shpagesScanned" json:"shpages_scanned,omitempty"`
+ ShpagesSkippedParent *uint64 `protobuf:"varint,13,opt,name=shpages_skipped_parent,json=shpagesSkippedParent" json:"shpages_skipped_parent,omitempty"`
+ ShpagesWritten *uint64 `protobuf:"varint,14,opt,name=shpages_written,json=shpagesWritten" json:"shpages_written,omitempty"`
+}
+
+func (x *DumpStatsEntry) Reset() {
+ *x = DumpStatsEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_stats_stats_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DumpStatsEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DumpStatsEntry) ProtoMessage() {}
+
+func (x *DumpStatsEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_stats_stats_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DumpStatsEntry.ProtoReflect.Descriptor instead.
+func (*DumpStatsEntry) Descriptor() ([]byte, []int) {
+ return file_stats_stats_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *DumpStatsEntry) GetFreezingTime() uint32 {
+ if x != nil && x.FreezingTime != nil {
+ return *x.FreezingTime
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetFrozenTime() uint32 {
+ if x != nil && x.FrozenTime != nil {
+ return *x.FrozenTime
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetMemdumpTime() uint32 {
+ if x != nil && x.MemdumpTime != nil {
+ return *x.MemdumpTime
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetMemwriteTime() uint32 {
+ if x != nil && x.MemwriteTime != nil {
+ return *x.MemwriteTime
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetPagesScanned() uint64 {
+ if x != nil && x.PagesScanned != nil {
+ return *x.PagesScanned
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetPagesSkippedParent() uint64 {
+ if x != nil && x.PagesSkippedParent != nil {
+ return *x.PagesSkippedParent
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetPagesWritten() uint64 {
+ if x != nil && x.PagesWritten != nil {
+ return *x.PagesWritten
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetIrmapResolve() uint32 {
+ if x != nil && x.IrmapResolve != nil {
+ return *x.IrmapResolve
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetPagesLazy() uint64 {
+ if x != nil && x.PagesLazy != nil {
+ return *x.PagesLazy
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetPagePipes() uint64 {
+ if x != nil && x.PagePipes != nil {
+ return *x.PagePipes
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetPagePipeBufs() uint64 {
+ if x != nil && x.PagePipeBufs != nil {
+ return *x.PagePipeBufs
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetShpagesScanned() uint64 {
+ if x != nil && x.ShpagesScanned != nil {
+ return *x.ShpagesScanned
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetShpagesSkippedParent() uint64 {
+ if x != nil && x.ShpagesSkippedParent != nil {
+ return *x.ShpagesSkippedParent
+ }
+ return 0
+}
+
+func (x *DumpStatsEntry) GetShpagesWritten() uint64 {
+ if x != nil && x.ShpagesWritten != nil {
+ return *x.ShpagesWritten
+ }
+ return 0
+}
+
+type RestoreStatsEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ PagesCompared *uint64 `protobuf:"varint,1,req,name=pages_compared,json=pagesCompared" json:"pages_compared,omitempty"`
+ PagesSkippedCow *uint64 `protobuf:"varint,2,req,name=pages_skipped_cow,json=pagesSkippedCow" json:"pages_skipped_cow,omitempty"`
+ ForkingTime *uint32 `protobuf:"varint,3,req,name=forking_time,json=forkingTime" json:"forking_time,omitempty"`
+ RestoreTime *uint32 `protobuf:"varint,4,req,name=restore_time,json=restoreTime" json:"restore_time,omitempty"`
+ PagesRestored *uint64 `protobuf:"varint,5,opt,name=pages_restored,json=pagesRestored" json:"pages_restored,omitempty"`
+}
+
+func (x *RestoreStatsEntry) Reset() {
+ *x = RestoreStatsEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_stats_stats_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RestoreStatsEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RestoreStatsEntry) ProtoMessage() {}
+
+func (x *RestoreStatsEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_stats_stats_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RestoreStatsEntry.ProtoReflect.Descriptor instead.
+func (*RestoreStatsEntry) Descriptor() ([]byte, []int) {
+ return file_stats_stats_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *RestoreStatsEntry) GetPagesCompared() uint64 {
+ if x != nil && x.PagesCompared != nil {
+ return *x.PagesCompared
+ }
+ return 0
+}
+
+func (x *RestoreStatsEntry) GetPagesSkippedCow() uint64 {
+ if x != nil && x.PagesSkippedCow != nil {
+ return *x.PagesSkippedCow
+ }
+ return 0
+}
+
+func (x *RestoreStatsEntry) GetForkingTime() uint32 {
+ if x != nil && x.ForkingTime != nil {
+ return *x.ForkingTime
+ }
+ return 0
+}
+
+func (x *RestoreStatsEntry) GetRestoreTime() uint32 {
+ if x != nil && x.RestoreTime != nil {
+ return *x.RestoreTime
+ }
+ return 0
+}
+
+func (x *RestoreStatsEntry) GetPagesRestored() uint64 {
+ if x != nil && x.PagesRestored != nil {
+ return *x.PagesRestored
+ }
+ return 0
+}
+
+type StatsEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Dump *DumpStatsEntry `protobuf:"bytes,1,opt,name=dump" json:"dump,omitempty"`
+ Restore *RestoreStatsEntry `protobuf:"bytes,2,opt,name=restore" json:"restore,omitempty"`
+}
+
+func (x *StatsEntry) Reset() {
+ *x = StatsEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_stats_stats_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *StatsEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StatsEntry) ProtoMessage() {}
+
+func (x *StatsEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_stats_stats_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use StatsEntry.ProtoReflect.Descriptor instead.
+func (*StatsEntry) Descriptor() ([]byte, []int) {
+ return file_stats_stats_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *StatsEntry) GetDump() *DumpStatsEntry {
+ if x != nil {
+ return x.Dump
+ }
+ return nil
+}
+
+func (x *StatsEntry) GetRestore() *RestoreStatsEntry {
+ if x != nil {
+ return x.Restore
+ }
+ return nil
+}
+
+var File_stats_stats_proto protoreflect.FileDescriptor
+
+var file_stats_stats_proto_rawDesc = []byte{
+ 0x0a, 0x11, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x22, 0xad, 0x04, 0x0a, 0x10, 0x64, 0x75, 0x6d, 0x70, 0x5f, 0x73, 0x74, 0x61,
+ 0x74, 0x73, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x72, 0x65, 0x65,
+ 0x7a, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0d, 0x52,
+ 0x0c, 0x66, 0x72, 0x65, 0x65, 0x7a, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a,
+ 0x0b, 0x66, 0x72, 0x6f, 0x7a, 0x65, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x02,
+ 0x28, 0x0d, 0x52, 0x0a, 0x66, 0x72, 0x6f, 0x7a, 0x65, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x21,
+ 0x0a, 0x0c, 0x6d, 0x65, 0x6d, 0x64, 0x75, 0x6d, 0x70, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03,
+ 0x20, 0x02, 0x28, 0x0d, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x64, 0x75, 0x6d, 0x70, 0x54, 0x69, 0x6d,
+ 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x65, 0x6d, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x69,
+ 0x6d, 0x65, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x0c, 0x6d, 0x65, 0x6d, 0x77, 0x72, 0x69,
+ 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x61, 0x67, 0x65, 0x73, 0x5f,
+ 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x05, 0x20, 0x02, 0x28, 0x04, 0x52, 0x0c, 0x70,
+ 0x61, 0x67, 0x65, 0x73, 0x53, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x30, 0x0a, 0x14, 0x70,
+ 0x61, 0x67, 0x65, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72,
+ 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x02, 0x28, 0x04, 0x52, 0x12, 0x70, 0x61, 0x67, 0x65, 0x73,
+ 0x53, 0x6b, 0x69, 0x70, 0x70, 0x65, 0x64, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x23, 0x0a,
+ 0x0d, 0x70, 0x61, 0x67, 0x65, 0x73, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x18, 0x07,
+ 0x20, 0x02, 0x28, 0x04, 0x52, 0x0c, 0x70, 0x61, 0x67, 0x65, 0x73, 0x57, 0x72, 0x69, 0x74, 0x74,
+ 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x72, 0x6d, 0x61, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x6f,
+ 0x6c, 0x76, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x69, 0x72, 0x6d, 0x61, 0x70,
+ 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x73,
+ 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x09, 0x20, 0x02, 0x28, 0x04, 0x52, 0x09, 0x70, 0x61, 0x67,
+ 0x65, 0x73, 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x70,
+ 0x69, 0x70, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65,
+ 0x50, 0x69, 0x70, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x69,
+ 0x70, 0x65, 0x5f, 0x62, 0x75, 0x66, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x70,
+ 0x61, 0x67, 0x65, 0x50, 0x69, 0x70, 0x65, 0x42, 0x75, 0x66, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x73,
+ 0x68, 0x70, 0x61, 0x67, 0x65, 0x73, 0x5f, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x0c,
+ 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x68, 0x70, 0x61, 0x67, 0x65, 0x73, 0x53, 0x63, 0x61,
+ 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x68, 0x70, 0x61, 0x67, 0x65, 0x73, 0x5f,
+ 0x73, 0x6b, 0x69, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x0d,
+ 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x73, 0x68, 0x70, 0x61, 0x67, 0x65, 0x73, 0x53, 0x6b, 0x69,
+ 0x70, 0x70, 0x65, 0x64, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x68,
+ 0x70, 0x61, 0x67, 0x65, 0x73, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x18, 0x0e, 0x20,
+ 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x68, 0x70, 0x61, 0x67, 0x65, 0x73, 0x57, 0x72, 0x69, 0x74,
+ 0x74, 0x65, 0x6e, 0x22, 0xd5, 0x01, 0x0a, 0x13, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f,
+ 0x73, 0x74, 0x61, 0x74, 0x73, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x70,
+ 0x61, 0x67, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20,
+ 0x02, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x67, 0x65, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x72,
+ 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x61, 0x67, 0x65, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70,
+ 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x52, 0x0f, 0x70,
+ 0x61, 0x67, 0x65, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x70, 0x65, 0x64, 0x43, 0x6f, 0x77, 0x12, 0x21,
+ 0x0a, 0x0c, 0x66, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03,
+ 0x20, 0x02, 0x28, 0x0d, 0x52, 0x0b, 0x66, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d,
+ 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x74, 0x69, 0x6d,
+ 0x65, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
+ 0x54, 0x69, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x67, 0x65, 0x73, 0x5f, 0x72, 0x65,
+ 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61,
+ 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x22, 0x64, 0x0a, 0x0b, 0x73,
+ 0x74, 0x61, 0x74, 0x73, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x04, 0x64, 0x75,
+ 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x64, 0x75, 0x6d, 0x70, 0x5f,
+ 0x73, 0x74, 0x61, 0x74, 0x73, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x64, 0x75, 0x6d,
+ 0x70, 0x12, 0x2e, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x73, 0x74, 0x61,
+ 0x74, 0x73, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72,
+ 0x65,
+}
+
+var (
+ file_stats_stats_proto_rawDescOnce sync.Once
+ file_stats_stats_proto_rawDescData = file_stats_stats_proto_rawDesc
+)
+
+func file_stats_stats_proto_rawDescGZIP() []byte {
+ file_stats_stats_proto_rawDescOnce.Do(func() {
+ file_stats_stats_proto_rawDescData = protoimpl.X.CompressGZIP(file_stats_stats_proto_rawDescData)
+ })
+ return file_stats_stats_proto_rawDescData
+}
+
+var file_stats_stats_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
+var file_stats_stats_proto_goTypes = []interface{}{
+ (*DumpStatsEntry)(nil), // 0: dump_stats_entry
+ (*RestoreStatsEntry)(nil), // 1: restore_stats_entry
+ (*StatsEntry)(nil), // 2: stats_entry
+}
+var file_stats_stats_proto_depIdxs = []int32{
+ 0, // 0: stats_entry.dump:type_name -> dump_stats_entry
+ 1, // 1: stats_entry.restore:type_name -> restore_stats_entry
+ 2, // [2:2] is the sub-list for method output_type
+ 2, // [2:2] is the sub-list for method input_type
+ 2, // [2:2] is the sub-list for extension type_name
+ 2, // [2:2] is the sub-list for extension extendee
+ 0, // [0:2] is the sub-list for field type_name
+}
+
+func init() { file_stats_stats_proto_init() }
+func file_stats_stats_proto_init() {
+ if File_stats_stats_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_stats_stats_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DumpStatsEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_stats_stats_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RestoreStatsEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_stats_stats_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*StatsEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_stats_stats_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 3,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_stats_stats_proto_goTypes,
+ DependencyIndexes: file_stats_stats_proto_depIdxs,
+ MessageInfos: file_stats_stats_proto_msgTypes,
+ }.Build()
+ File_stats_stats_proto = out.File
+ file_stats_stats_proto_rawDesc = nil
+ file_stats_stats_proto_goTypes = nil
+ file_stats_stats_proto_depIdxs = nil
+}
diff --git a/vendor/github.com/checkpoint-restore/go-criu/v5/stats/stats.proto b/vendor/github.com/checkpoint-restore/go-criu/v5/stats/stats.proto
new file mode 100644
index 000000000..64e46181d
--- /dev/null
+++ b/vendor/github.com/checkpoint-restore/go-criu/v5/stats/stats.proto
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: MIT
+
+syntax = "proto2";
+
+// This one contains statistics about dump/restore process
+message dump_stats_entry {
+ required uint32 freezing_time = 1;
+ required uint32 frozen_time = 2;
+ required uint32 memdump_time = 3;
+ required uint32 memwrite_time = 4;
+
+ required uint64 pages_scanned = 5;
+ required uint64 pages_skipped_parent = 6;
+ required uint64 pages_written = 7;
+
+ optional uint32 irmap_resolve = 8;
+
+ required uint64 pages_lazy = 9;
+ optional uint64 page_pipes = 10;
+ optional uint64 page_pipe_bufs = 11;
+
+ optional uint64 shpages_scanned = 12;
+ optional uint64 shpages_skipped_parent = 13;
+ optional uint64 shpages_written = 14;
+}
+
+message restore_stats_entry {
+ required uint64 pages_compared = 1;
+ required uint64 pages_skipped_cow = 2;
+
+ required uint32 forking_time = 3;
+ required uint32 restore_time = 4;
+
+ optional uint64 pages_restored = 5;
+}
+
+message stats_entry {
+ optional dump_stats_entry dump = 1;
+ optional restore_stats_entry restore = 2;
+}
diff --git a/vendor/github.com/checkpoint-restore/go-criu/v5/stats/types.go b/vendor/github.com/checkpoint-restore/go-criu/v5/stats/types.go
new file mode 100644
index 000000000..9044ad976
--- /dev/null
+++ b/vendor/github.com/checkpoint-restore/go-criu/v5/stats/types.go
@@ -0,0 +1,6 @@
+package stats
+
+const (
+ StatsDump = "stats-dump"
+ StatsRestore = "stats-restore"
+)
diff --git a/vendor/github.com/checkpoint-restore/go-criu/v5/stats/utils.go b/vendor/github.com/checkpoint-restore/go-criu/v5/stats/utils.go
new file mode 100644
index 000000000..368b2039e
--- /dev/null
+++ b/vendor/github.com/checkpoint-restore/go-criu/v5/stats/utils.go
@@ -0,0 +1,54 @@
+package stats
+
+import (
+ "encoding/binary"
+ "errors"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+
+ "github.com/checkpoint-restore/go-criu/v5/magic"
+ "google.golang.org/protobuf/proto"
+)
+
+func readStatisticsFile(imgDir *os.File, fileName string) (*StatsEntry, error) {
+ buf, err := ioutil.ReadFile(filepath.Join(imgDir.Name(), fileName))
+ if err != nil {
+ return nil, err
+ }
+
+ if binary.LittleEndian.Uint32(buf[magic.PrimaryMagicOffset:magic.SecondaryMagicOffset]) != magic.ImgServiceMagic {
+ return nil, errors.New("Primary magic not found")
+ }
+
+ if binary.LittleEndian.Uint32(buf[magic.SecondaryMagicOffset:magic.SizeOffset]) != magic.StatsMagic {
+ return nil, errors.New("Secondary magic not found")
+ }
+
+ payloadSize := binary.LittleEndian.Uint32(buf[magic.SizeOffset:magic.PayloadOffset])
+
+ st := &StatsEntry{}
+ if err := proto.Unmarshal(buf[magic.PayloadOffset:magic.PayloadOffset+payloadSize], st); err != nil {
+ return nil, err
+ }
+
+ return st, nil
+}
+
+func CriuGetDumpStats(imgDir *os.File) (*DumpStatsEntry, error) {
+ st, err := readStatisticsFile(imgDir, StatsDump)
+ if err != nil {
+ return nil, err
+ }
+
+ return st.GetDump(), nil
+}
+
+func CriuGetRestoreStats(imgDir *os.File) (*RestoreStatsEntry, error) {
+ st, err := readStatisticsFile(imgDir, StatsRestore)
+ if err != nil {
+ return nil, err
+ }
+
+ return st.GetRestore(), nil
+}
diff --git a/vendor/github.com/containers/common/libimage/inspect.go b/vendor/github.com/containers/common/libimage/inspect.go
index 007cbdd89..d44ebf46e 100644
--- a/vendor/github.com/containers/common/libimage/inspect.go
+++ b/vendor/github.com/containers/common/libimage/inspect.go
@@ -187,7 +187,12 @@ func (i *Image) Inspect(ctx context.Context, options *InspectOptions) (*ImageDat
return nil, err
}
data.Comment = dockerManifest.Comment
+ // NOTE: Health checks may be listed in the container config or
+ // the config.
data.HealthCheck = dockerManifest.ContainerConfig.Healthcheck
+ if data.HealthCheck == nil {
+ data.HealthCheck = dockerManifest.Config.Healthcheck
+ }
}
if data.Annotations == nil {
diff --git a/vendor/github.com/containers/common/pkg/config/config.go b/vendor/github.com/containers/common/pkg/config/config.go
index 45230703d..3d7101399 100644
--- a/vendor/github.com/containers/common/pkg/config/config.go
+++ b/vendor/github.com/containers/common/pkg/config/config.go
@@ -1151,10 +1151,11 @@ func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error)
if searchPATH {
return exec.LookPath(name)
}
+ configHint := "To resolve this error, set the helper_binaries_dir key in the `[engine]` section of containers.conf to the directory containing your helper binaries."
if len(c.Engine.HelperBinariesDir) == 0 {
- return "", errors.Errorf("could not find %q because there are no helper binary directories configured", name)
+ return "", errors.Errorf("could not find %q because there are no helper binary directories configured. %s", name, configHint)
}
- return "", errors.Errorf("could not find %q in one of %v", name, c.Engine.HelperBinariesDir)
+ return "", errors.Errorf("could not find %q in one of %v. %s", name, c.Engine.HelperBinariesDir, configHint)
}
// ImageCopyTmpDir default directory to store tempory image files during copy
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 2312c65ff..b9046c680 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -47,7 +47,9 @@ github.com/cespare/xxhash/v2
github.com/checkpoint-restore/checkpointctl/lib
# github.com/checkpoint-restore/go-criu/v5 v5.2.0
github.com/checkpoint-restore/go-criu/v5
+github.com/checkpoint-restore/go-criu/v5/magic
github.com/checkpoint-restore/go-criu/v5/rpc
+github.com/checkpoint-restore/go-criu/v5/stats
# github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/chzyer/readline
# github.com/container-orchestrated-devices/container-device-interface v0.0.0-20210325223243-f99e8b6c10b9
@@ -95,7 +97,7 @@ github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/pkg/sshagent
github.com/containers/buildah/pkg/util
github.com/containers/buildah/util
-# github.com/containers/common v0.46.1-0.20211026130826-7abfd453c86f
+# github.com/containers/common v0.46.1-0.20211109131927-c342e496bf76
github.com/containers/common/libimage
github.com/containers/common/libimage/manifests
github.com/containers/common/pkg/apparmor
@@ -489,7 +491,7 @@ github.com/onsi/ginkgo/reporters/stenographer
github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable
github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty
github.com/onsi/ginkgo/types
-# github.com/onsi/gomega v1.16.0
+# github.com/onsi/gomega v1.17.0 => github.com/onsi/gomega v1.16.0
github.com/onsi/gomega
github.com/onsi/gomega/format
github.com/onsi/gomega/gbytes