Blob Blame History Raw
From b43b740a33f13b0a5e902b0ef333a90a76f74d05 Mon Sep 17 00:00:00 2001
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Date: Wed, 27 May 2020 16:11:20 +0300
Subject: [PATCH 216/245] zdtm: enable mounts compat mode on restore with
 --mntns-compat-mode option

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/e4a430e1f

Changes: prepend --mntns-compat-mode to r_opts in zdtm.py so that we
can disable this option with --no-mntns-compat-mode from test desc
files.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 test/zdtm.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/test/zdtm.py b/test/zdtm.py
index 3fbdb8a18..f15420a65 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -953,6 +953,8 @@ class criu_rpc:
                 if criu_rpc.pidfd_store_socket is None:
                     criu_rpc.pidfd_store_socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
                 criu.opts.pidfd_store_sk = criu_rpc.pidfd_store_socket.fileno()
+            elif "--mntns-compat-mode" == arg:
+                criu.opts.mntns_compat_mode = True
             else:
                 raise test_fail_exc('RPC for %s(%s) required' % (arg, args.pop(0)))
 
@@ -1046,6 +1048,7 @@ class criu:
         self.__criu_bin = opts['criu_bin']
         self.__crit_bin = opts['crit_bin']
         self.__pre_dump_mode = opts['pre_dump_mode']
+        self.__mntns_compat_mode = bool(opts['mntns_compat_mode'])
 
         if opts['rpc']:
             self.__criu = criu_rpc
@@ -1444,6 +1447,9 @@ class criu:
                                                   nowait=True)
             r_opts += ["--lazy-pages"]
 
+        if self.__mntns_compat_mode:
+            r_opts = ['--mntns-compat-mode'] + r_opts
+
         if self.__leave_stopped:
             r_opts += ['--leave-stopped']
 
@@ -2034,7 +2040,7 @@ class Launcher:
               'sat', 'script', 'rpc', 'criu_config', 'lazy_pages', 'join_ns',
               'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup',
               'remote_lazy_pages', 'show_stats', 'lazy_migrate', 'stream',
-              'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode')
+              'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode', 'mntns_compat_mode')
         arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd}))
 
         if self.__use_log:
@@ -2707,6 +2713,9 @@ def get_cli_args():
                     help="Use splice or read mode of pre-dumping",
                     choices=['splice', 'read'],
                     default='splice')
+    rp.add_argument("--mntns-compat-mode",
+                    help="Use old compat mounts restore engine",
+                    action='store_true')
 
     lp = sp.add_parser("list", help="List tests")
     lp.set_defaults(action=list_tests)
-- 
2.35.1