[lxc-devel] [lxd/master] VM and CLI fixes
stgraber on Github
lxc-bot at linuxcontainers.org
Sat Jan 25 21:56:24 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200125/ad08aa5b/attachment.bin>
-------------- next part --------------
From 008309aa61b367284306a01957dfb707f4d7356b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 25 Jan 2020 23:17:38 +0200
Subject: [PATCH 1/2] lxd/instances: Don't rquire type on copy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #6774
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/containers_post.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lxd/containers_post.go b/lxd/containers_post.go
index a13838351b..f78781b903 100644
--- a/lxd/containers_post.go
+++ b/lxd/containers_post.go
@@ -550,6 +550,11 @@ func createFromCopy(d *Daemon, project string, req *api.InstancesPost) response.
return response.BadRequest(err)
}
+ // If type isn't specified, match the source type.
+ if req.Type == "" {
+ dbType = source.Type()
+ }
+
if dbType != instancetype.Any && dbType != source.Type() {
return response.BadRequest(fmt.Errorf("Instance type should not be specified or should match source type"))
}
From ee49331382e6b2ad180af0a8c423e582bd3d49d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 25 Jan 2020 23:55:42 +0200
Subject: [PATCH 2/2] lxc/config: Tweak argument processing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #6754
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxc/config.go | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/lxc/config.go b/lxc/config.go
index 5ad44a14b3..636d6df333 100644
--- a/lxc/config.go
+++ b/lxc/config.go
@@ -479,9 +479,35 @@ func (c *cmdConfigSet) Run(cmd *cobra.Command, args []string) error {
return err
}
+ hasKeyValue := func(args []string) bool {
+ for _, arg := range args {
+ if strings.Contains(arg, "=") {
+ return true
+ }
+ }
+
+ return false
+ }
+
+ onlyKeyValue := func(args []string) bool {
+ for _, arg := range args {
+ if !strings.Contains(arg, "=") {
+ return false
+ }
+ }
+
+ return true
+ }
+
// Parse remote
remote := ""
- if len(args) != 2 && !strings.Contains(args[0], "=") {
+ if onlyKeyValue(args) {
+ // server set with: <key>=<value>...
+ remote = ""
+ } else if len(args) == 2 && !hasKeyValue(args) {
+ // server set with: <key> <value>
+ remote = ""
+ } else {
remote = args[0]
}
More information about the lxc-devel
mailing list