[lxc-devel] [lxd/master] storage: add volatile.initial_source key
brauner on Github
lxc-bot at linuxcontainers.org
Tue Aug 15 15:50:24 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 388 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170815/fdc8f745/attachment.bin>
-------------- next part --------------
From a736b8401d9ff02f8c6ac829b80724ddfe54dd0b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 15 Aug 2017 17:37:09 +0200
Subject: [PATCH 1/2] storage: add doc for volatile.pool.pristine
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
doc/storage.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/doc/storage.md b/doc/storage.md
index ef4edd2ec..1e729a654 100644
--- a/doc/storage.md
+++ b/doc/storage.md
@@ -19,6 +19,7 @@ lvm.thinpool\_name | string | lvm driver
lvm.use\_thinpool | bool | lvm driver | true | storage\_lvm\_use\_thinpool | Whether the storage pool uses a thinpool for logical volumes.
lvm.vg\_name | string | lvm driver | name of the pool | storage | Name of the volume group to create.
rsync.bwlimit | string | - | 0 (no limit) | storage\_rsync\_bwlimit | Specifies the upper limit to be placed on the socket I/O whenever rsync has to be used to transfer storage entities.
+volatile.pool.pristine | string | - | true | storage\_driver\_ceph | Whether the pool has been empty on creation time.
volume.block.filesystem | string | block based driver (lvm) | ext4 | storage | Filesystem to use for new volumes
volume.block.mount\_options | string | block based driver (lvm) | discard | storage | Mount options for block devices
volume.size | string | appropriate driver | 0 | storage | Default volume size
From fd18a27055bfb2e34a77f6f8768e25a18e220e3b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 15 Aug 2017 17:37:38 +0200
Subject: [PATCH 2/2] storage: add volatile.initial_source key
Closes https://github.com/lxc/lxc/issues/1743.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
doc/api-extensions.md | 3 +++
doc/storage.md | 45 +++++++++++++++++++++++----------------------
lxd/api_1.0.go | 1 +
lxd/storage_pools_config.go | 3 ++-
lxd/storage_zfs.go | 2 ++
5 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/doc/api-extensions.md b/doc/api-extensions.md
index 089cbc067..f2a01c248 100644
--- a/doc/api-extensions.md
+++ b/doc/api-extensions.md
@@ -322,3 +322,6 @@ This adds the ability to specify the ceph user.
## instance\_types
This adds the "instance\_type" field to the container creation request.
Its value is expanded to LXD resource limits.
+
+## storage\_volatile\_initial\_source
+This records the actual source passed to LXD during storage pool creation.
diff --git a/doc/storage.md b/doc/storage.md
index 1e729a654..41ec26edb 100644
--- a/doc/storage.md
+++ b/doc/storage.md
@@ -5,28 +5,29 @@ Volume keys apply to any volume created in the pool unless the value is
overridden on a per-volume basis.
## Storage pool configuration
-Key | Type | Condition | Default | API Extension | Description
-:-- | :--- | :-------- | :------ | :------------ | :----------
-size | string | appropriate driver and source | 0 | storage | Size of the storage pool in bytes (suffixes supported). (Currently valid for loop based pools and zfs.)
-source | string | - | - | storage | Path to block device or loop file or filesystem entry
-btrfs.mount\_options | string | btrfs driver | user\_subvol\_rm\_allowed | storage\_btrfs\_mount\_options | Mount options for block devices
-ceph.cluster\_name | string | ceph driver | ceph | storage\_driver\_ceph | Name of the ceph cluster in which to create new storage pools.
-ceph.osd.pool\_name | string | ceph driver | name of the pool | storage\_driver\_ceph | Name of the osd storage pool.
-ceph.osd.pg\_num | string | ceph driver | 32 | storage\_driver\_ceph | Number of placement groups for the osd storage pool.
-ceph.rbd.clone\_copy | string | ceph driver | true | storage\_driver\_ceph | Whether to use RBD lightweight clones rather than full dataset copies.
-ceph.user.name | string | ceph driver | admin | storage\_ceph\_user\_name | The ceph user to use when creating storage pools and volumes.
-lvm.thinpool\_name | string | lvm driver | LXDPool | storage | Thin pool where images and containers are created.
-lvm.use\_thinpool | bool | lvm driver | true | storage\_lvm\_use\_thinpool | Whether the storage pool uses a thinpool for logical volumes.
-lvm.vg\_name | string | lvm driver | name of the pool | storage | Name of the volume group to create.
-rsync.bwlimit | string | - | 0 (no limit) | storage\_rsync\_bwlimit | Specifies the upper limit to be placed on the socket I/O whenever rsync has to be used to transfer storage entities.
-volatile.pool.pristine | string | - | true | storage\_driver\_ceph | Whether the pool has been empty on creation time.
-volume.block.filesystem | string | block based driver (lvm) | ext4 | storage | Filesystem to use for new volumes
-volume.block.mount\_options | string | block based driver (lvm) | discard | storage | Mount options for block devices
-volume.size | string | appropriate driver | 0 | storage | Default volume size
-volume.zfs.remove\_snapshots | bool | zfs driver | false | storage | Remove snapshots as needed
-volume.zfs.use\_refquota | bool | zfs driver | false | storage | Use refquota instead of quota for space.
-zfs.clone\_copy | bool | zfs driver | true | storage\_zfs\_clone\_copy | Whether to use ZFS lightweight clones rather than full dataset copies.
-zfs.pool\_name | string | zfs driver | name of the pool | storage | Name of the zpool
+Key | Type | Condition | Default | API Extension | Description
+:-- | :--- | :-------- | :------ | :------------ | :----------
+size | string | appropriate driver and source | 0 | storage | Size of the storage pool in bytes (suffixes supported). (Currently valid for loop based pools and zfs.)
+source | string | - | - | storage | Path to block device or loop file or filesystem entry
+btrfs.mount\_options | string | btrfs driver | user\_subvol\_rm\_allowed | storage\_btrfs\_mount\_options | Mount options for block devices
+ceph.cluster\_name | string | ceph driver | ceph | storage\_driver\_ceph | Name of the ceph cluster in which to create new storage pools.
+ceph.osd.pool\_name | string | ceph driver | name of the pool | storage\_driver\_ceph | Name of the osd storage pool.
+ceph.osd.pg\_num | string | ceph driver | 32 | storage\_driver\_ceph | Number of placement groups for the osd storage pool.
+ceph.rbd.clone\_copy | string | ceph driver | true | storage\_driver\_ceph | Whether to use RBD lightweight clones rather than full dataset copies.
+ceph.user.name | string | ceph driver | admin | storage\_ceph\_user\_name | The ceph user to use when creating storage pools and volumes.
+lvm.thinpool\_name | string | lvm driver | LXDPool | storage | Thin pool where images and containers are created.
+lvm.use\_thinpool | bool | lvm driver | true | storage\_lvm\_use\_thinpool | Whether the storage pool uses a thinpool for logical volumes.
+lvm.vg\_name | string | lvm driver | name of the pool | storage | Name of the volume group to create.
+rsync.bwlimit | string | - | 0 (no limit) | storage\_rsync\_bwlimit | Specifies the upper limit to be placed on the socket I/O whenever rsync has to be used to transfer storage entities.
+volatile.pool.pristine | string | - | true | storage\_driver\_ceph | Whether the pool has been empty on creation time.
+volatile.initial_source | string | - | - | storage\_volatile\_initial\_source | Records the actual source passed during creating (e.g. /dev/sdb).
+volume.block.filesystem | string | block based driver (lvm) | ext4 | storage | Filesystem to use for new volumes
+volume.block.mount\_options | string | block based driver (lvm) | discard | storage | Mount options for block devices
+volume.size | string | appropriate driver | 0 | storage | Default volume size
+volume.zfs.remove\_snapshots | bool | zfs driver | false | storage | Remove snapshots as needed
+volume.zfs.use\_refquota | bool | zfs driver | false | storage | Use refquota instead of quota for space.
+zfs.clone\_copy | bool | zfs driver | true | storage\_zfs\_clone\_copy | Whether to use ZFS lightweight clones rather than full dataset copies.
+zfs.pool\_name | string | zfs driver | name of the pool | storage | Name of the zpool
Storage pool configuration keys can be set using the lxc tool with:
diff --git a/lxd/api_1.0.go b/lxd/api_1.0.go
index f9a6c1b5c..f6c7e5491 100644
--- a/lxd/api_1.0.go
+++ b/lxd/api_1.0.go
@@ -121,6 +121,7 @@ func api10Get(d *Daemon, r *http.Request) Response {
"storage_driver_ceph",
"storage_ceph_user_name",
"resource_limits",
+ "storage_volatile_initial_source",
},
APIStatus: "stable",
APIVersion: version.APIVersion,
diff --git a/lxd/storage_pools_config.go b/lxd/storage_pools_config.go
index b3a3d2042..197497fce 100644
--- a/lxd/storage_pools_config.go
+++ b/lxd/storage_pools_config.go
@@ -54,7 +54,8 @@ var storagePoolConfigKeys = map[string]func(value string) error{
// approach is however generalizable. It's just that we currently don't
// really need it for the other drivers.
// valid drivers: ceph
- "volatile.pool.pristine": shared.IsAny,
+ "volatile.pool.pristine": shared.IsAny,
+ "volatile.initial_source": shared.IsAny,
// valid drivers: ceph, lvm
"volume.block.filesystem": func(value string) error {
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index bc590a2e7..652ee6f91 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -138,6 +138,8 @@ func (s *storageZfs) StoragePoolCreate() error {
}
func (s *storageZfs) zfsPoolCreate() error {
+ s.pool.Config["volatile.initial_source"] = s.pool.Config["source"]
+
zpoolName := s.getOnDiskPoolName()
vdev := s.pool.Config["source"]
if vdev == "" {
More information about the lxc-devel
mailing list