2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-26 11:57:52 +00:00

283 Commits

Author SHA1 Message Date
Andrew Vagin
5ee1ac1f28 criu: remove FEATURE_TEST_MEMFD
It isn't required, __NR_memfd_create is defined in syscall-codes.h.

With this patch, we can run all tests in travis-ci, because there
a kernel has support of memfd, but __NR_memfd_create isn't defined
in installed headers

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 12:38:39 +03:00
Stanislav Kinsburskiy
a71b27ea79 scripts: fix typo in binary path in systemd-autofs-restart.sh
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:27:02 +03:00
Eugene Kolomeetz
df5f0262ca scripts: terminate systemd-autofs-restart.sh if saved mountpoint is missing
restore_mountpoint() should never be called without saved mountpoint.
If this happens, this is bug in script logic, which needs fixing.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:19:06 +03:00
Eugene Kolomeetz
73a24127e3 scripts: return non zero if save_mountpoint() fails
In such case, we must not proceed: without saved mountpoint, we risk
losing data when restarting automount service (think about tmpfs).
Currently, zero will be returned as exit status of preceeding echo.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:19:06 +03:00
Eugene Kolomeetz
00f8b63b22 scripts: remove bogus command substitution in systemd-autofs-restart.sh
When we want to just execute command (without capturing output), we must
not do it via $(cmd). With such form, shell first gets output of 'cmd',
and then evaluates it. If this is empty string, it is successfully
executed. If not empty, all breaks down.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:19:06 +03:00
Eugene Kolomeetz
e928321399 scripts: detect EOF on read in a usual way in systemd-autofs-restart.sh
When read bultin detects EOF, it sets empty string as value of specified
variable, and returns non-zero exit code. So we can rely just on exit
code, and not check variable value. This is standard approach.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:19:06 +03:00
Eugene Kolomeetz
76a6b0c4bf scripts: call readlink in CT context in systemd-autofs-restart.sh
Now readlink is called in host context, this is obviously wrong.

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:16 +03:00
Eugene Kolomeetz
1525aee1e4 scripts: single style for command substitution in systemd-autofs-restart.sh
Let's use $(...) form, it is more readable, and used in other places.

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:16 +03:00
Stanislav Kinsburskiy
92d8c31750 scripts: fix strings comparison in systemd-autofs-restart.sh
Otherwise the following errors can be triggered:

/usr/libexec/criu/scripts/systemd-autofs-restart.sh: line 64: [: =: unary
operator expected
/usr/libexec/criu/scripts/systemd-autofs-restart.sh: line 77: [: =: unary
operator expected

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:16 +03:00
Stanislav Kinsburskiy
49bfd9540d scripts: fix mountinfo parsing in systemd-autofs-restart.sh
Fily system type is not necessarily located in the column number 9.
But look like we can rely on " - " pattern: it's always located immediately
after dash.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
9f89937468 scripts: do not use stat to discover fs type in systemd-autofs-restart.sh
Unfortunatelly, autofs doesn't allow to discover it's type. At least without
accessing master process. That means, that stat can be used to determine
whether some other file system is mounted on top of autofs (which we need to
take a decision whether to move restore fs aside or not), because it simply
stuck.
This patch does fs type discovering by parsing CTs mountinfo.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
40682f1561 scripts: save and restore target mount for autofs service
This patch slightly changes the logic on systemd autofs service restart script:

1) It tries to bind-mount the mountpoint on top of autofs (if any) somewhere
before service restart, and replace new mount point on top of autofs (if any)
by the saved one after.

2) It doesn't exit in case of error, trying to recover as much as
possible in case of failure instead and then continue services restarting.

The reason for introducing new logic is that there can be some other,
stateful, file system on top of autofs (say, tmpfs), which state was restore
during migration.
With current script this state will be lost, while this patch allows to
preserve restored mount point after service restart.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
63d61425b7 scripts: join pid namespace in systemd-autofs-restart.sh
Without correct pid namespace systemctl is not able to determine whether
autofs is active or not.
The reason is unaccessible proc due to mount namespace change without pid
namespace change.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
10ffc78dfb scripts: systemd-autofs-restart.sh added
This script restarts systemd autofs services to workaround a problem, when
systemd doesn't consider autofs mount as own after restore (alien device ID
problem)

