[lxc-devel] [lxc-utils/master] tree-wide: remove legacy config items

brauner on Github lxc-bot at linuxcontainers.org
Mon Feb 12 09:23:02 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 367 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180212/f73f409d/attachment.bin>
-------------- next part --------------
From 916b0ce9d87e0c45142f4a1639067063e27dec9c Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 12 Feb 2018 10:21:41 +0100
Subject: [PATCH] tree-wide: remove legacy config items

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/arguments.c      |  8 ++++----
 src/lxc_attach.c     |  3 ---
 src/lxc_autostart.c  |  3 ---
 src/lxc_cgroup.c     |  3 ---
 src/lxc_checkpoint.c |  3 ---
 src/lxc_clone.c      |  2 --
 src/lxc_config.c     |  2 --
 src/lxc_console.c    |  3 ---
 src/lxc_copy.c       |  3 ---
 src/lxc_create.c     |  3 ---
 src/lxc_destroy.c    |  3 ---
 src/lxc_device.c     |  3 ---
 src/lxc_execute.c    |  3 ---
 src/lxc_freeze.c     |  3 ---
 src/lxc_info.c       |  3 ---
 src/lxc_ls.c         | 12 ++----------
 src/lxc_monitor.c    |  3 ---
 src/lxc_snapshot.c   |  3 ---
 src/lxc_start.c      |  3 ---
 src/lxc_stop.c       |  3 ---
 src/lxc_unfreeze.c   |  3 ---
 src/lxc_wait.c       |  3 ---
 22 files changed, 6 insertions(+), 72 deletions(-)

diff --git a/src/arguments.c b/src/arguments.c
index 10f66c2..bdd5e14 100644
--- a/src/arguments.c
+++ b/src/arguments.c
@@ -320,13 +320,13 @@ bool lxc_setup_shared_ns(struct lxc_arguments *args, struct lxc_container *c)
 			continue;
 
 		if (i == LXC_NS_NET)
-			key = "lxc.namespace.net";
+			key = "lxc.namespace.share.net";
 		else if (i == LXC_NS_IPC)
-			key = "lxc.namespace.ipc";
+			key = "lxc.namespace.share.ipc";
 		else if (i == LXC_NS_UTS)
-			key = "lxc.namespace.uts";
+			key = "lxc.namespace.share.uts";
 		else if (i == LXC_NS_PID)
-			key = "lxc.namespace.pid";
+			key = "lxc.namespace.share.pid";
 		else
 			continue;
 
diff --git a/src/lxc_attach.c b/src/lxc_attach.c
index 1a062f7..5abea47 100644
--- a/src/lxc_attach.c
+++ b/src/lxc_attach.c
@@ -291,9 +291,6 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	struct lxc_container *c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c)
 		exit(EXIT_FAILURE);
diff --git a/src/lxc_autostart.c b/src/lxc_autostart.c
index 7313d4e..aceef78 100644
--- a/src/lxc_autostart.c
+++ b/src/lxc_autostart.c
@@ -357,9 +357,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	count = list_defined_containers(my_args.lxcpath[0], NULL, &containers);
 
 	if (count < 0)
diff --git a/src/lxc_cgroup.c b/src/lxc_cgroup.c
index 545112b..27d5c50 100644
--- a/src/lxc_cgroup.c
+++ b/src/lxc_cgroup.c
@@ -86,9 +86,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	state_object = my_args.argv[0];
 
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
diff --git a/src/lxc_checkpoint.c b/src/lxc_checkpoint.c
index 27bc464..dda3075 100644
--- a/src/lxc_checkpoint.c
+++ b/src/lxc_checkpoint.c
@@ -251,9 +251,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c) {
 		fprintf(stderr, "System error loading %s\n", my_args.name);
diff --git a/src/lxc_clone.c b/src/lxc_clone.c
index 4dca80b..b76d866 100644
--- a/src/lxc_clone.c
+++ b/src/lxc_clone.c
@@ -205,8 +205,6 @@ int main(int argc, char *argv[])
 		usage(argv[0]);
 	}
 
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c1 = lxc_container_new(orig, lxcpath);
 	if (!c1)
 		exit(EXIT_FAILURE);
diff --git a/src/lxc_config.c b/src/lxc_config.c
index 682257f..775923e 100644
--- a/src/lxc_config.c
+++ b/src/lxc_config.c
@@ -60,8 +60,6 @@ int main(int argc, char *argv[])
 	struct lxc_config_items *i;
 	const char *value;
 
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	if (argc < 2 || strcmp(argv[1], "-h") == 0 ||
 			strcmp(argv[1], "--help") == 0)
 		usage(argv[0]);
