p.haul: fix root_task_pid function for Virtuozzo containers

Submitted by Nikita Spiridonov on April 28, 2016, 4:59 p.m.

Details

Message ID 1461862786-180287-1-git-send-email-nspiridonov@virtuozzo.com
State Rejected
Series "p.haul: fix root_task_pid function for Virtuozzo containers"
Headers show

Commit Message

Nikita Spiridonov April 28, 2016, 4:59 p.m.
It is incorrect to grab root pid of container from first line of
cgroups tasks file; get root pid from pidfile instead.

Signed-off-by: Nikita Spiridonov <nspiridonov@virtuozzo.com>
---
 phaul/p_haul_vz.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
index 8f33a17..087ea7b 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -137,10 +137,9 @@  class p_haul_type:
 			req.opts.ghost_limit = 50 << 20
 
 	def root_task_pid(self):
-		# 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()
+		path = "/var/run/ve/{0}.init.pid".format(self._ctid)
+		with open(path) as pidfile:
+			pid = pidfile.read()
 			return int(pid)
 
 	def get_meta_images(self, path):

Comments

Pavel Emelianov May 16, 2016, 1:26 p.m.
Applied