[CRIU] [PATCH cr 05/10] crtools: add options for lock/unlock network scripts

Andrey Vagin avagin at openvz.org
Thu Sep 13 09:10:25 EDT 2012


Network is locked before dump and it unlocked after restore and
in case any error in a dump process.

E.g.: This scripts can detach/attach veth in a bridge for containers

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 crtools.c         |   10 ++++++++++
 include/crtools.h |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/crtools.c b/crtools.c
index 4210307..4e3b358 100644
--- a/crtools.c
+++ b/crtools.c
@@ -94,6 +94,8 @@ int main(int argc, char *argv[])
 			{ "pidfile", required_argument, 0, 46},
 			{ "veth-pair", required_argument, 0, 47},
 			{ "partial-session", required_argument, 0, 48},
+			{ "unlock-network", required_argument, 0, 49},
+			{ "lock-network", required_argument, 0, 50},
 			{ },
 		};
 
@@ -199,6 +201,12 @@ int main(int argc, char *argv[])
 		case 48:
 			opts.partial_session = true;
 			break;
+		case 49:
+			opts.unlock_network = optarg;
+			break;
+		case 50:
+			opts.lock_network = optarg;
+			break;
 		case 'V':
 			pr_msg("Version: %d.%d\n", CRIU_VERSION_MAJOR, CRIU_VERSION_MINOR);
 			return 0;
@@ -290,6 +298,8 @@ usage:
 	pr_msg("  --evasive-devices	use any path to a device file if the original one is inaccessible\n");
 	pr_msg("  --partial-session	allow to work with a part of a process session\n");
 	pr_msg("  --veth-pair [IN=OUT]	correspondence between outside and inside names of veth devices\n");
+	pr_msg("  --unlock-net [SCRIPT] unlock nework script\n");
+	pr_msg("  --lock-net [SCRIPT] 	lock network script\n");
 
 	pr_msg("\n* Logging:\n");
 	pr_msg("  -o|--log-file [NAME]  log file name (relative path is relative to --images-dir)\n");
diff --git a/include/crtools.h b/include/crtools.h
index aab8626..d326b00 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -97,6 +97,8 @@ struct cr_options {
 	char			*root;
 	char			*pidfile;
 	struct list_head	veth_pairs;
+	char			*unlock_network;
+	char			*lock_network;
 };
 
 extern struct cr_options opts;
-- 
1.7.1



More information about the CRIU mailing list