[lxc-devel] [go-lxc/v2] Support working without template

angiglesias on Github lxc-bot at linuxcontainers.org
Sat Mar 23 17:03:56 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 420 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190323/366e8af1/attachment.bin>
-------------- next part --------------
From 65f8d745c1e430bdf9da921d83cb68ee98c710fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81ngel?= <angelo.fly1 at gmail.com>
Date: Sat, 23 Mar 2019 15:24:56 +0100
Subject: [PATCH] Updated binding behaviour when template value is "none" to
 create a container without template similar to the "lxc-create" command

---
 lxc-binding.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxc-binding.c b/lxc-binding.c
index 7e408c0..f5da9db 100644
--- a/lxc-binding.c
+++ b/lxc-binding.c
@@ -5,6 +5,7 @@
 // +build linux,cgo
 
 #include <stdbool.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <errno.h>
@@ -52,6 +53,9 @@ bool go_lxc_want_close_all_fds(struct lxc_container *c, bool state) {
 }
 
 bool go_lxc_create(struct lxc_container *c, const char *t, const char *bdevtype, int flags, char * const argv[]) {
+	if (strncmp(t, "none", strlen(t)) == 0) {
+		return c->create(c,NULL,bdevtype, NULL, !!(flags & LXC_CREATE_QUIET), argv);
+	}
 	return c->create(c, t, bdevtype, NULL, !!(flags & LXC_CREATE_QUIET), argv);
 }
 


More information about the lxc-devel mailing list