[lxc-devel] [lxd/master] zfs: Always require existing datasets to be empty
stgraber on Github
lxc-bot at linuxcontainers.org
Mon Aug 14 19:27:48 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170814/d3fe2ac4/attachment.bin>
-------------- next part --------------
From 4d6ad5664cf33990e6c78966d2f0a7c1b617f047 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 14 Aug 2017 15:27:09 -0400
Subject: [PATCH] zfs: Always require existing datasets to be empty
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #3657
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage_zfs.go | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 04761ec7c..bc590a2e7 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -207,29 +207,25 @@ func (s *storageZfs) zfsPoolCreate() error {
if err := zfsPoolCreate("", vdev); err != nil {
return err
}
- } else {
- if err := zfsPoolVolumeSet(vdev, "", "mountpoint", "none"); err != nil {
- return err
- }
}
} else {
err := zfsPoolCheck(vdev)
if err != nil {
return err
}
+ }
- subvols, err := zfsPoolListSubvolumes(zpoolName, vdev)
- if err != nil {
- return err
- }
+ subvols, err := zfsPoolListSubvolumes(zpoolName, vdev)
+ if err != nil {
+ return err
+ }
- if len(subvols) > 0 {
- return fmt.Errorf("Provided ZFS pool (or dataset) isn't empty")
- }
+ if len(subvols) > 0 {
+ return fmt.Errorf("Provided ZFS pool (or dataset) isn't empty")
+ }
- if err := zfsPoolVolumeSet(vdev, "", "mountpoint", "none"); err != nil {
- return err
- }
+ if err := zfsPoolVolumeSet(vdev, "", "mountpoint", "none"); err != nil {
+ return err
}
}
}
More information about the lxc-devel
mailing list