[CRIU] [PATCH] phaul: use stats image from images dir instead of workdir

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Mon Mar 26 11:32:17 MSK 2018


After patch "stats/pid-reuse: put stats to image directory instead of
cwd", stats images will move to images dir, switch p.haul to use it from
the right place and also preserve compatibility with older criu.

https://jira.sw.ru/browse/PSBM-82864
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 phaul/criu_api.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/phaul/criu_api.py b/phaul/criu_api.py
index 73c642a..2dedfc6 100644
--- a/phaul/criu_api.py
+++ b/phaul/criu_api.py
@@ -104,7 +104,12 @@ def_verb = 2
 
 
 def criu_get_stats(img, file_name):
-	with open(os.path.join(img.work_dir(), file_name)) as f:
+	stats_path = os.path.join(img.image_dir(), file_name)
+	# Fallback to old stats location in working dir
+	if not os.path.exists(stats_path):
+		stats_path = os.path.join(img.work_dir(), file_name)
+
+	with open(stats_path) as f:
 		stats_dict = pycriu.images.load(f)
 		stats = pycriu.images.stats_pb2.stats_entry()
 		pycriu.images.pb2dict.dict2pb(stats_dict['entries'][0], stats)
-- 
2.14.3



More information about the CRIU mailing list