[lxc-devel] [lxc/master] bugfixes

brauner on Github lxc-bot at linuxcontainers.org
Mon Nov 27 20:21:42 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 413 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171127/94661bd8/attachment.bin>
-------------- next part --------------
From ec30b76918e0f5cdd357311dbfd018311e1a7d04 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 27 Nov 2017 12:28:44 +0100
Subject: [PATCH 1/2] criu: detect veth name

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
Signed-off-by: Adrian Reber <areber at redhat.com>
---
 src/lxc/criu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 96688edc0..2d26f3e76 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -564,6 +564,8 @@ static void exec_criu(struct criu_opts *opts)
 			switch (n->type) {
 			case LXC_NET_VETH:
 				veth = n->priv.veth_attr.pair;
+				if (veth[0] == '\0')
+					veth = n->priv.veth_attr.veth1;
 
 				if (n->link[0] != '\0') {
 					if (external_not_veth)

From 7fca77a66beae87d455abcf2c9847c1efb2932b6 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 27 Nov 2017 13:01:22 +0100
Subject: [PATCH 2/2] confile: parse storage type

Split lxc.rootfs.path = <storage type>:<container path> into <storage-type> and
<container path> to set the storage type and rootfs path value correctly.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
Signed-off-by: Adrian Reber <areber at redhat.com>
---
 src/lxc/confile.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 17f48762c..993144188 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -1962,7 +1962,41 @@ static int set_config_includefiles(const char *key, const char *value,
 static int set_config_rootfs_path(const char *key, const char *value,
 				  struct lxc_conf *lxc_conf, void *data)
 {
-	return set_config_path_item(&lxc_conf->rootfs.path, value);
+	int ret;
+	char *dup, *tmp;
+	const char *container_path;
+
+	if (lxc_config_value_empty(value)) {
+		free(lxc_conf->rootfs.path);
+		lxc_conf->rootfs.path = NULL;
+		return 0;
+	}
+
+	dup = strdup(value);
+	if (!dup)
+		return -1;
+
+	/* Split <storage type>:<container path> into <storage type> and
+	 * <container path>. Set "rootfs.bdev_type" to <storage type> and
+	 * "rootfs.path" to <container path>.
+	 */
+	tmp = strchr(dup, ':');
+	if (tmp) {
+		*tmp = '\0';
+		ret = set_config_path_item(&lxc_conf->rootfs.bdev_type, dup);
+		if (ret < 0) {
+			free(dup);
+			return -1;
+		}
+		tmp++;
+		container_path = tmp;
+	} else {
+		container_path = value;
+	}
+
+	ret = set_config_path_item(&lxc_conf->rootfs.path, container_path);
+	free(dup);
+	return ret;
 }
 
 static int set_config_rootfs_mount(const char *key, const char *value,


More information about the lxc-devel mailing list