[CRIU] [PATCH 1/2] p.haul: return fs transfer statistics from fs driver

Nikita Spiridonov nspiridonov at virtuozzo.com
Wed Feb 24 03:42:36 PST 2016


Return optional fs transfer statistics from ploop fs driver, add
stubs for other fs drivers.

Signed-off-by: Nikita Spiridonov <nspiridonov at virtuozzo.com>
---
 phaul/fs_haul_ploop.py   |   13 ++++++++++---
 phaul/fs_haul_shared.py  |    6 +++---
 phaul/fs_haul_subtree.py |    4 +++-
 phaul/mstats.py          |    5 +++++
 4 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/phaul/fs_haul_ploop.py b/phaul/fs_haul_ploop.py
index dc115d3..f26eb67 100644
--- a/phaul/fs_haul_ploop.py
+++ b/phaul/fs_haul_ploop.py
@@ -6,6 +6,7 @@ import os
 import logging
 import threading
 import libploop
+import mstats
 
 
 DDXML_FILENAME = "DiskDescriptor.xml"
@@ -35,16 +36,22 @@ class p_haul_fs:
 		pass
 
 	def start_migration(self):
+		total_xferred = 0
 		for ploopcopy in self.__ploop_copies:
-			ploopcopy.copy_start()
+			total_xferred += ploopcopy.copy_start()
+		return mstats.fs_iter_stats(total_xferred)
 
 	def next_iteration(self):
+		total_xferred = 0
 		for ploopcopy in self.__ploop_copies:
-			ploopcopy.copy_next_iteration()
+			total_xferred += ploopcopy.copy_next_iteration()
+		return mstats.fs_iter_stats(total_xferred)
 
 	def stop_migration(self):
+		total_xferred = 0
 		for ploopcopy in self.__ploop_copies:
-			ploopcopy.copy_stop()
+			total_xferred += ploopcopy.copy_stop()
+		return mstats.fs_iter_stats(total_xferred)
 
 	def persistent_inodes(self):
 		"""Inode numbers do not change during ploop disk migration"""
diff --git a/phaul/fs_haul_shared.py b/phaul/fs_haul_shared.py
index 9e373a5..77a5a27 100644
--- a/phaul/fs_haul_shared.py
+++ b/phaul/fs_haul_shared.py
@@ -16,13 +16,13 @@ class p_haul_fs:
 		pass
 
 	def start_migration(self):
-		pass
+		return None
 
 	def next_iteration(self):
-		pass
+		return None
 
 	def stop_migration(self):
-		pass
+		return None
 
 	# Inode numbers do not change on this FS
 	# during migration
diff --git a/phaul/fs_haul_subtree.py b/phaul/fs_haul_subtree.py
index 405f840..7f7e46d 100644
--- a/phaul/fs_haul_subtree.py
+++ b/phaul/fs_haul_subtree.py
@@ -45,13 +45,15 @@ class p_haul_fs:
 	def start_migration(self):
 		logging.info("Starting FS migration")
 		self.__run_rsync()
+		return None
 
 	def next_iteration(self):
-		pass
+		return None
 
 	def stop_migration(self):
 		logging.info("Doing final FS sync")
 		self.__run_rsync()
+		return None
 
 	# When rsync-ing FS inodes number will change
 	def persistent_inodes(self):
diff --git a/phaul/mstats.py b/phaul/mstats.py
index a10bdaf..d1b276d 100644
--- a/phaul/mstats.py
+++ b/phaul/mstats.py
@@ -6,6 +6,11 @@ def usec2sec(usec):
 	return usec / 1000000.
 
 
+class fs_iter_stats:
+	def __init__(self, bytes_xferred):
+		self.bytes_xferred = bytes_xferred
+
+
 class migration_stats:
 	def __init__(self):
 		self._iter_fr_times = []
-- 
1.7.1



More information about the CRIU mailing list