[CRIU] [PATCH 06/12] p.haul: modify p_haul_fs initialization

Alexander Burluka aburluka at virtuozzo.com
Fri Apr 1 08:45:23 PDT 2016


Add migration mode variable and parsing of shared disks

Signed-off-by: Alexander Burluka <aburluka at virtuozzo.com>
---
 phaul/fs_haul_ploop.py | 11 +++++++++--
 phaul/iters.py         | 10 ++++++----
 phaul/p_haul_vz.py     |  4 ++--
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/phaul/fs_haul_ploop.py b/phaul/fs_haul_ploop.py
index 63c2a64..f59f831 100644
--- a/phaul/fs_haul_ploop.py
+++ b/phaul/fs_haul_ploop.py
@@ -8,6 +8,7 @@ import logging
 import threading
 import libploop
 import mstats
+import iters
 
 
 DDXML_FILENAME = "DiskDescriptor.xml"
@@ -59,7 +60,7 @@ class shared_ploop:
 
 
 class p_haul_fs:
-	def __init__(self, deltas, ct_priv):
+	def __init__(self, deltas, ct_priv, mode):
 		"""Initialize ploop disks hauler
 
 		For each disk create libploop.ploopcopy object using path to disk
@@ -69,6 +70,8 @@ class p_haul_fs:
 		# Create libploop.ploopcopy objects, one per active ploop delta
 		self.__log_init_hauler(deltas)
 		self.__ct_priv = ct_priv
+		self.__mode = mode
+		self.__shared_ploops = []
 		self.__ploop_copies = []
 		for delta_path, delta_fd in deltas:
 			ddxml_path = get_ddxml_path(delta_path)
@@ -82,7 +85,11 @@ class p_haul_fs:
 		return (get_ploop_delta_abspath(s, self.__ct_priv) for s in shareds.split(","))
 
 	def set_options(self, opts):
-		pass
+		if iters.is_live_mode(self.__mode):
+			if "shared" in opts:
+				shareds = self.__parse_shared_ploops(opts["shared"])
+				for shared in shareds:
+					self.__shared_ploops.append(shared_ploop(shared))
 
 	def set_work_dir(self, wdir):
 		pass
diff --git a/phaul/iters.py b/phaul/iters.py
index cbac565..9a2f325 100644
--- a/phaul/iters.py
+++ b/phaul/iters.py
@@ -59,15 +59,17 @@ class phaul_iter_worker:
 		if not self.htype:
 			raise Exception("No htype driver found")
 
-		self.fs = self.htype.get_fs(self.connection.fdfs)
-		if not self.fs:
-			raise Exception("No FS driver found")
-
 		self.img = None
 		self.criu_connection = None
+		m = None
 		if is_live_mode(self.__mode):
 			self.img = images.phaul_images("dmp")
 			self.criu_connection = criu_api.criu_conn(self.connection.mem_sk)
+			m = self.__mode
+
+		self.fs = self.htype.get_fs(self.connection.fdfs, m)
+		if not self.fs:
+			raise Exception("No FS driver found")
 
 		logging.info("Setting up remote")
 		self.target_host.setup(p_type, mode)
diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
index 49c756a..8055f69 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -233,9 +233,9 @@ class p_haul_type:
 		logging.info(proc_output)
 		self._fs_mounted = not umount
 
-	def get_fs(self, fdfs=None):
+	def get_fs(self, fdfs=None, mode=None):
 		deltas = self.__parse_fdfs_arg(fdfs)
-		return fs_haul_ploop.p_haul_fs(deltas, self._ct_priv)
+		return fs_haul_ploop.p_haul_fs(deltas, self._ct_priv, mode)
 
 	def get_fs_receiver(self, fdfs=None):
 		deltas = self.__parse_fdfs_arg(fdfs)
-- 
1.8.3.1



More information about the CRIU mailing list