[lxc-devel] [lxd/master] storage: leave volume uninitialized

brauner on Github lxc-bot at linuxcontainers.org
Mon Jun 26 12:45:03 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 839 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170626/4e9a11ca/attachment.bin>
-------------- next part --------------
From 06a87ff7f2d9faf03dc6033d0337748a0d7a1053 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 26 Jun 2017 14:42:40 +0200
Subject: [PATCH] storage: leave volume uninitialized

So far I've used a dummy initializer when only the pool was supposed to be
initialized. But I want to be able to check whether the volume is initialized
at all and kick out a bunch of get*() methods in the various storage drivers.
This will allow us to reduce the amount of helper functions well call and
increases performance. In essence, all information initialization can then be
done when we call StoragePoolInit() instead of additionally in each single
method.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/storage.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/storage.go b/lxd/storage.go
index 085872643..80a4d537e 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -309,7 +309,7 @@ func storageInit(d *Daemon, poolName string, volumeName string, volumeType int)
 	}
 
 	// Load the storage volume.
-	volume := &api.StorageVolume{}
+	var volume *api.StorageVolume
 	if volumeName != "" && volumeType >= 0 {
 		_, volume, err = dbStoragePoolVolumeGetType(d.db, volumeName, volumeType, poolID)
 		if err != nil {


More information about the lxc-devel mailing list