[CRIU] [PATCH 4/4] p.haul: fix bug in get_fs_receiver function in Virtuozzo module

Nikita Spiridonov nspiridonov at odin.com
Wed Nov 18 04:14:42 PST 2015


Create ploop fs receiver only if containers private resides on ext3
or ext4 filesystem. It is needed since opposite get_fs function also
create ploop fs under that condition.

We have to rework fs creation in future anyway since current shared
fs processing incorrect, but current patch better than previous
behaviour as for me.

Signed-off-by: Nikita Spiridonov <nspiridonov at odin.com>
---
 phaul/p_haul_vz.py |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
index 7470e97..cc5e237 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -190,27 +190,32 @@ class p_haul_type:
 			self._fs_mounted = False
 
 	def get_fs(self, fs_sk=None):
-
-		rootfs = util.path_to_fs(self._ct_priv)
-		if not rootfs:
-			logging.info("CT is on unknown FS")
-			return None
-
+		rootfs = self.__get_priv_fs_name()
 		logging.info("CT is on %s", rootfs)
-
 		if rootfs == "nfs":
 			return fs_haul_shared.p_haul_fs()
-		if rootfs == "ext3" or rootfs == "ext4":
+		elif rootfs == "ext3" or rootfs == "ext4":
 			ddxml_path = os.path.join(self._ct_priv, "root.hdd",
 				"DiskDescriptor.xml")
 			return fs_haul_ploop.p_haul_fs(ddxml_path, fs_sk)
-
-		logging.info("Unknown CT FS")
-		return None
+		else:
+			logging.error("Unknown CT FS")
+			return None
 
 	def get_fs_receiver(self, fs_sk=None):
-		fname_path = os.path.join(self._ct_priv, "root.hdd", "root.hds")
-		return fs_haul_ploop.p_haul_fs_receiver(fname_path, fs_sk)
+		rootfs = self.__get_priv_fs_name()
+		logging.info("CT is on %s", rootfs)
+		if rootfs == "ext3" or rootfs == "ext4":
+			fname_path = os.path.join(self._ct_priv, "root.hdd", "root.hds")
+			return fs_haul_ploop.p_haul_fs_receiver(fname_path, fs_sk)
+		else:
+			return None
+
+	def __get_priv_fs_name(self):
+		rootfs = util.path_to_fs(self._ct_priv)
+		if not rootfs:
+			raise Exception("CT is on unknown FS")
+		return rootfs
 
 	def restored(self, pid):
 		pass
-- 
1.7.1



More information about the CRIU mailing list