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

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 #6366

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From dbbd500f4751c944abe58fea04011608e6752994 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 30 Oct 2019 15:38:26 +0100
Subject: [PATCH] lxd/containers: Push MAAS entry after dev creation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6366

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

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index e03d65c92c..76e1f36960 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -416,14 +416,6 @@ func containerLXCCreate(s *state.State, args 
db.InstanceArgs) (container, error)
        }
 
        if !c.IsSnapshot() {
-               // Update MAAS
-               err = c.maasUpdate(nil)
-               if err != nil {
-                       c.Delete()
-                       logger.Error("Failed creating container", ctxMap)
-                       return nil, err
-               }
-
                // Add devices to container.
                for k, m := range c.expandedDevices {
                        err = c.deviceAdd(k, m)
@@ -432,6 +424,14 @@ func containerLXCCreate(s *state.State, args 
db.InstanceArgs) (container, error)
                                return nil, errors.Wrapf(err, "Failed to add 
device '%s'", k)
                        }
                }
+
+               // Update MAAS
+               err = c.maasUpdate(nil)
+               if err != nil {
+                       c.Delete()
+                       logger.Error("Failed creating container", ctxMap)
+                       return nil, err
+               }
        }
 
        logger.Info("Created container", ctxMap)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to