[lxc-devel] [lxd/master] lxd/storage: Switch Mount to new logic

stgraber on Github lxc-bot at linuxcontainers.org
Wed Nov 6 21:00:36 UTC 2019


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/20191106/1b3c2e31/attachment.bin>
-------------- next part --------------
From d19d1a052cd9e48c66249f5df200d0f1635fbcdc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 6 Nov 2019 15:43:50 -0500
Subject: [PATCH] lxd/storage: Switch Mount to new logic
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/storage.go | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/lxd/storage.go b/lxd/storage.go
index 6a3aa7cf7d..7b50d49119 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -772,17 +772,30 @@ func SetupStorageDriver(s *state.State, forceCheck bool) error {
 
 	}
 
-	for _, pool := range pools {
-		logger.Debugf("Initializing and checking storage pool \"%s\"", pool)
-		s, err := storagePoolInit(s, pool)
-		if err != nil {
-			logger.Errorf("Error initializing storage pool \"%s\": %s, correct functionality of the storage pool cannot be guaranteed", pool, err)
-			continue
-		}
+	for _, poolName := range pools {
+		logger.Debugf("Initializing and checking storage pool \"%s\"", poolName)
 
-		err = s.StoragePoolCheck()
-		if err != nil {
-			return err
+		pool, err := storagePools.GetPoolByName(s, poolName)
+		if err != storageDrivers.ErrUnknownDriver {
+			if err != nil {
+				return err
+			}
+
+			_, err = pool.Mount()
+			if err != nil {
+				return err
+			}
+		} else {
+			s, err := storagePoolInit(s, poolName)
+			if err != nil {
+				logger.Errorf("Error initializing storage pool \"%s\": %s, correct functionality of the storage pool cannot be guaranteed", pool, err)
+				continue
+			}
+
+			err = s.StoragePoolCheck()
+			if err != nil {
+				return err
+			}
 		}
 	}
 


More information about the lxc-devel mailing list