[CRIU] [PATCH 1/2] zdtm: Handle dump/restore error in RPC mode

Pavel Emelyanov xemul at virtuozzo.com
Mon Nov 7 12:12:41 PST 2016


Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 test/zdtm.py | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/test/zdtm.py b/test/zdtm.py
index 3eeeb2d..33de383 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -732,23 +732,29 @@ class criu_rpc:
 		criu.use_binary(criu_bin)
 		criu_rpc.__set_opts(criu, args, ctx)
 
-		if action == 'dump':
-			criu.dump()
-		elif action == 'restore':
-			if 'rd' not in ctx:
-				raise test_fail_exc('RPC Non-detached restore is impossible')
-
-			res = criu.restore()
-			pidf = ctx.get('pidf')
-			if pidf:
-				open(pidf, 'w').write('%d\n' % res.pid)
+		try:
+			if action == 'dump':
+				criu.dump()
+			elif action == 'restore':
+				if 'rd' not in ctx:
+					raise test_fail_exc('RPC Non-detached restore is impossible')
+
+				res = criu.restore()
+				pidf = ctx.get('pidf')
+				if pidf:
+					open(pidf, 'w').write('%d\n' % res.pid)
+			else:
+				raise test_fail_exc('RPC for %s required' % action)
+		except crpc.CRIUExceptionExternal:
+			print "Fail"
+			ret = -1
 		else:
-			raise test_fail_exc('RPC for %s required' % action)
+			ret = 0
 
 		imgd = ctx.get('imgd')
 		if imgd:
 			os.close(imgd)
-		return 0
+		return ret
 
 
 class criu:
-- 
2.5.0



More information about the CRIU mailing list