[CRIU] [PATCH 4/5] p.haul: fix VZ containers mounting and unmounting

Nikita Spiridonov nspiridonov at odin.com
Tue Jun 30 07:18:29 PDT 2015


We have to use vzctl mount/umount subcommands for Virtuozzo
containers mounting and unmounting during migration instead of usual
mount/umount commands. Expect that at the moment of mounting all
required files already transferred to destination so vzctl can
mount private area using just container ID.

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

diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
index b674a8a..fbb5564 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -126,23 +126,18 @@ class p_haul_type:
 	def prepare_ct(self, pid):
 		p_haul_cgroup.restore_hier(pid, self.cg_img)
 
-	def __umount_root(self):
-		print "Umounting CT root"
-		os.system("umount %s" % self.__ct_root())
-		self._fs_mounted = False
-
 	def mount(self):
 		nroot = self.__ct_root()
 		print "Mounting CT root to %s" % nroot
-		if not os.access(nroot, os.F_OK):
-			os.makedirs(nroot)
-		os.system("mount --bind %s %s" % (self.__ct_priv(), nroot))
+		os.system("vzctl mount {0}".format(self._ctid))
 		self._fs_mounted = True
 		return nroot
 
 	def umount(self):
 		if self._fs_mounted:
-			self.__umount_root()
+			print "Umounting CT root"
+			os.system("vzctl umount {0}".format(self._ctid))
+			self._fs_mounted = False
 
 	def get_fs(self):
 		rootfs = util.path_to_fs(self.__ct_priv())
-- 
1.7.1



More information about the CRIU mailing list