[CRIU] [PATCH 2/3] p.haul: handle migration with id change

Nikita Spiridonov nspiridonov at virtuozzo.com
Fri Apr 15 06:12:58 PDT 2016


Handle migration with id change.

For example, now we can migrate Virtuozzo container 123 to new id 124
using "--dst-id" option.

Signed-off-by: Nikita Spiridonov <nspiridonov at virtuozzo.com>
---
 p.haul         |    3 ++-
 phaul/iters.py |    5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/p.haul b/p.haul
index cd9d6a7..749d8ea 100755
--- a/p.haul
+++ b/p.haul
@@ -42,7 +42,8 @@ connection = phaul.connection.establish(args.fdrpc, args.fdmem, args.fdfs)
 
 # Start the migration
 ph_type = args.type, args.id
-worker = phaul.iters.phaul_iter_worker(ph_type, args.mode, connection)
+worker = phaul.iters.phaul_iter_worker(ph_type, args.dst_id, args.mode,
+	connection)
 worker.set_options(vars(args))
 worker.start_migration()
 
diff --git a/phaul/iters.py b/phaul/iters.py
index e0c6175..78bb470 100644
--- a/phaul/iters.py
+++ b/phaul/iters.py
@@ -49,7 +49,7 @@ class iter_consts:
 
 
 class phaul_iter_worker:
-	def __init__(self, p_type, mode, connection):
+	def __init__(self, p_type, dst_id, mode, connection):
 		self.__mode = mode
 		self.connection = connection
 		self.target_host = xem_rpc_client.rpc_proxy(self.connection.rpc_sk)
@@ -70,7 +70,8 @@ class phaul_iter_worker:
 			self.criu_connection = criu_api.criu_conn(self.connection.mem_sk)
 
 		logging.info("Setting up remote")
-		self.target_host.setup(p_type, mode)
+		p_dst_type = (p_type[0], dst_id if dst_id else p_type[1])
+		self.target_host.setup(p_dst_type, mode)
 
 	def get_target_host(self):
 		return self.target_host
-- 
1.7.1



More information about the CRIU mailing list