diff --git a/src/lxc_console.c b/src/lxc_console.c
index 910d88d..cca18bd 100644
--- a/src/lxc_console.c
+++ b/src/lxc_console.c
@@ -111,9 +111,6 @@ int main(int argc, char *argv[])
 	if (ret)
 		return EXIT_FAILURE;
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c) {
 		fprintf(stderr, "System error loading container\n");
diff --git a/src/lxc_copy.c b/src/lxc_copy.c
index 12723ff..3627264 100644
--- a/src/lxc_copy.c
+++ b/src/lxc_copy.c
@@ -179,9 +179,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(ret);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	if (geteuid()) {
 		if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
 			if (!my_args.quiet)
diff --git a/src/lxc_create.c b/src/lxc_create.c
index f278f13..ea79fb0 100644
--- a/src/lxc_create.c
+++ b/src/lxc_create.c
@@ -241,9 +241,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	if (!my_args.template) {
 		fprintf(stderr, "A template must be specified.\n");
 		fprintf(stderr, "Use \"none\" if you really want a container without a rootfs.\n");
diff --git a/src/lxc_destroy.c b/src/lxc_destroy.c
index 3e24b48..484e9a8 100644
--- a/src/lxc_destroy.c
+++ b/src/lxc_destroy.c
@@ -86,9 +86,6 @@ int main(int argc, char *argv[])
 	if (my_args.quiet)
 		quiet = true;
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c) {
 		if (!quiet)
diff --git a/src/lxc_device.c b/src/lxc_device.c
index ccaaaf6..ed642e6 100644
--- a/src/lxc_device.c
+++ b/src/lxc_device.c
@@ -123,9 +123,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		goto err;
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c) {
 		fprintf(stderr, "%s doesn't exist\n", my_args.name);
diff --git a/src/lxc_execute.c b/src/lxc_execute.c
index e9aa384..9f81264 100644
--- a/src/lxc_execute.c
+++ b/src/lxc_execute.c
@@ -159,9 +159,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c) {
 		fprintf(stderr, "Failed to create lxc_container\n");
diff --git a/src/lxc_freeze.c b/src/lxc_freeze.c
index 09c21b3..66180a0 100644
--- a/src/lxc_freeze.c
+++ b/src/lxc_freeze.c
@@ -73,9 +73,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c) {
 		fprintf(stderr, "No such container: %s:%s\n", my_args.lxcpath[0], my_args.name);
diff --git a/src/lxc_info.c b/src/lxc_info.c
index d2487f3..6202e83 100644
--- a/src/lxc_info.c
+++ b/src/lxc_info.c
@@ -409,9 +409,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(ret);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	if (print_info(my_args.name, my_args.lxcpath[0]) == 0)
 		ret = EXIT_SUCCESS;
 
diff --git a/src/lxc_ls.c b/src/lxc_ls.c
index 0fd8d73..1394c12 100644
--- a/src/lxc_ls.c
+++ b/src/lxc_ls.c
@@ -228,9 +228,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	struct lengths max_len = {
 		/* default header length */
 		.name_length = 4,          /* NAME */
@@ -501,13 +498,13 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args,
 				l->swap = ls_get_swap(c);
 
 				val = c->get_running_config_item(c, "lxc.idmap");
-				l->unprivileged = (val == NULL);
+				l->unprivileged = !(val == NULL);
 				free(val);
 			} else {
 				int ret;
 
 				ret = c->get_config_item(c, "lxc.idmap", NULL, 0);
-				l->unprivileged = (ret == 0);
+				l->unprivileged = !(ret == 0);
 			}
 		}
 
@@ -559,11 +556,6 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args,
 			 * problem with the ovl_mkdir() function in
 			 * lxcoverlay.{c,h}. */
 			char *curr_path = ls_get_config_item(c, "lxc.rootfs.path", running);
-			/* REMOVE IN LXC 3.0
-			   legacy rootfs key
-			   */
-			if (!curr_path)
-				curr_path = ls_get_config_item(c, "lxc.rootfs", running);
 			if (!curr_path)
 				goto put_and_next;
 
diff --git a/src/lxc_monitor.c b/src/lxc_monitor.c
index bc64971..cf1961d 100644
--- a/src/lxc_monitor.c
+++ b/src/lxc_monitor.c
@@ -521,9 +521,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(rc_main);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	if (quit_monitord) {
 		int ret = EXIT_SUCCESS;
 		for (i = 0; i < my_args.lxcpath_cnt; i++) {
diff --git a/src/lxc_snapshot.c b/src/lxc_snapshot.c
index 1b8804d..adf0cc3 100644
--- a/src/lxc_snapshot.c
+++ b/src/lxc_snapshot.c
@@ -97,9 +97,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	if (geteuid()) {
 		if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
 			fprintf(stderr, "You lack access to %s\n",
diff --git a/src/lxc_start.c b/src/lxc_start.c
index 1c6e78e..c0691a4 100644
--- a/src/lxc_start.c
+++ b/src/lxc_start.c
@@ -206,9 +206,6 @@ int main(int argc, char *argv[])
 		exit(err);
 	}
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	/*
 	 * rcfile possibilities:
 	 * 1. rcfile from random path specified in cli option
diff --git a/src/lxc_stop.c b/src/lxc_stop.c
index 2c4b378..1dae4cf 100644
--- a/src/lxc_stop.c
+++ b/src/lxc_stop.c
@@ -114,9 +114,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(ret);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	/* Set default timeout */
 	if (my_args.timeout == -2) {
 		if (my_args.hardstop)
diff --git a/src/lxc_unfreeze.c b/src/lxc_unfreeze.c
index f422199..d6b2f2b 100644
--- a/src/lxc_unfreeze.c
+++ b/src/lxc_unfreeze.c
@@ -74,9 +74,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c) {
 		fprintf(stderr, "No such container: %s:%s\n", my_args.lxcpath[0], my_args.name);
diff --git a/src/lxc_wait.c b/src/lxc_wait.c
index 5ec9bc0..8992df0 100644
--- a/src/lxc_wait.c
+++ b/src/lxc_wait.c
@@ -100,9 +100,6 @@ int main(int argc, char *argv[])
 	if (lxc_log_init(&log))
 		exit(EXIT_FAILURE);
 
-	/* REMOVE IN LXC 3.0 */
-	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
 	c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
 	if (!c)
 		exit(EXIT_FAILURE);


More information about the lxc-devel mailing list