Commit graph

2374 commits

Author SHA1 Message Date
Adrian Reber 03c88a3deb
Added tcp-established to checkpoint/restore
CRIU can checkpoint and restore processes/containers with established
TCP connections if the correct option is specified. To implement
checkpoint and restore with support for established TCP connections with
Podman this commit adds the necessary options to runc during checkpoint
and also tells conmon during restore to use 'runc restore' with
'--tcp-established'.

For this Podman feature to work a corresponding conmon change is
required.

Example:

$ podman run --tmpfs /tmp --name podman-criu-test -d docker://docker.io/yovfiatbeb/podman-criu-test
$ nc `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'` 8080
GET /examples/servlets/servlet/HelloWorldExample
Connection: keep-alive

1
GET /examples/servlets/servlet/HelloWorldExample
Connection: keep-alive

2
$ # Using HTTP keep-alive multiple requests are send to the server in the container
$ # Different terminal:
$ podman container checkpoint -l
criu failed: type NOTIFY errno 0
$ # Looking at the log file would show errors because of established TCP connections
$ podman container checkpoint -l --tcp-established
$ # This works now and after the restore the same connection as above can be used for requests
$ podman container restore -l --tcp-established

The restore would fail without '--tcp-established' as the checkpoint image
contains established TCP connections.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-28 08:00:38 +01:00
Adrian Reber a2bcb6d8bf
Remove unused CRIU_COMMIT variable
Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-28 08:00:38 +01:00
Adrian Reber a40f5c0aba
Point CRIU_COMMIT to CRIU release 3.11
The old commit points to the development branch and is not stable.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-28 08:00:38 +01:00
Adrian Reber 453c8bac57
Updated CRIO_COMMIT to pull in new conmon for CRIU
Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-28 08:00:37 +01:00
Adrian Reber 0592558289
Use also a struct to pass options to Restore()
This is basically the same change as

 ff47a4c2d5 (Use a struct to pass options to Checkpoint())

just for the Restore() function. It is used to pass multiple restore
options to the API and down to conmon which is used to restore
containers. This is for the upcoming changes to support checkpointing
and restoring containers with '--tcp-established'.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-28 08:00:37 +01:00
Ed Santiago 8b2affbd5b _split_token(): handle None
The conditional + list comprehension in images.py:_split_token()
wasn't quite working as intended; in particular, when fed None,
it chokes with

    TypeError: 'NoneType' object is not iterable

This is the correct behavior: comprehensions iterate first,
then apply the conditional.

Solution: special-case None, and remove the now-unnecessary
conditional.

Context: seen when trying 'pypodman run' against
docker.io/stackbrew/centos:7, which has no .ContainerConfig.Eng

Signed-off-by: Ed Santiago <santiago@redhat.com>
2018-11-27 16:13:36 -07:00
Colin Walters 870eed9378 Use host's resolv.conf if no network namespace enabled
My host system runs Fedora Silverblue 29 and I have NetworkManager's
`dns=dnsmasq` setting enabled, so my `/etc/resolv.conf` only has
`127.0.0.1`.

I also run my development podman containers with `--net=host`
for various reasons.

If we have a host network namespace, there's no reason not to just
use the host's nameserver configuration either.

This fixes e.g. accessing content on a VPN, and is also faster
since the container is using cached DNS.

I know this doesn't solve the bigger picture issue of localhost-DNS
conflicting with bridged networking, but that's far more involved,
probably requiring a DNS proxy in the container.  This patch
makes my workflow a lot nicer and was easy to write.

Signed-off-by: Colin Walters <walters@verbum.org>
2018-11-27 15:28:09 -05:00
Giuseppe Scrivano 4203df69ac
rootless: add new netmode "slirp4netns"
so that inspect reports the correct network configuration.

Closes: https://github.com/containers/libpod/issues/1453

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-27 21:10:16 +01:00
Giuseppe Scrivano 266c4952a8
tests: change return type for PodmanAsUser to PodmanTestIntegration
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-27 21:10:15 +01:00
OpenShift Merge Robot 6df7409cb5
Merge pull request #1878 from giuseppe/fix-static-ip-test
test: cleanup CNI network used by the tests
2018-11-27 11:56:03 -08:00
Giuseppe Scrivano 55508c1185
test: cleanup CNI network used by the tests
issue introduced with:

