[lxc-devel] [lxd/master] Ceph cluster fixes
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Aug 11 17:28:15 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200811/b73eb85b/attachment.bin>
-------------- next part --------------
From 8857924c67e1ac9ad808628f5b1dfeb259a57cb0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 11 Aug 2020 13:27:23 -0400
Subject: [PATCH 1/2] lxd/storage: Fix delete of remote pools
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/backend_lxd.go | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index 6b09f11924..4e13013eab 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -210,14 +210,24 @@ func (b *lxdBackend) Delete(localOnly bool, op *operations.Operation) error {
defer logger.Debug("Delete finished")
// If completely gone, just return
- if !shared.PathExists(shared.VarPath("storage-pools", b.name)) {
+ path := shared.VarPath("storage-pools", b.name)
+ if !shared.PathExists(path) {
return nil
}
- if localOnly && b.driver.Info().Remote && b.driver.Info().MountedRoot {
- _, err := b.driver.Unmount()
- if err != nil {
- return err
+ if localOnly && b.driver.Info().Remote {
+ if b.driver.Info().MountedRoot {
+ _, err := b.driver.Unmount()
+ if err != nil {
+ return err
+ }
+ } else {
+ // Remote storage may have leftover entries caused by
+ // volumes that were moved or delete while a particular system was offline.
+ err := os.RemoveAll(path)
+ if err != nil {
+ return err
+ }
}
} else {
// Delete the low-level storage.
@@ -228,9 +238,8 @@ func (b *lxdBackend) Delete(localOnly bool, op *operations.Operation) error {
}
// Delete the mountpoint.
- path := shared.VarPath("storage-pools", b.name)
err := os.Remove(path)
- if err != nil {
+ if err != nil && !os.IsNotExist(err) {
return errors.Wrapf(err, "Failed to remove directory '%s'", path)
}
From ac9cd87e09186edad717bc11e5c33c824777dbad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 11 Aug 2020 13:27:45 -0400
Subject: [PATCH 2/2] lxd/storage/ceph: Allow for small size variation
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/drivers/driver_ceph_volumes.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lxd/storage/drivers/driver_ceph_volumes.go b/lxd/storage/drivers/driver_ceph_volumes.go
index bbfa58e808..55ef3825d6 100644
--- a/lxd/storage/drivers/driver_ceph_volumes.go
+++ b/lxd/storage/drivers/driver_ceph_volumes.go
@@ -837,8 +837,8 @@ func (d *ceph) SetVolumeQuota(vol Volume, size string, op *operations.Operation)
return errors.Wrapf(err, "Error getting current size")
}
- // Do nothing is volume is already specified size.
- if oldSizeBytes == sizeBytes {
+ // Do nothing if volume is already specified size (+/- 512 bytes).
+ if oldSizeBytes+512 > sizeBytes && oldSizeBytes-512 < sizeBytes {
return nil
}
More information about the lxc-devel
mailing list