The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6904

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes #6902

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 0984671bcbb4250200e26b552bda9845d0b48396 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 19 Feb 2020 16:36:50 -0500
Subject: [PATCH] lxd/instances: Pick correct default type from URL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6902

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/containers_post.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lxd/containers_post.go b/lxd/containers_post.go
index 376261d49e..6e02ea22cf 100644
--- a/lxd/containers_post.go
+++ b/lxd/containers_post.go
@@ -777,6 +777,16 @@ func containersPost(d *Daemon, r *http.Request) 
response.Response {
                return response.BadRequest(err)
        }
 
+       // Set type from URL if missing
+       urlType, err := urlInstanceTypeDetect(r)
+       if err != nil {
+               return response.InternalError(err)
+       }
+
+       if req.Type == "" && urlType != instancetype.Any {
+               req.Type = api.InstanceType(urlType.String())
+       }
+
        targetNode := queryParam(r, "target")
        if targetNode == "" {
                // If no target node was specified, pick the node with the
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to