[CRIU] [PATCH p.haul 3/3] p.haul: specify secondary ploop disks as external in dump request options
Nikita Spiridonov
nspiridonov at virtuozzo.com
Tue Jun 21 02:29:14 PDT 2016
Specify secondary ploop disks (second, third and so on) as external
in dump request options for Virtuzzo containers.
Signed-off-by: Nikita Spiridonov <nspiridonov at virtuozzo.com>
---
phaul/p_haul_vz.py | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
index 8a5b296..50e4ba7 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -138,6 +138,12 @@ class p_haul_type:
for key, value in vz_cgroup_mount_map.items():
req.opts.ext_mnt.add(key=key, val=value)
+ # Specify secondary ploop disks as external
+ disks = self.__parse_secondary_disks_arg(self.__secondary_disks)
+ for uuid, major, minor in disks:
+ req.opts.external.append(
+ "dev[{0}/{1}]:{2}".format(major, minor + 1, uuid))
+
# Increase ghost-limit up to 50Mb
req.opts.ghost_limit = 50 << 20
@@ -313,6 +319,29 @@ class p_haul_type:
return deltas
+ def __parse_secondary_disks_arg(self, disks_arg):
+ """
+ Parse string containing list of secondary disks in specific format
+
+ String contain list of secondary ploop disks in format
+ %uuid%:%major%:%minor%[,...]. Consider all additional disks of
+ container (second, third and so on) are secondary. Parse it and return
+ list of tuples.
+ """
+
+ DISKS_SEPARATOR = ","
+ TUPLE_SEPARATOR = ":"
+
+ if not disks_arg:
+ return []
+
+ disks = []
+ for disk in disks_arg.split(DISKS_SEPARATOR):
+ uuid, major, minor = disk.split(TUPLE_SEPARATOR)
+ disks.append((uuid, int(major), int(minor)))
+
+ return disks
+
def add_hauler_args(parser):
"""Add Virtuozzo specific command line arguments"""
--
1.7.1
More information about the CRIU
mailing list