[lxc-devel] [lxd/master] storage volumes: only delete custom volumes
brauner on Github
lxc-bot at linuxcontainers.org
Tue May 9 14:22:06 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 438 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170509/29cad1e1/attachment.bin>
-------------- next part --------------
From 3737098d4c18a971da865fe6e9f057aa305f1f41 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 9 May 2017 16:21:07 +0200
Subject: [PATCH] storage volumes: only delete custom volumes
We do currently not support deleting any other type of storage volume.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/storage_volumes.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lxd/storage_volumes.go b/lxd/storage_volumes.go
index dcb7a64..3523ea7 100644
--- a/lxd/storage_volumes.go
+++ b/lxd/storage_volumes.go
@@ -379,6 +379,10 @@ func storagePoolVolumeTypeDelete(d *Daemon, r *http.Request) Response {
return BadRequest(fmt.Errorf("invalid storage volume type %s", volumeTypeName))
}
+ if volumeType != storagePoolVolumeTypeCustom {
+ return BadRequest(fmt.Errorf("storage volumes of type \"%s\" cannot be deleted with the storage api", volumeTypeName))
+ }
+
volumeUsedBy, err := storagePoolVolumeUsedByGet(d, volumeName, volumeTypeName)
if err != nil {
return InternalError(err)
More information about the lxc-devel
mailing list