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

Nikita Spiridonov nspiridonov at odin.com
Thu Oct 8 07:49:47 PDT 2015


Acked-by: Nikita Spiridonov <nspiridonov at odin.com>

On Thu, 2015-10-08 at 14:06 +0000, Adrian Reber wrote:
> 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.
> 
> v2: rebased
> 
> v3: rebased
> 
> 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 9b2f369..9d35eb9 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])
>  		logging.info("`- 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 55dd819..ba96de3 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.target_host.set_options(opts)
>  		self.criu_connection.verbose(opts["verbose"])
> +		self.criu_connection.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 fd3c611..0aceafb 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_connection.verbose(opts["verbose"])
> +		self.criu_connection.shell_job(opts["shell_job"])
>  		self.img.set_options(opts)
>  		self.htype.set_options(opts)
>  




More information about the CRIU mailing list