[lxc-devel] [lxd/master] zfs: create image dataset with mountpoint=none
brauner on Github
lxc-bot at linuxcontainers.org
Tue May 30 00:40:06 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170530/e65f16df/attachment.bin>
-------------- next part --------------
From 8ef65ea898028427655d841cb6e0cbc5e4a33477 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 30 May 2017 02:05:37 +0200
Subject: [PATCH 1/2] doc: correct grammer in storage.md
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
doc/storage.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/storage.md b/doc/storage.md
index 5fa5e3f99..7f60f5768 100644
--- a/doc/storage.md
+++ b/doc/storage.md
@@ -231,7 +231,7 @@ lxc storage create pool1 lvm source=/dev/sdX lvm.vg_name=my-pool
It is recommended to not maintain any non-LXD owned filesystem entities in
a LXD zfs pool or dataset since LXD might delete them.
- When quotas are used on a ZFS dataset LXD will set the ZFS "quota" property.
- In order to use have LXD set the ZFS "refquota" property, either set
+ In order to have LXD set the ZFS "refquota" property, either set
"zfs.use_refquota" to "true" for the given dataset or set
"volume.zfs.use_refquota" to true on the storage pool. The former option
will make LXD use refquota only for the given storage volume the latter will
From 6ebdf3f68a680d0771ffa52707a2030d63b4b8e6 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 30 May 2017 02:37:44 +0200
Subject: [PATCH 2/2] zfs: create image dataset with mountpoint=none
This also adds the file lxd/storage_zfs_utils.go. We will slowly move all
helpery from lxd/storage_zfs.go there and give them sane new layouts.
Closes #3359.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/storage_zfs.go | 5 ++++-
lxd/storage_zfs_utils.go | 13 +++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 lxd/storage_zfs_utils.go
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index f1803ffbd..37697fe63 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -1552,8 +1552,11 @@ func (s *storageZfs) ImageCreate(fingerprint string) error {
imagePath := shared.VarPath("images", fingerprint)
// Create a new storage volume on the storage pool for the image.
- err = s.zfsPoolVolumeCreate(fs)
+ poolName := s.getOnDiskPoolName()
+ dataset := fmt.Sprintf("%s/%s", poolName, fs)
+ msg, err := zfsPoolVolumeCreate(dataset, "mountpoint=none")
if err != nil {
+ logger.Errorf("failed to create ZFS dataset \"%s\" on storage pool \"%s\": %s", dataset, s.pool.Name, msg)
return err
}
subrevert = false
diff --git a/lxd/storage_zfs_utils.go b/lxd/storage_zfs_utils.go
new file mode 100644
index 000000000..67e071b18
--- /dev/null
+++ b/lxd/storage_zfs_utils.go
@@ -0,0 +1,13 @@
+package main
+
+import (
+ "strings"
+
+ "github.com/lxc/lxd/shared"
+)
+
+// zfsPoolVolumeCreate creates a ZFS dataset with a set of given properties.
+func zfsPoolVolumeCreate(dataset string, properties ...string) (string, error) {
+ p := strings.Join(properties, ",")
+ return shared.RunCommand("zfs", "create", "-o", p, "-p", dataset)
+}
More information about the lxc-devel
mailing list