[CRIU] [PATCH 6/6] pycriu: add criu class

Ruslan Kuprieiev rkuprieiev at cloudlinux.com
Thu Oct 15 04:44:18 PDT 2015



On 10/15/2015 02:38 PM, Pavel Emelyanov wrote:
>> +class criu:
>> +	"""
>> +	Call criu through RPC.
>> +	"""
>> +	opts		= None #CRIU options in pb format
>> +
>> +	_comm		= None #Communication method
>> +
>> +	def __init__(self):
>> +		self.use_binary('criu')
>> +		self.opts = rpc.criu_opts()
> So default opts are always to be used, right? How can caller change them?

To change comm method user could just use use_{sk,fd,bin} methods listed 
below.

Pb opts are just accessed like criu.opts.pid = 123456. User is able to 
provide its own
instance of pb opts by just doing criu.opts = my_opts, and criu class 
will take care
of merging them into request(this is an important part, as if i recall 
correctly, in python
implementation of protobuf you can't just req.opts = my_opts).

>> +
>> +	def use_sk(self, sk_name):
>> +		"""
>> +		Access criu using unix socket which that belongs to criu service daemon.
>> +		"""
>> +		self._comm = _criu_comm_sk(sk_name)
>> +



More information about the CRIU mailing list