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

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) ===
See discussion in #6741
From 094fcecc76dd5226d2db0eb4b9fe48652e439386 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Wed, 5 Feb 2020 15:55:02 +0100
Subject: [PATCH 1/2] lxd/storage/drivers: Add LocalStructure to Info

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 lxd/storage/drivers/driver_types.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lxd/storage/drivers/driver_types.go 
b/lxd/storage/drivers/driver_types.go
index dab2aa5694..399fcb13e1 100644
--- a/lxd/storage/drivers/driver_types.go
+++ b/lxd/storage/drivers/driver_types.go
@@ -12,6 +12,7 @@ type Info struct {
        RunningQuotaResize    bool         // Whether quota resize is supported 
whilst instance running.
        RunningSnapshotFreeze bool         // Whether instance should be frozen 
during snapshot if running.
        DirectIO              bool         // Whether the driver supports 
direct I/O.
+       LocalStructure        bool         // Whether the directory structure 
needs to be created.
 }
 
 // VolumeFiller provides a struct for filling a volume.

From 2d5fe3b17efe1b9759f6fff618318d3eea5191ad Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Wed, 5 Feb 2020 15:57:01 +0100
Subject: [PATCH 2/2] lxd/storage: Honor LocalStructure in pool actions

This honors the LocalStructure information when creating and deleting
storage pools.

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 lxd/storage/backend_lxd.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index 393ef62fd7..e9052bb38f 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -81,6 +81,14 @@ func (b *lxdBackend) create(localOnly bool, op 
*operations.Operation) error {
 
        // If dealing with a remote storage pool, we're done now.
        if b.driver.Info().Remote && localOnly {
+               if b.driver.Info().LocalStructure {
+                       // Create the directory structure.
+                       err = b.createStorageStructure(path)
+                       if err != nil {
+                               return err
+                       }
+               }
+
                revert.Success()
                return nil
        }
@@ -199,7 +207,7 @@ func (b *lxdBackend) Delete(localOnly bool, op 
*operations.Operation) error {
        }
 
        // Delete the low-level storage.
-       if !localOnly || !b.driver.Info().Remote {
+       if !localOnly || !b.driver.Info().Remote || 
b.driver.Info().LocalStructure {
                err := b.driver.Delete(op)
                if err != nil {
                        return err
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to