https://github.com/containers/libpod/pull/1871

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-27 16:55:28 +01:00
OpenShift Merge Robot 3f0c0cf80f
Merge pull request #1874 from ypu/mount-test
Improve podman run --mount test
2018-11-27 04:30:02 -08:00
OpenShift Merge Robot c1489e6317
Merge pull request #1863 from afbjorklund/podman_version
Actually set version for podman module / pypodman
2018-11-27 04:08:08 -08:00
OpenShift Merge Robot e679e768f1
Merge pull request #1832 from giuseppe/always-make-explicit-tty-to-exec
exec: always make explicit the tty value
2018-11-27 04:08:03 -08:00
OpenShift Merge Robot 5636066e2f
Merge pull request #1871 from ypu/ip-test
Add some tests for --ip flag with run and create command
2018-11-27 03:46:13 -08:00
Giuseppe Scrivano 070ce0c855
exec: don't wait for pidfile when the runtime exited
don't wait for the timeout to expire if the runtime process exited.
I've noticed podman to hang on exit and keeping the container lock
taken when the OCI runtime already exited.

Additionally, it reduces the waiting time as we won't hit the 25
milliseconds waiting time in the worst case.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-27 12:34:11 +01:00
OpenShift Merge Robot 049defa984
Merge pull request #1850 from vrothberg/mount-propagation
set root propagation based on volume properties
2018-11-27 03:29:17 -08:00
OpenShift Merge Robot 1d3e24239a
Merge pull request #1734 from rhatdan/network
libpod should know if the network is disabled
2018-11-27 03:29:07 -08:00
Yiqiao Pu 1a217b6aa1 Remove mount options relatime from podman run --mount with shared
In some test env, mount with shared options is not included relatime
in the mountinfo file. So remove this from the test case.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
2018-11-27 16:38:41 +08:00
Yiqiao Pu 883f814cfb Update test case name to podman run with --mount flag
Update the test case name to make it easier to filter --mount related
test cases with -ginkgo.focus.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
2018-11-27 15:59:55 +08:00
Yiqiao Pu d9adcd198f Add some tests for --ip flag with run and create command
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
2018-11-27 15:09:47 +08:00
OpenShift Merge Robot 39560500fc
Merge pull request #1868 from QiWang19/issue860
Add history field to image inspect
2018-11-26 16:46:22 -08:00
OpenShift Merge Robot 392648e7bc
Merge pull request #1838 from umohnani8/vendor
Vendor in latest containers/buildah
2018-11-26 12:25:18 -08:00
OpenShift Merge Robot f4db780bea
Merge pull request #1865 from baude/exists
add podman container|image exists
2018-11-26 10:03:37 -08:00
Qi Wang 5438ec1918 Add history and namespaceoptions to image inspect
Signed-off-by: Qi Wang <qiwan@redhat.com>
2018-11-26 10:56:55 -05:00
baude 9d883d2032 add podman container|image exists
Add an exists subcommand to podman container and podman image that allows
users to verify the existence of a container or image by ID or name.  The return
code can be 0 (success), 1 (failed to find), or 125 (failed to work with runtime).

Issue #1845

Signed-off-by: baude <bbaude@redhat.com>
2018-11-26 09:19:39 -06:00
Valentin Rothberg 0e2042ebd7 set root propagation based on volume properties
Set the root propagation based on the properties of volumes and default
mounts.  To remain compatibility, follow the semantics of Docker.  If a
volume is shared, keep the root propagation shared which works for slave
and private volumes too.  For slave volumes, it can either be shared or
rshared.  Do not change the root propagation for private volumes and
stick with the default.

Fixes: #1834
Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
2018-11-26 13:55:02 +01:00
OpenShift Merge Robot e3ece3bb90
Merge pull request #1860 from TomasTomecek/version-add-format
implement --format for version command
2018-11-25 04:52:38 -08:00
Anders F Björklund f84452f411 Actually set version for podman module / pypodman
The environment variable wasn't set, giving 0.0.0

