[lxc-devel] [lxd-demo-server/master] Make container/image profiles configurable

rsommer on Github lxc-bot at linuxcontainers.org
Thu Feb 23 15:47:18 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 421 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170223/95d3f419/attachment.bin>
-------------- next part --------------
From 23fffaee0df47e301e861d6972b5d964b33a6c2c Mon Sep 17 00:00:00 2001
From: Roland Sommer <rol at ndsommer.de>
Date: Thu, 23 Feb 2017 16:41:07 +0100
Subject: [PATCH] Make container/image profiles configurable

---
 lxd-demo.yaml.example | 3 +++
 main.go               | 5 +++--
 rest.go               | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lxd-demo.yaml.example b/lxd-demo.yaml.example
index 2fca6ef..c512db0 100644
--- a/lxd-demo.yaml.example
+++ b/lxd-demo.yaml.example
@@ -1,5 +1,8 @@
 container: "my-base-container"
 image: "my-image"
+profiles:
+    - default
+    - docker
 feedback: true
 feedback_timeout: 30
 quota_cpu: 1
diff --git a/main.go b/main.go
index 1c87d90..3d1d10b 100644
--- a/main.go
+++ b/main.go
@@ -22,8 +22,9 @@ var lxdDaemon *lxd.Client
 var config serverConfig
 
 type serverConfig struct {
-	Container string `yaml:"container"`
-	Image     string `yaml:"image"`
+	Container string   `yaml:"container"`
+	Image     string   `yaml:"image"`
+	Profiles  []string `yaml:"profiles"`
 
 	Feedback        bool `yaml:"feedback"`
 	FeedbackTimeout int  `yaml:"feedback_timeout"`
diff --git a/rest.go b/rest.go
index c010631..6d3ca77 100644
--- a/rest.go
+++ b/rest.go
@@ -362,9 +362,9 @@ users:
 
 	var resp *api.Response
 	if config.Container != "" {
-		resp, err = lxdDaemon.LocalCopy(config.Container, containerName, ctConfig, nil, false)
+		resp, err = lxdDaemon.LocalCopy(config.Container, containerName, ctConfig, config.Profiles, false)
 	} else {
-		resp, err = lxdDaemon.Init(containerName, "local", config.Image, nil, ctConfig, nil, false)
+		resp, err = lxdDaemon.Init(containerName, "local", config.Image, &config.Profiles, ctConfig, nil, false)
 	}
 
 	if err != nil {


More information about the lxc-devel mailing list