The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3542

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 b6ab338027ae54944e2489a7c061d368b89dd836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Wed, 12 Jul 2017 18:05:47 -0400
Subject: [PATCH] storage: Fix UsedBy for containers and images
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_volumes_utils.go | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lxd/storage_volumes_utils.go b/lxd/storage_volumes_utils.go
index 0f039588f..fd1da3962 100644
--- a/lxd/storage_volumes_utils.go
+++ b/lxd/storage_volumes_utils.go
@@ -180,6 +180,22 @@ func storagePoolVolumeUpdate(d *Daemon, poolName string, 
volumeName string, volu
 }
 
 func storagePoolVolumeUsedByGet(d *Daemon, volumeName string, volumeTypeName 
string) ([]string, error) {
+       // Handle container volumes
+       if volumeTypeName == "container" {
+               cName, sName, snap := 
containerGetParentAndSnapshotName(volumeName)
+
+               if snap {
+                       return 
[]string{fmt.Sprintf("/%s/containers/%s/snapshots/%s", version.APIVersion, 
cName, sName)}, nil
+               }
+
+               return []string{fmt.Sprintf("/%s/containers/%s", 
version.APIVersion, cName)}, nil
+       }
+
+       // Handle image volumes
+       if volumeTypeName == "image" {
+               return []string{fmt.Sprintf("/%s/images/%s", 
version.APIVersion, volumeName)}, nil
+       }
+
        // Look for containers using the interface
        cts, err := dbContainersList(d.db, cTypeRegular)
        if err != nil {
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to