The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6347

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
 - 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.parr...@canonical.com>
From 3f946359f230e18a071f5c4dc4bd39dad400ff8a Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@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.parr...@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 {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to