[CRIU] [PATCH 10/12] p.haul: add pre_final_setup function

Nikita Spiridonov nspiridonov at virtuozzo.com
Tue Apr 5 04:20:23 PDT 2016


I am not sure that new rpc call needed here (rpc_final_cleanup). Why
desired action (merge of shared ploop disks snapshots) can't be done in
phaul_service.rpc_restore_from_images?
 
As for me it is better to merge snapshots in
phaul_service.rpc_restore_from_images or in phaul_service.on_disconnect,
additional rpc call complicate logic, but maybe I miss something.
Xemul, what do you think about it? 

phaul_service.on_disconnect is prefferable since it handle cleanup in
both success and failure cases, but it is impossible to pass some extra
data (self.fs.prepare_src_data) to this call.

On Mon, 2016-04-04 at 17:27 +0300, Alexander Burluka wrote:
> Signed-off-by: Alexander Burluka <aburluka at virtuozzo.com>
> ---
>  phaul/p_haul_docker.py | 3 +++
>  phaul/p_haul_lxc.py    | 3 +++
>  phaul/p_haul_pid.py    | 3 +++
>  phaul/p_haul_vz.py     | 5 +++++
>  phaul/service.py       | 3 +++
>  5 files changed, 17 insertions(+)
> 
> diff --git a/phaul/p_haul_docker.py b/phaul/p_haul_docker.py
> index 626ebd0..abb1716 100644
> --- a/phaul/p_haul_docker.py
> +++ b/phaul/p_haul_docker.py
> @@ -138,6 +138,9 @@ class p_haul_type:
>  			pid = int(line.split(None, 1)[0])
>  			os.kill(pid, signal.SIGKILL)
>  
> +	def pre_final_setup(self, source_data):
> +		pass
> +
>  	def final_restore(self, img, criu):
>  		logf = open("/tmp/docker_restore.log", "w+")
>  
> diff --git a/phaul/p_haul_lxc.py b/phaul/p_haul_lxc.py
> index 5303574..8dc77b5 100644
> --- a/phaul/p_haul_lxc.py
> +++ b/phaul/p_haul_lxc.py
> @@ -118,6 +118,9 @@ class p_haul_type:
>  	def final_dump(self, pid, img, ccon, fs):
>  		criu_cr.criu_dump(self, pid, img, ccon, fs)
>  
> +	def pre_final_setup(self, source_data):
> +		pass
> +
>  	def final_restore(self, img, connection):
>  		criu_cr.criu_restore(self, img, connection)
>  
> diff --git a/phaul/p_haul_pid.py b/phaul/p_haul_pid.py
> index 061a766..ae32699 100644
> --- a/phaul/p_haul_pid.py
> +++ b/phaul/p_haul_pid.py
> @@ -73,6 +73,9 @@ class p_haul_type:
>  	def final_dump(self, pid, img, ccon, fs):
>  		criu_cr.criu_dump(self, pid, img, ccon, fs)
>  
> +	def pre_final_setup(self, source_data):
> +		pass
> +
>  	def final_restore(self, img, connection):
>  		criu_cr.criu_restore(self, img, connection)
>  
> diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
> index 8055f69..8321520 100644
> --- a/phaul/p_haul_vz.py
> +++ b/phaul/p_haul_vz.py
> @@ -166,6 +166,11 @@ class p_haul_type:
>  	def final_dump(self, pid, img, ccon, fs):
>  		criu_cr.criu_dump(self, pid, img, ccon, fs)
>  
> +	def pre_final_setup(self, src_data):
> +		if "shareds" in src_data:
> +			for ploop in src_data["shareds"]:
> +				fs_haul_ploop.merge_ploop_snapshot(ploop["ddxml"], ploop["guid"])
> +
>  	def final_restore(self, img, connection):
>  		"""Perform Virtuozzo-specific final restore"""
>  		try:
> diff --git a/phaul/service.py b/phaul/service.py
> index ecb0cc8..62b7ff6 100644
> --- a/phaul/service.py
> +++ b/phaul/service.py
> @@ -115,3 +115,6 @@ class phaul_service:
>  		self.htype.start()
>  		logging.info("Start succeeded")
>  		self.restored = True
> +
> +	def rpc_final_cleanup(self, src_data):
> +		self.htype.pre_final_setup(src_data)




More information about the CRIU mailing list