[lxc-devel] [lxd/master] lxd/storage: Backward compatibility for content types

stgraber on Github lxc-bot at linuxcontainers.org
Sun Jun 28 14:50:16 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200628/e784b47f/attachment.bin>
-------------- next part --------------
From fbcadbb7b4b6a60ace7d9eab1a14ee5ad3294ea4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 28 Jun 2020 10:50:04 -0400
Subject: [PATCH] lxd/storage: Backward compatibility for content types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/storage_volumes.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/storage_volumes.go b/lxd/storage_volumes.go
index feb5ca7d87..c0a1ef88ee 100644
--- a/lxd/storage_volumes.go
+++ b/lxd/storage_volumes.go
@@ -296,6 +296,11 @@ func storagePoolVolumesTypePost(d *Daemon, r *http.Request) response.Response {
 		return response.BadRequest(fmt.Errorf("Storage volume names may not contain slashes"))
 	}
 
+	// Backward compatibility.
+	if req.ContentType == "" {
+		req.ContentType = "filesystem"
+	}
+
 	_, err = storagePools.VolumeContentTypeNameToContentType(req.ContentType)
 	if err != nil {
 		return response.BadRequest(fmt.Errorf("Invalid content type %q", req.ContentType))


More information about the lxc-devel mailing list