[CRIU] [PATCH] p.haul: fix Virtuozzo specific dump request options

Nikita Spiridonov nspiridonov at virtuozzo.com
Thu Feb 25 03:42:12 PST 2016


Replace automatic mount resolution (--ext-mount-map auto option)
with explicit mount map for cgroup mounts. libvzctl handle local
suspend/resume in the same way.

Additionally add few options, missing previously - specify root
fs (--root option) and increase ghost limit up to 50Mb
(--ghost-limit option).

Signed-off-by: Nikita Spiridonov <nspiridonov at virtuozzo.com>
---
 phaul/p_haul_vz.py |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
index 7ac24b9..70838af 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -17,6 +17,22 @@ vz_conf_dir = "/etc/vz/conf/"
 vzctl_bin = "vzctl"
 
 
+vz_cgroup_mount_map = {
+	"/sys/fs/cgroup/cpu,cpuacct": "cpu",
+	"/sys/fs/cgroup/cpuset": "cpuset",
+	"/sys/fs/cgroup/net_cls": "net_cls",
+	"/sys/fs/cgroup/memory": "memory",
+	"/sys/fs/cgroup/devices": "devices",
+	"/sys/fs/cgroup/blkio": "blkio",
+	"/sys/fs/cgroup/freezer": "freezer",
+	"/sys/fs/cgroup/beancounter": "beancounter",
+	"/sys/fs/cgroup/ve": "ve",
+	"/sys/fs/cgroup/perf_event": "perf_event",
+	"/sys/fs/cgroup/hugetlb": "hugetlb",
+	"/sys/fs/cgroup/systemd": "systemd",
+}
+
+
 class p_haul_type:
 	def __init__(self, ctid):
 		self._ctid = ctid
@@ -105,13 +121,20 @@ class p_haul_type:
 
 	def adjust_criu_req(self, req):
 		"""Add module-specific options to criu request"""
-		if req.type == pycriu.rpc.DUMP or req.type == pycriu.rpc.RESTORE:
+		if req.type == pycriu.rpc.DUMP:
+
+			# Specify root fs
+			req.opts.root = self._ct_root
+
 			# Restore cgroups configuration
 			req.opts.manage_cgroups = True
-			# Automatically resolve external mounts
-			req.opts.auto_ext_mnt = True
-			req.opts.ext_sharing = True
-			req.opts.ext_masters = True
+
+			# Setup mapping for external Virtuozzo specific cgroup mounts
+			for key, value in vz_cgroup_mount_map.items():
+				req.opts.ext_mnt.add(key=key, val=value)
+
+			# Increase ghost-limit up to 50Mb
+			req.opts.ghost_limit = 50 << 20
 
 	def root_task_pid(self):
 		# Expect first line of tasks file contain root pid of CT
-- 
1.7.1



More information about the CRIU mailing list