[lxc-devel] [lxd/master] db: Handle NULL storage_volume description column in patch 34

freeekanayaka on Github lxc-bot at linuxcontainers.org
Mon Sep 14 07:39:35 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 361 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200914/9be023bb/attachment.bin>
-------------- next part --------------
From 971427e2c5a3624ec357b6fb774907780651a10f Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Mon, 14 Sep 2020 09:37:34 +0200
Subject: [PATCH] db: Handle NULL storage_volume description column in patch 34

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/db/cluster/update.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lxd/db/cluster/update.go b/lxd/db/cluster/update.go
index d9ba84a2e0..ac34d402c3 100644
--- a/lxd/db/cluster/update.go
+++ b/lxd/db/cluster/update.go
@@ -178,7 +178,7 @@ ORDER BY storage_volumes.name
 
 	err = query.SelectObjects(stmt, dest)
 	if err != nil {
-		return errors.Wrap(err, "Failed to fetch storage volumes")
+		return errors.Wrap(err, "Failed to fetch ceph storage volumes")
 	}
 
 	// Remove multiple entries of the same volume when using remote storage
@@ -243,7 +243,9 @@ CREATE TABLE storage_volumes_new (
 		}
 	}
 
-	stmt, err = tx.Prepare(`SELECT * FROM storage_volumes;`)
+	stmt, err = tx.Prepare(`
+SELECT id, name, storage_pool_id, node_id, type, coalesce(description, ''), project_id content_type
+FROM storage_volumes`)
 	if err != nil {
 		return errors.Wrap(err, "Failed to prepare storage volumes query")
 	}


More information about the lxc-devel mailing list