[lxc-devel] [lxd/master] DB Snapshots fixes tests to expect oldest first

tomponline on Github lxc-bot at linuxcontainers.org
Tue Oct 22 13:24:18 UTC 2019


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/20191022/87f1d0bf/attachment-0001.bin>
-------------- next part --------------
From 7042072addf27a31573f9d536ea09104ea876ef7 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 22 Oct 2019 14:22:07 +0100
Subject: [PATCH 1/2] db storage pools

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/db/storage_pools.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index ade8291d1c..b2995b23e0 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -776,7 +776,7 @@ SELECT storage_volumes.name
 
 // StoragePoolVolumeSnapshotsGetType get all snapshots of a storage volume
 // attached to a given storage pool of a given volume type, on the given node.
-// Returns snapshots slice ordered by volume ID (i.e effectively the order they were created).
+// Returns snapshots slice ordered by when they were created, oldest first.
 func (c *Cluster) StoragePoolVolumeSnapshotsGetType(volumeName string, volumeType int, poolID int64) ([]StorageVolumeArgs, error) {
 	result := []StorageVolumeArgs{}
 	regexp := volumeName + shared.SnapshotDelimiter

From da12d0c10d92b12d95a52f31c860e1d11a2ef1d9 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 22 Oct 2019 14:22:16 +0100
Subject: [PATCH 2/2] tests: Fixes zfs snapshot restore bug in tests

LXD was returning snapshots not in oldest-first order in some cases, and the tests were written to expect that bug.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 test/suites/storage_snapshots.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/suites/storage_snapshots.sh b/test/suites/storage_snapshots.sh
index 37ea40c9b0..e3ea5149a2 100644
--- a/test/suites/storage_snapshots.sh
+++ b/test/suites/storage_snapshots.sh
@@ -53,11 +53,11 @@ test_storage_volume_snapshots() {
   ! lxc storage volume restore "${storage_pool}" "${storage_volume}" snap0 || false
 
   lxc stop -f c1
-  lxc storage volume restore "${storage_pool}" "${storage_volume}" snap0
+  lxc storage volume restore "${storage_pool}" "${storage_volume}" foo
 
   lxc start c1
   lxc storage volume detach "${storage_pool}" "${storage_volume}" c1
-  lxc storage volume restore "${storage_pool}" "${storage_volume}" snap0
+  lxc storage volume restore "${storage_pool}" "${storage_volume}" foo
   lxc storage volume attach "${storage_pool}" "${storage_volume}" c1 /mnt
 
   # Validate file


More information about the lxc-devel mailing list