[CRIU] [PATCH v4 6/8] p.haul: Add htype target_cleanup method

Alexander Burluka aburluka at virtuozzo.com
Wed Apr 13 03:26:01 PDT 2016


That method is called on end of migration scenario with
shared disk. It does useful work only in VZ case, it
does merge of shared ploops deltas. That operation is
required to be done on target side, so new rpc call is
also introduced.
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..f8d90db 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 target_cleanup(self, src_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..5a48989 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 target_cleanup(self, src_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..fb2a6ad 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 target_cleanup(self, src_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 ade190f..bee24d1 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -211,6 +211,11 @@ class p_haul_type:
 			logging.info(proc_output)
 			self._fs_mounted = False
 
+	def target_cleanup(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 start(self):
 		logging.info("Starting CT")
 		logging.info("Running vzctl start")
diff --git a/phaul/service.py b/phaul/service.py
index ecb0cc8..9ea05ab 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_migration_complete(self, src_data):
+		self.htype.target_cleanup(src_data)
-- 
1.8.3.1



More information about the CRIU mailing list