[lxc-devel] [lxd/master] storage: bugfixes
brauner on Github
lxc-bot at linuxcontainers.org
Thu Feb 23 12:39:30 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170223/1c89eb91/attachment.bin>
-------------- next part --------------
From 0462e45c66c43369b6f81bc784294bc8e7edad4c Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 23 Feb 2017 13:09:16 +0100
Subject: [PATCH 1/3] storage: ensure image is wiped from db on error
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/storage.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/lxd/storage.go b/lxd/storage.go
index a66fc33..1471d36 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -716,6 +716,7 @@ func (ss *storageShared) createImageDbPoolVolume(fingerprint string) error {
volumeConfig := map[string]string{}
_, err := dbStoragePoolVolumeCreate(ss.d.db, fingerprint, storagePoolVolumeTypeImage, ss.poolID, volumeConfig)
if err != nil {
+ dbStoragePoolVolumeDelete(ss.d.db, fingerprint, storagePoolVolumeTypeImage, ss.poolID)
return err
}
From 003fc2085e2db8633d77878c7ebb0ed30a1acba7 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 23 Feb 2017 13:19:21 +0100
Subject: [PATCH 2/3] lvm: parse "volume.size" not "size" property
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/storage_pools_config.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/storage_pools_config.go b/lxd/storage_pools_config.go
index 8c3d05f..27313c2 100644
--- a/lxd/storage_pools_config.go
+++ b/lxd/storage_pools_config.go
@@ -130,7 +130,7 @@ func storagePoolFillDefault(name string, driver string, config map[string]string
if driver == "lvm" {
if config["volume.size"] != "" {
- sz, err := shared.ParseByteSizeString(config["size"])
+ sz, err := shared.ParseByteSizeString(config["volume.size"])
if err != nil {
return err
}
From 15a8caf49816bd08cd6edbd6d3d244a9d5dabbfe Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 23 Feb 2017 13:36:05 +0100
Subject: [PATCH 3/3] storage: fill in default configuration for images
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/storage.go | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lxd/storage.go b/lxd/storage.go
index 1471d36..cf6e889 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -714,7 +714,17 @@ func (ss *storageShared) setUnprivUserAcl(c container, destPath string) error {
func (ss *storageShared) createImageDbPoolVolume(fingerprint string) error {
// Create a db entry for the storage volume of the image.
volumeConfig := map[string]string{}
- _, err := dbStoragePoolVolumeCreate(ss.d.db, fingerprint, storagePoolVolumeTypeImage, ss.poolID, volumeConfig)
+ err := storageVolumeValidateConfig(ss.pool.Name, volumeConfig, ss.pool)
+ if err != nil {
+ return err
+ }
+
+ err = storageVolumeFillDefault(ss.pool.Name, volumeConfig, ss.pool)
+ if err != nil {
+ return err
+ }
+
+ _, err = dbStoragePoolVolumeCreate(ss.d.db, fingerprint, storagePoolVolumeTypeImage, ss.poolID, volumeConfig)
if err != nil {
dbStoragePoolVolumeDelete(ss.d.db, fingerprint, storagePoolVolumeTypeImage, ss.poolID)
return err
More information about the lxc-devel
mailing list