[lxc-devel] [lxd/master] upgrade fixes

brauner on Github lxc-bot at linuxcontainers.org
Wed Jun 7 15:49:38 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170607/f0eca469/attachment.bin>
-------------- next part --------------
From 0ffe2b2ef14b1c6fc66df9f04f6c23a761183a0e Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 7 Jun 2017 17:32:58 +0200
Subject: [PATCH 1/2] storage: insert driver correctly

Closes  #3386.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/db_storage_pools.go | 2 +-
 lxd/patches.go          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxd/db_storage_pools.go b/lxd/db_storage_pools.go
index c304eba54..f340c7cbf 100644
--- a/lxd/db_storage_pools.go
+++ b/lxd/db_storage_pools.go
@@ -132,7 +132,7 @@ func dbStoragePoolConfigGet(db *sql.DB, poolID int64) (map[string]string, error)
 }
 
 // Create new storage pool.
-func dbStoragePoolCreate(db *sql.DB, poolName, poolDescription string, poolDriver string, poolConfig map[string]string) (int64, error) {
+func dbStoragePoolCreate(db *sql.DB, poolName string, poolDescription string, poolDriver string, poolConfig map[string]string) (int64, error) {
 	tx, err := dbBegin(db)
 	if err != nil {
 		return -1, err
diff --git a/lxd/patches.go b/lxd/patches.go
index 64bcc2fe3..22659d61a 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -1433,7 +1433,7 @@ func upgradeFromStorageTypeZfs(name string, d *Daemon, defaultPoolName string, d
 		}
 
 		// (Use a tmp variable as Go's scoping is freaking me out.)
-		tmp, err := dbStoragePoolCreate(d.db, poolName, defaultStorageTypeName, "", poolConfig)
+		tmp, err := dbStoragePoolCreate(d.db, poolName, "", defaultStorageTypeName, poolConfig)
 		if err != nil {
 			logger.Warnf("Storage pool already exists in the database. Proceeding...")
 		}

From b5d4079310f3c6fe9e06e0aa54eced6770382824 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 7 Jun 2017 17:48:02 +0200
Subject: [PATCH 2/2] patches: fix upgrade

Closes  #3386.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/patches.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lxd/patches.go b/lxd/patches.go
index 22659d61a..a0f809ece 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -43,6 +43,7 @@ var patches = []patch{
 	{name: "storage_api_update_storage_configs", run: patchStorageApiUpdateStorageConfigs},
 	{name: "storage_api_lxd_on_btrfs", run: patchStorageApiLxdOnBtrfs},
 	{name: "storage_api_lvm_detect_lv_size", run: patchStorageApiDetectLVSize},
+	{name: "storage_api_insert_zfs_driver", run: patchStorageApiInsertZfsDriver},
 }
 
 type patch struct {
@@ -2237,6 +2238,15 @@ func patchStorageApiDetectLVSize(name string, d *Daemon) error {
 	return nil
 }
 
+func patchStorageApiInsertZfsDriver(name string, d *Daemon) error {
+	_, err := dbExec(db, "UPDATE storage_pools SET driver='', description=driver WHERE driver='' AND description='zfs'")
+	if err != nil {
+		return err
+	}
+
+	return nil
+}
+
 // Patches end here
 
 // Here are a couple of legacy patches that were originally in


More information about the lxc-devel mailing list