[CRIU] [PATCH 2/3] Offer a possibility to migrate shell-jobs
Adrian Reber
adrian at lisas.de
Tue Sep 29 03:32:09 PDT 2015
From: Adrian Reber <areber at redhat.com>
The same command-line as known from criu option (-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 00a3808..2f4e8b3 100755
--- a/p.haul
+++ b/p.haul
@@ -29,6 +29,8 @@ parser.add_argument("--img-path", help = "Dirctory where to put images", default
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("-j", "--shell-job", help = "Allow migration of shell jobs",
+ default = False, action = 'store_true')
args = vars(parser.parse_args())
diff --git a/phaul/criu_api.py b/phaul/criu_api.py
index 3251ccb..9bfda2f 100644
--- a/phaul/criu_api.py
+++ b/phaul/criu_api.py
@@ -26,6 +26,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])
print "`- Passing (ctl:%d, data:%d) pair to CRIU" % (css[0].fileno(), mem_sk.fileno())
@@ -57,6 +58,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
@@ -77,6 +79,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 46ddf42..764e49c 100644
--- a/phaul/p_haul_iters.py
+++ b/phaul/p_haul_iters.py
@@ -51,6 +51,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 ca2d5e1..783ba3e 100644
--- a/phaul/p_haul_service.py
+++ b/phaul/p_haul_service.py
@@ -48,6 +48,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