[CRIU] [PATCH 4/4] p.haul: check if cpuinfo dumping is actually supported

Pavel Emelyanov xemul at parallels.com
Thu Nov 5 04:52:35 PST 2015


On 11/03/2015 01:16 PM, Adrian Reber wrote:
> From: Adrian Reber <areber at redhat.com>
> 
> For criu architectures which do not have cpuinfo dumping
> and checking supported newer criu versions return -ENOTSUP
> in the optional cr_errno field. Check if it is set and disable cpuinfo
> dumping and checking if it is not supported.
> 
> Signed-off-by: Adrian Reber <areber at redhat.com>
> ---
>  phaul/iters.py | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/phaul/iters.py b/phaul/iters.py
> index a578078..c3e9f0a 100644
> --- a/phaul/iters.py
> +++ b/phaul/iters.py
> @@ -10,6 +10,7 @@ import pycriu
>  import criu_api
>  import criu_req
>  import htype
> +import errno
>  
>  PRE_DUMP_AUTO_DETECT = None
>  PRE_DUMP_DISABLE = False
> @@ -64,11 +65,17 @@ class phaul_iter_worker:
>  		self.pre_dump = opts["pre_dump"]
>  
>  	def validate_cpu(self):
> +		if self.__force:
> +			return
>  		logging.info("Checking CPU compatibility")
>  
>  		logging.info("\t`- Dumping CPU info")
>  		req = criu_req.make_cpuinfo_dump_req(self.img)
>  		resp = self.criu_connection.send_req(req)
> +		if resp.HasField('cr_errno') and (resp.cr_errno == -errno.ENOTSUP & 0xff):

Ouch. So this is the answer to my question about criu side. Can we better fix criu
to report ENOTSUP (without minus) so that this place just looks

   resp.cr_errno == errno.ENOTSUP

?

> +			logging.info("\t`- Dumping CPU info not supported")
> +			self.__force = True
> +			return
>  		if not resp.success:
>  			raise Exception("Can't dump cpuinfo")
>  
> @@ -102,8 +109,7 @@ class phaul_iter_worker:
>  
>  		migration_stats.start()
>  
> -		if not self.__force:
> -			self.validate_cpu()
> +		self.validate_cpu()
>  
>  		logging.info("Preliminary FS migration")
>  		self.fs.set_work_dir(self.img.work_dir())
> 



More information about the CRIU mailing list