[lxc-devel] [lxd/master] lxd/containers: Don't flush leases for snapshots

stgraber on Github lxc-bot at linuxcontainers.org
Wed Aug 1 21:33:01 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180801/a4ed7b02/attachment.bin>
-------------- next part --------------
From 8188cda0eea645cfc1454ccf65443f69bd67b173 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 1 Aug 2018 17:01:23 -0400
Subject: [PATCH] lxd/containers: Don't flush leases for snapshots
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/container_lxc.go | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 8b5cd15148..05d19220dc 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -3342,6 +3342,21 @@ func (c *containerLXC) Delete() error {
 			logger.Error("Failed deleting container MAAS record", log.Ctx{"name": c.Name(), "err": err})
 			return err
 		}
+
+		// Update network files
+		networkUpdateStatic(c.state, "")
+		for k, m := range c.expandedDevices {
+			if m["type"] != "nic" || m["nictype"] != "bridged" {
+				continue
+			}
+
+			m, err := c.fillNetworkDevice(k, m)
+			if err != nil {
+				continue
+			}
+
+			networkClearLease(c.state, c.name, m["parent"], m["hwaddr"])
+		}
 	}
 
 	// Remove the database record
@@ -3364,21 +3379,6 @@ func (c *containerLXC) Delete() error {
 		}
 	}
 
-	// Update network files
-	networkUpdateStatic(c.state, "")
-	for k, m := range c.expandedDevices {
-		if m["type"] != "nic" || m["nictype"] != "bridged" {
-			continue
-		}
-
-		m, err := c.fillNetworkDevice(k, m)
-		if err != nil {
-			continue
-		}
-
-		networkClearLease(c.state, c.name, m["parent"], m["hwaddr"])
-	}
-
 	logger.Info("Deleted container", ctxMap)
 
 	if c.IsSnapshot() {


More information about the lxc-devel mailing list