[CRIU] [PATCH 1/6] p.haul: implement fs receiver interface
Nikita Spiridonov
nspiridonov at odin.com
Mon Oct 12 10:32:16 PDT 2015
Implement fs receiver interface needed for iterative disks migration
over existing connection.
Now p.haul-service ask module for special fs_receiver object and start
it if object provided. fs and fs_receiver object on client and service
sides respectively interact via fs_sk.
Signed-off-by: Nikita Spiridonov <nspiridonov at odin.com>
---
phaul/p_haul_iters.py | 2 +-
phaul/p_haul_lxc.py | 5 ++++-
phaul/p_haul_pid.py | 5 ++++-
phaul/p_haul_service.py | 11 +++++++++++
phaul/p_haul_vz.py | 6 +++++-
5 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/phaul/p_haul_iters.py b/phaul/p_haul_iters.py
index 06049d3..875337a 100644
--- a/phaul/p_haul_iters.py
+++ b/phaul/p_haul_iters.py
@@ -35,7 +35,7 @@ class phaul_iter_worker:
if not self.htype:
raise Exception("No htype driver found")
- self.fs = self.htype.get_fs()
+ self.fs = self.htype.get_fs(self.connection.fs_sk)
if not self.fs:
raise Exception("No FS driver found")
diff --git a/phaul/p_haul_lxc.py b/phaul/p_haul_lxc.py
index 47e9353..d94841b 100644
--- a/phaul/p_haul_lxc.py
+++ b/phaul/p_haul_lxc.py
@@ -144,9 +144,12 @@ class p_haul_type:
self._fs_mounted = True
return nroot
- def get_fs(self):
+ def get_fs(self, fs_sk=None):
return fs_haul_shared.p_haul_fs()
+ def get_fs_receiver(self, fs_sk=None):
+ return None
+
def restored(self, pid):
self.__apply_cg_config()
diff --git a/phaul/p_haul_pid.py b/phaul/p_haul_pid.py
index 47cf651..e604991 100644
--- a/phaul/p_haul_pid.py
+++ b/phaul/p_haul_pid.py
@@ -46,9 +46,12 @@ class p_haul_type:
pass
# Get driver for FS migration
- def get_fs(self):
+ def get_fs(self, fs_sk=None):
return fs_haul_shared.p_haul_fs()
+ def get_fs_receiver(self, fs_sk=None):
+ return None
+
# Get list of files which should be copied to
# the destination node. The dir argument is where
# temporary stuff can be put
diff --git a/phaul/p_haul_service.py b/phaul/p_haul_service.py
index 87da8e9..11883a6 100644
--- a/phaul/p_haul_service.py
+++ b/phaul/p_haul_service.py
@@ -16,6 +16,7 @@ class phaul_service:
self._fs_sk = fs_sk
self.img = None
self.htype = None
+ self.__fs_receiver = None
self.dump_iter_index = 0
self.restored = False
@@ -30,6 +31,10 @@ class phaul_service:
if self.htype and not self.restored:
self.htype.umount()
+ # Stop fs receiver if it is running
+ if self.__fs_receiver:
+ self.__fs_receiver.join()
+
if self.img:
logging.info("Closing images")
if not self.restored:
@@ -39,9 +44,15 @@ class phaul_service:
def rpc_setup(self, htype_id):
logging.info("Setting up service side %s", htype_id)
self.img = images.phaul_images("rst")
+
self.criu_connection = criu_api.criu_conn(self._mem_sk)
self.htype = p_haul_type.get_dst(htype_id)
+ # Create and start fs receiver if current p.haul module provide it
+ self.__fs_receiver = self.htype.get_fs_receiver(self._fs_sk)
+ if self.__fs_receiver:
+ self.__fs_receiver.start()
+
def rpc_set_options(self, opts):
self.criu_connection.verbose(opts["verbose"])
self.criu_connection.shell_job(opts["shell_job"])
diff --git a/phaul/p_haul_vz.py b/phaul/p_haul_vz.py
index 7710cde..f25c1a0 100644
--- a/phaul/p_haul_vz.py
+++ b/phaul/p_haul_vz.py
@@ -206,7 +206,8 @@ class p_haul_type:
logging.info(proc_output)
self._fs_mounted = False
- def get_fs(self):
+ 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")
@@ -222,6 +223,9 @@ class p_haul_type:
logging.info("Unknown CT FS")
return None
+ def get_fs_receiver(self, fs_sk=None):
+ return None
+
def restored(self, pid):
self.__apply_cg_config()
--
1.7.1
More information about the CRIU
mailing list