[CRIU] [PATCH 5/6] p.haul: add ploop fs hauler

Nikita Spiridonov nspiridonov at odin.com
Mon Oct 12 10:32:20 PDT 2015


Add ploop fs hauler which use libploop library (python-ploop
package) to handle iterative ploop disk migration.

Signed-off-by: Nikita Spiridonov <nspiridonov at odin.com>
---
 phaul/fs_haul_ploop.py |   57 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100644 phaul/fs_haul_ploop.py

diff --git a/phaul/fs_haul_ploop.py b/phaul/fs_haul_ploop.py
new file mode 100644
index 0000000..e430ed5
--- /dev/null
+++ b/phaul/fs_haul_ploop.py
@@ -0,0 +1,57 @@
+#
+# ploop disk hauler
+#
+
+import logging
+import threading
+import libploop
+
+class p_haul_fs:
+	def __init__(self, ddxml_path, fs_sk):
+		"""Initialize ploop disk hauler
+
+		Initialize ploop disk hauler with specified path to DiskDescriptor.xml
+		file and socket.
+		"""
+
+		logging.info("Initilized ploop hauler (%s)", ddxml_path)
+		self.__ploopcopy = libploop.ploopcopy(ddxml_path, fs_sk.fileno())
+
+	def set_options(self, opts):
+		pass
+
+	def set_work_dir(self, wdir):
+		pass
+
+	def start_migration(self):
+		self.__ploopcopy.copy_start()
+
+	def next_iteration(self):
+		self.__ploopcopy.copy_next_iteration()
+
+	def stop_migration(self):
+		self.__ploopcopy.copy_stop()
+
+	def persistent_inodes(self):
+		"""Inode numbers do not change during ploop disk migration"""
+		return True
+
+class p_haul_fs_receiver(threading.Thread):
+	def __init__(self, fname_path, fs_sk):
+		"""Initialize ploop disk receiver
+
+		Initialize ploop disk receiver with specified path to root.hds file
+		and socket.
+		"""
+
+		threading.Thread.__init__(self)
+		self.__fname_path = fname_path
+		self.__fs_sk = fs_sk
+
+	def run(self):
+		try:
+			logging.info("Started fs receiver")
+			receiver = libploop.ploopcopy_receiver(self.__fname_path,
+				self.__fs_sk.fileno())
+		except:
+			logging.exception("Exception in p_haul_fs_receiver")
-- 
1.7.1



More information about the CRIU mailing list