[lxc-devel] [lxd/master] Fix storage tests on zfs

stgraber on Github lxc-bot at linuxcontainers.org
Sat Jan 11 02:34:46 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/20200110/ec0d91a0/attachment.bin>
-------------- next part --------------
From b416465804a228071cca19ad3e42a80cf04e9992 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 10 Jan 2020 14:39:28 -0500
Subject: [PATCH 1/2] lxd/storage/drivers: Fix comments
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_btrfs_volumes.go |  6 ++----
 lxd/storage/drivers/driver_zfs_volumes.go   | 12 ++++--------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/lxd/storage/drivers/driver_btrfs_volumes.go b/lxd/storage/drivers/driver_btrfs_volumes.go
index 8a037b8148..8b567fee7b 100644
--- a/lxd/storage/drivers/driver_btrfs_volumes.go
+++ b/lxd/storage/drivers/driver_btrfs_volumes.go
@@ -456,14 +456,12 @@ func (d *btrfs) GetVolumeDiskPath(vol Volume) (string, error) {
 	return d.vfsGetVolumeDiskPath(vol)
 }
 
-// MountVolume simulates mounting a volume. As dir driver doesn't have volumes to mount it returns
-// false indicating that there is no need to issue an unmount.
+// MountVolume simulates mounting a volume.
 func (d *btrfs) MountVolume(vol Volume, op *operations.Operation) (bool, error) {
 	return true, nil
 }
 
-// UnmountVolume simulates unmounting a volume. As dir driver doesn't have volumes to unmount it
-// returns false indicating the volume was already unmounted.
+// UnmountVolume simulates unmounting a volume.
 func (d *btrfs) UnmountVolume(vol Volume, op *operations.Operation) (bool, error) {
 	return false, nil
 }
diff --git a/lxd/storage/drivers/driver_zfs_volumes.go b/lxd/storage/drivers/driver_zfs_volumes.go
index 6063f6dbeb..58fcd6e2b5 100644
--- a/lxd/storage/drivers/driver_zfs_volumes.go
+++ b/lxd/storage/drivers/driver_zfs_volumes.go
@@ -835,8 +835,7 @@ func (d *zfs) GetVolumeDiskPath(vol Volume) (string, error) {
 	return "", fmt.Errorf("Could not locate a zvol for %s", d.dataset(vol, false))
 }
 
-// MountVolume simulates mounting a volume. As dir driver doesn't have volumes to mount it returns
-// false indicating that there is no need to issue an unmount.
+// MountVolume simulates mounting a volume.
 func (d *zfs) MountVolume(vol Volume, op *operations.Operation) (bool, error) {
 	// For VMs, also mount the filesystem dataset.
 	if d.checkVMBlock(vol) {
@@ -874,8 +873,7 @@ func (d *zfs) MountVolume(vol Volume, op *operations.Operation) (bool, error) {
 	return true, nil
 }
 
-// UnmountVolume simulates unmounting a volume. As dir driver doesn't have volumes to unmount it
-// returns false indicating the volume was already unmounted.
+// UnmountVolume simulates unmounting a volume.
 func (d *zfs) UnmountVolume(vol Volume, op *operations.Operation) (bool, error) {
 	// For VMs, also mount the filesystem dataset.
 	if d.checkVMBlock(vol) {
@@ -1228,8 +1226,7 @@ func (d *zfs) DeleteVolumeSnapshot(vol Volume, op *operations.Operation) error {
 	return nil
 }
 
-// MountVolumeSnapshot simulates mounting a volume snapshot. As dir driver doesn't have volumes to
-// mount it returns false indicating that there is no need to issue an unmount.
+// MountVolumeSnapshot simulates mounting a volume snapshot.
 func (d *zfs) MountVolumeSnapshot(vol Volume, op *operations.Operation) (bool, error) {
 	// Ignore block devices for now.
 	if vol.contentType == ContentTypeBlock {
@@ -1250,8 +1247,7 @@ func (d *zfs) MountVolumeSnapshot(vol Volume, op *operations.Operation) (bool, e
 	return true, nil
 }
 
-// UnmountVolume simulates unmounting a volume snapshot. As dir driver doesn't have volumes to
-// unmount it returns false indicating the volume was already unmounted.
+// UnmountVolume simulates unmounting a volume snapshot.
 func (d *zfs) UnmountVolumeSnapshot(vol Volume, op *operations.Operation) (bool, error) {
 	// Ignore block devices for now.
 	if vol.contentType == ContentTypeBlock {

From 01867ea2b2856ad1ca396d0ac0adb40ef9620363 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 10 Jan 2020 21:34:06 -0500
Subject: [PATCH 2/2] tests: Fix storage_compatible for zfs
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>
---
 test/includes/storage.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/includes/storage.sh b/test/includes/storage.sh
index 9672983781..36d05ad5fe 100644
--- a/test/includes/storage.sh
+++ b/test/includes/storage.sh
@@ -131,7 +131,7 @@ umount_loops() {
 
 storage_compatible() {
     if [ "${1}" = "cephfs" ] || [ "${1}" = "dir" ] || [ "${1}" = "btrfs" ] || [ "${1}" = "zfs" ]; then
-        if [ "${2}" = "cephfs" ] || [ "${2}" = "dir" ] || [ "${2}" = "btrfs" ] || [ "${1}" = "zfs" ]; then
+        if [ "${2}" = "cephfs" ] || [ "${2}" = "dir" ] || [ "${2}" = "btrfs" ] || [ "${2}" = "zfs" ]; then
             true
             return
         else


More information about the lxc-devel mailing list