[CRIU] [PATCH v2 2/5] p.haul: offer a possibility to migrate shell-jobs

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


From: Adrian Reber <areber at redhat.com>

The same command-line option as known from criu (-j|--shell-job)
is now provided by p.haul to migrate shell-jobs.

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 p.haul                  | 2 ++
 phaul/criu_api.py       | 5 +++++
 phaul/p_haul_iters.py   | 1 +
 phaul/p_haul_service.py | 1 +
 4 files changed, 9 insertions(+)

diff --git a/p.haul b/p.haul
index aea7971..a4ea8a7 100755
--- a/p.haul
+++ b/p.haul
@@ -32,6 +32,8 @@ parser.add_argument("--pid-root", help="Path to tree's FS root")
 parser.add_argument("--force", help="Don't do any sanity (CPU compat) checks", default=False, action='store_true')
 parser.add_argument("--port", help="Port where to haul", type=int, default=ph_xem_rpc.rpc_port)
 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')
 
 args = parser.parse_args()
 
diff --git a/phaul/criu_api.py b/phaul/criu_api.py
index 702dbe4..8b5ab3d 100644
--- a/phaul/criu_api.py
+++ b/phaul/criu_api.py
@@ -27,6 +27,7 @@ class criu_conn:
 		self._iter = 0
 		self.verb = def_verb
 		self._track_mem = True
+		self._shell_job = False
 		css = socket.socketpair(socket.AF_UNIX, socket.SOCK_SEQPACKET)
 		util.set_cloexec(css[1])
 		logging.info("`- Passing (ctl:%d, data:%d) pair to CRIU", css[0].fileno(), mem_sk.fileno())
@@ -58,6 +59,7 @@ class criu_conn:
 		req.opts.log_level = self.verb
 		req.opts.log_file = self.get_log_name(req.type)
 		req.opts.track_mem = self._track_mem
+		req.opts.shell_job = self._shell_job
 		self._cs.send(req.SerializeToString())
 		self._iter += 1
 		self._last_req = req.type
@@ -78,6 +80,9 @@ class criu_conn:
 	def memory_tracking(self, value):
 		self._track_mem = value
 
+	def shell_job(self, value):
+		self._shell_job = value
+
 #
 # Helper to read CRIU-generated statistics
 #
diff --git a/phaul/p_haul_iters.py b/phaul/p_haul_iters.py
index d5767b3..ec02e31 100644
--- a/phaul/p_haul_iters.py
+++ b/phaul/p_haul_iters.py
@@ -52,6 +52,7 @@ class phaul_iter_worker:
 	def set_options(self, opts):
 		self.th.set_options(opts)
 		self.criu.verbose(opts["verbose"])
+		self.criu.shell_job(opts["shell_job"])
 		self.img.set_options(opts)
 		self.htype.set_options(opts)
 		self.__force = opts["force"]
diff --git a/phaul/p_haul_service.py b/phaul/p_haul_service.py
index f2cadb9..d0a14dc 100644
--- a/phaul/p_haul_service.py
+++ b/phaul/p_haul_service.py
@@ -49,6 +49,7 @@ class phaul_service:
 
 	def rpc_set_options(self, opts):
 		self.criu.verbose(opts["verbose"])
+		self.criu.shell_job(opts["shell_job"])
 		self.img.set_options(opts)
 		self.htype.set_options(opts)
 
-- 
1.8.3.1



More information about the CRIU mailing list