[lxc-devel] [lxd/master] lxd/device: Async CEPH unmap

stgraber on Github lxc-bot at linuxcontainers.org
Wed Feb 5 23:48:37 UTC 2020


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/20200205/cfc5c140/attachment.bin>
-------------- next part --------------
From 5b42e6bb991b4fc15b7432a9f943aeb3f2479a72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 5 Feb 2020 18:46:15 -0500
Subject: [PATCH] lxd/device: Async CEPH unmap
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/device/disk.go | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lxd/device/disk.go b/lxd/device/disk.go
index 6e33a5b4ff..9e1e6f96a1 100644
--- a/lxd/device/disk.go
+++ b/lxd/device/disk.go
@@ -18,6 +18,7 @@ import (
 	deviceConfig "github.com/lxc/lxd/lxd/device/config"
 	"github.com/lxc/lxd/lxd/instance"
 	"github.com/lxc/lxd/lxd/instance/instancetype"
+	"github.com/lxc/lxd/lxd/project"
 	storagePools "github.com/lxc/lxd/lxd/storage"
 	"github.com/lxc/lxd/lxd/util"
 	"github.com/lxc/lxd/shared"
@@ -819,10 +820,13 @@ func (d *disk) postStop() error {
 
 	if strings.HasPrefix(d.config["source"], "ceph:") {
 		v := d.volatileGet()
-		err := diskCephRbdUnmap(v["ceph_rbd"])
-		if err != nil {
-			return err
-		}
+
+		go func() {
+			err := diskCephRbdUnmap(v["ceph_rbd"])
+			if err != nil {
+				logger.Errorf("Failed to unmap RBD volume '%s' for '%s': %v", v["ceph_rbd"], project.Prefix(d.inst.Project(), d.inst.Name()), err)
+			}
+		}()
 	}
 
 	return nil


More information about the lxc-devel mailing list