1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Commit graph

20 commits

Author SHA1 Message Date
Eng Zer Jun
c55a4ac779
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-27 14:56:57 +08:00
Kir Kolyshkin
58ac4bd938
daemon/checkpoint: rm extra checks
In this code, err is already checked to be nil (or non-nil), so no need
to repeat extra checks.

Fixes the following govet warnings:

> daemon/checkpoint.go:38:12: nilness: tautological condition: nil == nil (govet)
> 		case err == nil:
> 		         ^
> daemon/checkpoint.go:45:12: nilness: tautological condition: nil == nil (govet)
> 		case err == nil && stat.IsDir():
> 		         ^
> daemon/checkpoint.go:47:12: nilness: tautological condition: nil == nil (govet)
> 		case err == nil:
> 		         ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-09-18 12:57:22 +02:00
Kirill Kolyshkin
6680a5cfe1
Merge pull request #38405 from rst0git/enable-cr-tty
Enable checkpoint/restore of containers with TTY
2019-03-21 14:12:49 -07:00
Andrei Vagin
0b96bf891c Fix CheckpointList
A container checkpoint directory doesn't have config.json.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2019-02-28 23:04:16 -08:00
Radostin Stoyanov
64b3b13576 Enable checkpoint/restore of containers with tty
CRIU supports checkpoint and restore of tty devices since version 2.12
which was released on 8th of March 2017. Support for this functionality
was implemented with opencontainers/runc@1c43d09 (checkpoint: add
support for containers with terminals) and containerd/containerd@60daa41
(Allow to checkpoint and restore a container with console).

Therefore, we can enable the support in moby/docker.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-12-30 07:52:37 +00:00
Innovimax
31348a2936 fix typo
Signed-off-by: innovimax <innovimax@gmail.com>
2018-12-28 01:30:31 +01:00
Lifubang
99a7a4dcd0 checkpoint rm fail
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-10-12 19:08:28 +08:00
Daniel Nephin
4f0d95fa6e Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-02-05 16:51:57 -05:00
Ross Boucher
e51aec9926 Don't append the container id to custom directory checkpoints. Fixes #34601.
Signed-off-by: Ross Boucher <rboucher@gmail.com>
2017-12-04 14:24:35 -05:00
Kir Kolyshkin
516010e92d Simplify/fix MkdirAll usage
This subtle bug keeps lurking in because error checking for `Mkdir()`
and `MkdirAll()` is slightly different wrt to `EEXIST`/`IsExist`:

 - for `Mkdir()`, `IsExist` error should (usually) be ignored
   (unless you want to make sure directory was not there before)
   as it means "the destination directory was already there"

 - for `MkdirAll()`, `IsExist` error should NEVER be ignored.

Mostly, this commit just removes ignoring the IsExist error, as it
should not be ignored.

Also, there are a couple of cases then IsExist is handled as
"directory already exist" which is wrong. As a result, some code
that never worked as intended is now removed.

NOTE that `idtools.MkdirAndChown()` behaves like `os.MkdirAll()`
rather than `os.Mkdir()` -- so its description is amended accordingly,
and its usage is handled as such (i.e. IsExist error is not ignored).

For more details, a quote from my runc commit 6f82d4b (July 2015):

    TL;DR: check for IsExist(err) after a failed MkdirAll() is both
    redundant and wrong -- so two reasons to remove it.

    Quoting MkdirAll documentation:

    > MkdirAll creates a directory named path, along with any necessary
    > parents, and returns nil, or else returns an error. If path
    > is already a directory, MkdirAll does nothing and returns nil.

    This means two things:

    1. If a directory to be created already exists, no error is
    returned.

    2. If the error returned is IsExist (EEXIST), it means there exists
    a non-directory with the same name as MkdirAll need to use for
    directory. Example: we want to MkdirAll("a/b"), but file "a"
    (or "a/b") already exists, so MkdirAll fails.

    The above is a theory, based on quoted documentation and my UNIX
    knowledge.

    3. In practice, though, current MkdirAll implementation [1] returns
    ENOTDIR in most of cases described in #2, with the exception when
    there is a race between MkdirAll and someone else creating the
    last component of MkdirAll argument as a file. In this very case
    MkdirAll() will indeed return EEXIST.

    Because of #1, IsExist check after MkdirAll is not needed.

    Because of #2 and #3, ignoring IsExist error is just plain wrong,
    as directory we require is not created. It's cleaner to report
    the error now.

    Note this error is all over the tree, I guess due to copy-paste,
    or trying to follow the same usage pattern as for Mkdir(),
    or some not quite correct examples on the Internet.

    [1] https://github.com/golang/go/blob/f9ed2f75/src/os/path.go

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2017-11-27 17:32:12 -08:00
Kenfe-Mickael Laventure
ddae20c032
Update libcontainerd to use containerd 1.0
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-20 07:11:37 -07:00
Daniel Nephin
22b246417f Move names to a more appropriate package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-06 12:05:16 -04:00
Jacob Wen
c0d2ec1eb5 Fix checkpoint ls
Use create=false when calling getCheckpointDir
Fix #33263

Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
2017-05-18 10:57:10 +08:00
yupengzte
130d1491b7 check err and add print
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-05-05 14:50:00 +08:00
dattatrayakumbhar04
d400518f4d 28755: Proper error handling for checkpoint conflict
Signed-off-by: Dattatrayakumbhar <dattatraya.kumbhar@gslab.com>
2017-04-04 05:18:19 +00:00
Vincent Demeester
dba271a42a
Move names to package api
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-21 22:42:47 +01:00
Yong Tang
c90ec05175 Restrict checkpoint name to prevent directory traversal
This fix tries to address the issue raised in 28769 where
checkpoint name was not checked before passing to containerd.
As a result, it was possible to use a special checkpoint name
to get outside of the container's directory.

This fix add restriction `[a-zA-Z0-9][a-zA-Z0-9_.-]+` (`RestrictedNamePattern`).
This is the same as container name restriction.

This fix fixes 28769.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-11-23 13:23:07 -08:00
boucher
bd7d51292c Allow providing a custom storage directory for docker checkpoints
Signed-off-by: boucher <rboucher@gmail.com>
2016-10-28 07:56:05 -04:00
allencloud
9b4ba34d04 change-code-and-fix-docs-about-checkpoint
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-09-23 19:37:43 +08:00
boucher
d8fef66b03 Initial implementation of containerd Checkpoint API.
Signed-off-by: boucher <rboucher@gmail.com>
2016-09-08 21:31:52 -04:00