[lxc-devel] [lxd/master] lxd/storage/utils: Removes default empty "size" property for dir volumes

tomponline on Github lxc-bot at linuxcontainers.org
Thu Oct 24 09:31:26 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 545 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191024/59d84081/attachment.bin>
-------------- next part --------------
From 3f946359f230e18a071f5c4dc4bd39dad400ff8a Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 15 Oct 2019 17:22:17 +0100
Subject: [PATCH] lxd/storage/utils: Removes default empty "size" property for
 dir volumes

 - VolumeFillDefault now does not populate an empty string for the "size" property for new volumes.
 - This is aligned with the other storage types that support the size property.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/utils.go | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lxd/storage/utils.go b/lxd/storage/utils.go
index 6b72f36a33..669d36f4c7 100644
--- a/lxd/storage/utils.go
+++ b/lxd/storage/utils.go
@@ -548,9 +548,7 @@ func VolumeValidateConfig(name string, config map[string]string, parentPool *api
 
 // VolumeFillDefault fills default settings into a volume config.
 func VolumeFillDefault(name string, config map[string]string, parentPool *api.StoragePool) error {
-	if parentPool.Driver == "dir" {
-		config["size"] = ""
-	} else if parentPool.Driver == "lvm" || parentPool.Driver == "ceph" {
+	if parentPool.Driver == "lvm" || parentPool.Driver == "ceph" {
 		if config["block.filesystem"] == "" {
 			config["block.filesystem"] = parentPool.Config["volume.block.filesystem"]
 		}
@@ -576,7 +574,7 @@ func VolumeFillDefault(name string, config map[string]string, parentPool *api.St
 		if config["size"] == "0" || config["size"] == "" {
 			config["size"] = "10GB"
 		}
-	} else {
+	} else if parentPool.Driver != "dir" {
 		if config["size"] != "" {
 			_, err := units.ParseByteSizeString(config["size"])
 			if err != nil {


More information about the lxc-devel mailing list