[CRIU] [PATCH v2 4/5] p.haul: add option to enable/disable pre-dumps

Adrian Reber adrian at lisas.de
Tue Oct 6 09:49:27 PDT 2015


From: Adrian Reber <areber at redhat.com>

Although p.haul can now auto-detect if the used criu supports
memory tracking this adds a command-line option to force
pre-dumping on or off:

  --no-pre-dump        Force disable pre-dumps
  --pre-dump           Force enable pre-dumps

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 p.haul                | 12 ++++++++++++
 phaul/p_haul_iters.py | 19 ++++++++++++++-----
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/p.haul b/p.haul
index e807c8f..6239709 100755
--- a/p.haul
+++ b/p.haul
@@ -36,6 +36,18 @@ parser.add_argument("--log-file", help="Write logging messages to specified file
 parser.add_argument("-j", "--shell-job",help ="Allow migration of shell jobs",
 		    default=False, action='store_true')
 
+
+parser.add_argument('--no-pre-dump', dest='pre_dump', action='store_const',
+		    const=1, help='Force disable pre-dumps')
+parser.add_argument('--pre-dump', dest='pre_dump', action='store_const',
+		    const=2, help='Force enable pre-dumps')
+
+# If pre_dump is 0 then pre-dump autodetection should be used.
+# If it is 1 or 2 it should be either enabled or disabled no
+# matter if the kernel supports dirty page tracking or not.
+
+parser.set_defaults(pre_dump = 0)
+
 args = parser.parse_args()
 
 # Configure logging
diff --git a/phaul/p_haul_iters.py b/phaul/p_haul_iters.py
index ec02e31..c33e9df 100644
--- a/phaul/p_haul_iters.py
+++ b/phaul/p_haul_iters.py
@@ -27,6 +27,8 @@ class phaul_iter_worker:
 		self._mstat = mstats.migration_stats()
 		self.iteration = 0
 		self.prev_stats = None
+		# pre_dump 0 means auto-detection
+		self.pre_dump = 0
 
 		logging.info("Connecting to target host")
 		self.th = xem_rpc.rpc_proxy(host)
@@ -56,6 +58,7 @@ class phaul_iter_worker:
 		self.img.set_options(opts)
 		self.htype.set_options(opts)
 		self.__force = opts["force"]
+		self.pre_dump = opts["pre_dump"]
 
 	def validate_cpu(self):
 		logging.info("Checking CPU compatibility")
@@ -83,12 +86,18 @@ class phaul_iter_worker:
 		self.fs.set_work_dir(self.img.work_dir())
 		self.fs.start_migration()
 
-		logging.info("Checking for Dirty Tracking")
-		req = criu_req.make_dirty_tracking_req(self.htype, self.img)
-		resp = self.criu.send_req(req)
+		if self.pre_dump == 0:
+			# pre-dump auto-detection
+			logging.info("Checking for Dirty Tracking")
+			req = criu_req.make_dirty_tracking_req(self.htype, self.img)
+			resp = self.criu.send_req(req)
+			pre_dump = resp.success
+		elif self.pre_dump == 1:
+			pre_dump = False
+		else:
+			pre_dump = True
 
-		pre_dump = False
-		if resp.success:
+		if pre_dump:
 			if (resp.feat_res & (1 << cr_rpc.MEM_TRACK)):
 				logging.info("Starting iterations")
 				pre_dump = True
-- 
1.8.3.1



More information about the CRIU mailing list