v4:
Environment variable NS_PID was renamed to CRTOOLS_INIT_PID

v2:
1) Added different checks: for process with pid, active service, systemd based
container.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Dmitry Safonov
a2de3eb831 travis: add coveralls.io support
I suggest to add support for coveralls.io.
It can't show all coverage, as we don't run all tests on travis,
but still everyone who forked CRIU can see instant coverage of
his Travis build. As a nice feature, it will show code cover
increasing/decreasing just after you push a commit - which
could give you a nice hint about content of a new tests.
For this feature, we need to build CRIU with `make GCOV=1`,
which adds --coverage and disables optimizations.

The resulting report looks like this:
https://coveralls.io/builds/6439346
I was thinking about codecov.io also, but it has fewer community,
less fixed issues on github - so I choose this service.

Just a random fun fact:
file-ids.c covered completely on tests, except -ENOMEM return.
Maybe it worth to run fault injections tests on Travis.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Andrew Vagin
66299a0065 zdtm: use flake8 to verify zdtm.py
and fix various warnings. For example, we mix tab and space indentations.

v2: add flake8.cfg

Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:35 +03:00
Andrew Vagin
851290bfa1 travis: enable compilation for ppc64le
qemu-static from ubuntu/xenial contains a required fix
and now we can execute compilation for ppc64le in travis.

v2: rebase on criu-dev
v3: set QEMU_CPU=POWER8 to avoid segfaults of qemu-ppc64le-static

> > By default, both qemu and gcc5 produce code on ppc64el which will run on
> > POWER7 platform.  However, in debian gcc build instruction, gcc is explicitly
> > built to produce code for POWER8 platform, which, obviously has additional
> > instructions.

v4: use ubuntu:trusty. xenial and wily has a bug:
Processing triggers for libc-bin (2.21-0ubuntu4.1) ...
/sbin/ldconfig.real: 5: /sbin/ldconfig.real: Syntax error: ")" unexpected
/sbin/ldconfig.real: 5: /sbin/ldconfig.real: Syntax error: ")" unexpected

v5: arm, x86, aarch64 were removed by mistake

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-06 14:38:29 +03:00
Cyrill Gorcunov
3e48109a4d criu: Drop prlimit compat layer
Previously when we've been on early stage we
tried to workaround lack of prlimit libc call
simply providing own implementation,  but it
cause problems on some libc configurations so
simply use rlimit64 and __NR_prlimit64 syscall
directly.

The kernel must support __NR_prlimit64 syscall
and provide rlimit64 structure as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-07 13:58:42 +03:00
Cyrill Gorcunov
6094b643dc nmk: build.mk -- Add @libso-y helper
To link dynamic libs (libcompel for example).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:31 +03:00
Cyrill Gorcunov
4a19618ea2 nmk: build.mk -- Add @hostprogs-y mode
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
e4e2f19d85 nmk: msg.mk -- Add host- messages
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
1693e539d5 nmk: build.mk -- Shrink gen-cc-rules
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cfc37c119c nmk: build.mk -- Drop any-match rule
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cb32e353bb nmk: build.mk -- Fix deps for target mode
Don't forget to call objectify.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cd5f7df520 nmk: build.mk -- Squash gen-rule-x into gen-cc-rules
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
0d1eac7ed4 nmk: Drop rules.mk
No much point in carrying it in a separate file.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
580ca3dd68 nmk: rules.mk -- Fix AFLAGS typo
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
06cc12a275 nmk: build.mk -- Fix ar rule for external libs
A typo.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
8994edebe1 nmk: build.mk -- Make process depend on Makefile itself
If makefile is changed itself we've been not detecting it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
4527341928 nmk: build.mk -- On cleanup use cleanup-y only
With cleanify helper we remove only they files
we've been generating, not anything else.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
b07d304905 nmk: utils.mk -- Add cleanify helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
6efe63109c nmk: utils.mk -- Drop redundant spaces
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
95f3f22e6e nmk: build.mk -- Fix typo in gen-ar-target-rule
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Cyrill Gorcunov
7beccce4b4 nmk: rules.mk -- Add per-obj flags
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Cyrill Gorcunov
c0ba98fd30 nmk: build.mk -- Drop unused objlist target
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Cyrill Gorcunov
f4ac56c0dd nmk: rules.mk -- Drop @CFLAGS_ and @ASFLAGS_ but add ability to bring them via param
Both never worked, we need to pass them as explicit parameter.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Dmitry Safonov
19bd013a1e build/nmk: add mrproper-y
This will separate clean process on two parts:
- deleting binaries/objects/temp
- deleting generated files

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Cyrill Gorcunov
3ddf271a5b nmk: scritps/macro.mk -- Enhance gen-built-in
Add ability to specify prerequsites and phony targets.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-23 13:10:45 +03:00
Cyrill Gorcunov
fa3c34c361 criu: Use __NR_memfd_create for testing memfd presence
We define own SYS_memfd_create in case if it's missing
in libc, but we need it for user-namespace restore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-16 16:16:09 +03:00
Svyatoslav Vlasov
bb7d912e40 tmpfiles: implement user tmp files feature
Add new action script tmp-files.sh, which allows user to
add files that can be lost between checkpoint and restore to the dump.
User files are stored in .tar.gz archive.
Tar command does all the file paths and attributes related work.

