[CRIU] [PATCH] p.haul: fix Virtuozzo containers cgroups bug
Nikita Spiridonov
nspiridonov at odin.com
Wed Aug 5 08:10:52 PDT 2015
According to last changes in Virtuozzo kernel process can be added
to ve cgroupd only if ve.veid file initialized with correct numeric
veid. If ve.veid is not initialized p.haul can't add criu swrk
process to ve cgroup and as a result can't restore containers
process tree. So we have to manually initialize ve.veid.
It may be a temporary solution since with such approach we got
unpleasant code duplication with libvzctl.
Signed-off-by: Nikita Spiridonov <nspiridonov at odin.com>
---
phaul/p_haul_vz.py | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
index bdcae99..5db2f4a 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -76,6 +76,17 @@ class p_haul_type:
# FIXME -- implement
pass
+ def __cg_set_veid(self):
+ """Initialize veid in ve.veid for ve cgroup"""
+
+ veid_path = "/sys/fs/cgroup/ve/{0}/ve.veid".format(self._ctid)
+ with open(veid_path, "w") as f:
+ if self._ctid.isdigit():
+ veid = self._ctid
+ else:
+ veid = str(int(self._ctid.partition("-")[0], 16))
+ f.write(veid)
+
def init_src(self):
self._fs_mounted = True
self._bridged = True
@@ -128,12 +139,14 @@ class p_haul_type:
# Keep this name, we'll need one in prepare_ct()
self.cg_img = os.path.join(path, cg_image_name)
- #
- # Create cgroup hierarchy and put root task into it
- # Hierarchy is unlimited, we will apply config limitations
- # in ->restored->__apply_cg_config later
- #
def prepare_ct(self, pid):
+ """Create cgroup hierarchy and put root task into it.
+
+ Hierarchy is unlimited, we will apply config limitations in
+ __apply_cg_config later.
+ """
+
+ self.__cg_set_veid()
p_haul_cgroup.restore_hier(pid, self.cg_img)
def mount(self):
--
1.7.1
More information about the CRIU
mailing list