[lxc-devel] [lxd/master] lxd/storage/backend/lxd: Create storage structure on pool mount
tomponline on Github
lxc-bot at linuxcontainers.org
Mon Jan 6 10:38:39 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 553 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200106/e6fd150c/attachment.bin>
-------------- next part --------------
From f5a96aff05b695c01066766dad7e946e6295a750 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Mon, 6 Jan 2020 10:35:55 +0000
Subject: [PATCH] lxd/storage/backend/lxd: Create storage structure on pool
mount
Ensures that the storage pool directories are created on LXD start so they are in a consistent state.
Some older drivers did not create the storage pool directories at pool create time.
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/storage/backend_lxd.go | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index 726f69366c..c2b02e819a 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -224,6 +224,13 @@ func (b *lxdBackend) Mount() (bool, error) {
logger.Debug("Mount started")
defer logger.Debug("Mount finished")
+ // Ensure that the base storage structure directories exist (as some old drivers did not create all dirs).
+ path := drivers.GetPoolMountPath(b.name)
+ err := b.createStorageStructure(path)
+ if err != nil {
+ return false, err
+ }
+
return b.driver.Mount()
}
More information about the lxc-devel
mailing list