The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3643
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Stéphane Graber <[email protected]>
From 06506a0e4a68d84fa775a13c44c878dba2238410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Tue, 8 Aug 2017 15:30:19 -0400 Subject: [PATCH] storage: Count custom volumes in pool UsedBy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <[email protected]> --- lxd/storage_pools_utils.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lxd/storage_pools_utils.go b/lxd/storage_pools_utils.go index 95761c4ff..e1f3100ec 100644 --- a/lxd/storage_pools_utils.go +++ b/lxd/storage_pools_utils.go @@ -81,7 +81,7 @@ func storagePoolUpdate(d *Daemon, name, newDescription string, newConfig map[str // /1.0/profiles/default func storagePoolUsedByGet(db *sql.DB, poolID int64, poolName string) ([]string, error) { // Retrieve all non-custom volumes that exist on this storage pool. - volumes, err := dbStoragePoolVolumesGet(db, poolID, []int{storagePoolVolumeTypeContainer, storagePoolVolumeTypeImage}) + volumes, err := dbStoragePoolVolumesGet(db, poolID, []int{storagePoolVolumeTypeContainer, storagePoolVolumeTypeImage, storagePoolVolumeTypeCustom}) if err != nil && err != NoSuchObjectError { return []string{}, err } @@ -112,8 +112,7 @@ func storagePoolUsedByGet(db *sql.DB, poolID int64, poolName string) ([]string, case storagePoolVolumeAPIEndpointImages: poolUsedBy[i] = fmt.Sprintf("/%s/images/%s", version.APIVersion, volumes[i].Name) case storagePoolVolumeAPIEndpointCustom: - // Bug - return []string{}, fmt.Errorf("database function returned volume type \"%s\" although not queried for it", volumes[i].Type) + poolUsedBy[i] = fmt.Sprintf("/%s/storage-pools/%s/volumes/%s/%s", version.APIVersion, poolName, volumes[i].Type, volumes[i].Name) default: // If that happens the db is busted, so report an error. return []string{}, fmt.Errorf("invalid storage type for storage volume \"%s\"", volumes[i].Name)
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
