[CRIU] [PATCH 3/5] vz: transform ovz module into vz module
nspiridonov
nspiridonov at odin.com
Thu Apr 30 05:10:22 PDT 2015
From: Nikita Spiridonov <nspiridonov at odin.com>
Rename OpenVZ module to Virtuozzo module, change method of root
pid acquisition. As far as /var/lib/vzctl/vepid/ctid missing for
Virtuozzo containers obtain root pid using cgroups.
Signed-off-by: Nikita Spiridonov <nspiridonov at odin.com>
---
p_haul_type.py | 4 ++--
p_haul_ovz.py => p_haul_vz.py | 13 +++++++------
2 files changed, 9 insertions(+), 8 deletions(-)
rename p_haul_ovz.py => p_haul_vz.py (94%)
diff --git a/p_haul_type.py b/p_haul_type.py
index 6ac093d..adf654e 100644
--- a/p_haul_type.py
+++ b/p_haul_type.py
@@ -4,12 +4,12 @@
# See p_haul_pid for comments of how a class should look like.
#
-import p_haul_ovz
+import p_haul_vz
import p_haul_pid
import p_haul_lxc
haul_types = {
- p_haul_ovz.name: p_haul_ovz,
+ p_haul_vz.name: p_haul_vz,
p_haul_pid.name: p_haul_pid,
p_haul_lxc.name: p_haul_lxc,
}
diff --git a/p_haul_ovz.py b/p_haul_vz.py
similarity index 94%
rename from p_haul_ovz.py
rename to p_haul_vz.py
index f33e033..40dc943 100644
--- a/p_haul_ovz.py
+++ b/p_haul_vz.py
@@ -1,5 +1,5 @@
#
-# OpenVZ containers hauler module
+# Virtuozzo containers hauler module
#
import os
@@ -9,8 +9,7 @@ import util
import fs_haul_shared
import fs_haul_subtree
-name = "ovz"
-vzpid_dir = "/var/lib/vzctl/vepid/"
+name = "vz"
vz_dir = "/vz"
vzpriv_dir = "%s/private" % vz_dir
vzroot_dir = "%s/root" % vz_dir
@@ -74,9 +73,11 @@ class p_haul_type:
pass
def root_task_pid(self):
- pf = open(os.path.join(vzpid_dir, self._ctid))
- pid = pf.read()
- return int(pid)
+ # Expect first line of tasks file contain root pid of CT
+ path = "/sys/fs/cgroup/memory/{0}/tasks".format(self._ctid)
+ with open(path) as tasks:
+ pid = tasks.readline()
+ return int(pid)
def __ct_priv(self):
return "%s/%s" % (vzpriv_dir, self._ctid)
--
1.7.1
More information about the CRIU
mailing list