It is a still a problem if you use python3 to build,
rather than make. You *need* to set $PODMAN_VERSION,
or your module and packages won't have the version.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2018-11-25 13:50:19 +01:00
OpenShift Merge Robot 5f8f15c797
Merge pull request #1862 from elimisteve/patch-1
podman_tutorial.md typo: arguement -> argument
2018-11-25 04:43:37 -08:00
Tomas Tomecek 43c20d0200 implement --format for version command
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2018-11-25 12:42:05 +01:00
Steve Phillips 22d971cd75
podman_tutorial.md typos: arguement -> argument; missing 'a'
Signed-off-by: Steve Phillips <steve@tryingtobeawesome.com>
2018-11-24 16:08:58 -08:00
OpenShift Merge Robot 78604c3c39
Merge pull request #1858 from adrianreber/papr
Load NAT modules to fix tests involving CRIU
2018-11-23 12:33:39 -08:00
Adrian Reber 90412e4c56
Load NAT modules to fix tests involving CRIU
CRIU uses iptables to lock and unlock the network during checkpoint and
restore. If Podman is running in Podman the automatic loading of modules
does not work and thus this commit pre-loads the necessary modules to
make sure the checkpoint test cases are not failing.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-23 19:09:48 +01:00
OpenShift Merge Robot 1fdfeb8710
Merge pull request #1835 from adrianreber/master
Added option to keep container running after checkpointing
2018-11-21 05:11:12 -08:00
Urvashi Mohnani bd61c779ca Vendor in latest containers/buildah
Pulls in fix for COPY --from when using --layers

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2018-11-21 12:38:14 +00:00
OpenShift Merge Robot 23feb0d6f9
Merge pull request #1810 from baude/inspectToKube
generate kubernetes YAML from a libpod container
2018-11-20 13:02:57 -08:00
OpenShift Merge Robot fe4f09493f
Merge pull request #1829 from baude/enableportbindinginpods
Allow users to expose ports from the pod to the host
2018-11-20 08:53:21 -08:00
OpenShift Merge Robot 21a76077d3
Merge pull request #1831 from jwhonce/wip/cmd
Improve speed of containers.list()
2018-11-20 08:32:16 -08:00
Adrian Reber 24c0739453
Update checkpoint/restore man pages
This adds the '--leave-running, -R' to the container-checkpoint man
page. As the information for '--all, -a' and '--latest, -l' was also
still missing it is included in this commit.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-20 17:25:44 +01:00
Adrian Reber b0572d6229
Added option to keep containers running after checkpointing
CRIU supports to leave processes running after checkpointing:

  -R|--leave-running    leave tasks in running state after checkpoint

runc also support to leave containers running after checkpointing:

   --leave-running      leave the process running after checkpointing

With this commit the support to leave a container running after
checkpointing is brought to Podman:

   --leave-running, -R  leave the container running after writing checkpoint to disk

Now it is possible to checkpoint a container at some point in time
without stopping the container. This can be used to rollback the
container to an early state:

$ podman run --tmpfs /tmp --name podman-criu-test -d docker://docker.io/yovfiatbeb/podman-criu-test
$ curl 10.88.64.253:8080/examples/servlets/servlet/HelloWorldExample
3
$ podman container checkpoint -R -l
$ curl 10.88.64.253:8080/examples/servlets/servlet/HelloWorldExample
4
$ curl 10.88.64.253:8080/examples/servlets/servlet/HelloWorldExample
5
$ podman stop -l
$ podman container restore -l
$ curl 10.88.64.253:8080/examples/servlets/servlet/HelloWorldExample
4

So after checkpointing the container kept running and was stopped after
some time. Restoring this container will restore the state right at the
checkpoint.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-20 17:25:44 +01:00
Adrian Reber ff47a4c2d5
Use a struct to pass options to Checkpoint()
For upcoming changes to the Checkpoint() functions this commit switches
checkpoint options from a boolean to a struct, so that additional
options can be passed easily to Checkpoint() without changing the
function parameters all the time.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-20 17:25:44 +01:00
Giuseppe Scrivano fd01402930
exec: always make explicit the tty value
otherwise runc will take by default the value used for creating the
container.  Setting it explicit overrides its default value and we
won't end up trying to use a terminal when not available.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1625876

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-20 17:08:57 +01:00
baude 690c52a113 Allow users to expose ports from the pod to the host
we need to allow users to expose ports to the host for the purposes
of networking, like a webserver.  the port exposure must be done at
the time the pod is created.

strictly speaking, the port exposure occurs on the infra container.

Signed-off-by: baude <bbaude@redhat.com>
2018-11-20 09:49:34 -06:00
Jhon Honce e955ff04ab Improve speed of containers.list()
* Clean up code in containers.py
* Pass pylint tests
* Pass tox tests

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-11-19 15:39:45 -07:00
OpenShift Merge Robot ea928f2de6
Merge pull request #1824 from afbjorklund/pypodman_user
pypodman: Don't use $HOST and $USER variables for remote
2018-11-19 08:45:06 -08:00
OpenShift Merge Robot 64a29e383b
Merge pull request #1806 from giuseppe/rootless-create-default-files
rootless: create user conf files when they don't exist
2018-11-19 08:44:57 -08:00
OpenShift Merge Robot 4eecc8cf70
Merge pull request #1823 from jwhonce/wip/cmd
Implement pypodman start command
2018-11-19 07:49:40 -08:00
baude f11a74e715 output libpod container to kubernetes yaml
scope out new kube subcommand where we can add generate. you can now generate kubernetes
YAML that will allow you to run the container in a kubernetes environment.  When
The YAML description will always "wrap" a container in a simple v1.Pod description.

Tests and further documentation will be added in additional PRs.

This function should be considered very much "under heavy development" at
this point.

Signed-off-by: baude <bbaude@redhat.com>
2018-11-19 09:05:24 -06:00
OpenShift Merge Robot 47ffaae840
Merge pull request #1780 from cevich/un-magic
Reveal magic, parallel system-testing and system-testing simplification
2018-11-19 05:14:30 -08:00