Fixes #65

Signed-off-by: Svyatoslav Vlasov <svloyso@gmail.com>
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-09 12:48:33 +03:00
Tycho Andersen
eaeb708f19 travis: don't run cgroup tests
Travis uses cpusets in such a way [1] that we can't actually write to
cpuset.cpu_exclusive ever, so none of these tests will work. They'll still
work in jenkins, though, so disabling them is probably ok.

Closes #118

[1]: https://github.com/travis-ci/worker/blob/master/backend/docker.go#L66

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-01 13:03:31 +03:00
Kir Kolyshkin
eac393431e nmk: remove no-print-directory from MAKEFLAGS
The problem with --no-print-directory set by default is when we
run :make from vim and compilation performed by a sub-make fails,
vim can't figure out the correct path to a file with error, so
instead of jumping to the position of the first error, it opens
a new empty file.

When make prints "Entering directory ..." and "Leaving directory ..."
messages, vim :make works as intended.

[Alternatively, we could add -w to $(MAKE) invocations where needed,
but the problem is --no-print-directory overrides -w even if -w comes
later in the options list, so -w is not working. I was also thinking
about detecting whether we are running from vim, but when we'll need
to add detection for emacs etc., so let's keep things simple.]

Cc: Andrey Vagin <avagin@openvz.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-26 14:57:44 +03:00
Laurent Dufour
137321108d build: scripts/utilities.mak is not more used
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-25 00:02:09 +03:00
Kir Kolyshkin
60404df396 nmk: don't use the FORCE, Luke!
With GNU make, using .PHONY leads to the same result as using
the "FORCE" hack, but unlike FORCE is not a hack. Since we do not
plan to use any other make implementation than GNU make, let's not
provide FORCE in nmk.

For more details about why PHONY is better than FORCE, see
http://www.gnu.org/software/make/manual/make.html#index-FORCE

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 23:48:25 +03:00
Kir Kolyshkin
2edc082e07 Makefiles: don't use the FORCE, Luke!
With GNU make, using .PHONY leads to the same result as using
the "FORCE" hack, but unlike FORCE is not a hack. Since we do not
plan to use any other make than GNU make, let's just mark phony
targets as such.

For more details about why PHONY is better than FORCE, see
http://www.gnu.org/software/make/manual/make.html#index-FORCE

[v2: rebased and splitted]

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 23:48:11 +03:00
Laurent Dufour
581c3f1145 nmk: add cscope, etags and ctags wrappers
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 23:25:40 +03:00
Laurent Dufour
64144b92d5 nmk: Use ppc64 for PowerPC 64 bits architecture
This is usual to reference PowerPC 64 bits architectures as 'ppc64',
and let 'powerpc' define PowerPC 32 bits ones.

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 23:15:45 +03:00
Pavel Emelyanov
a55840d7fa build: Remove duplicate entries
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:31:17 +03:00
Kir Kolyshkin
4ab2237f46 Dockerfile: add more packages
These packages are needed for proper build:

* git-core: to get CRIU version (see Makefile)
* pkg-config, libselinux-dev: to check for selinux
  (see criu/Makefile.config)

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:30:50 +03:00
Kir Kolyshkin
c38f6db0bc scripts/build/Makefile: brevity is the soul of wit
Make the Makefile leaner and cleaner.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:27:57 +03:00