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

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) ===
This fixes an issue when:

 - Two storage pools
 - Two projects
 - Instance called `c1` is created in first project and storage pool
 - Instance called `c1` is created in second project and storage pool

This breaks because this function returns the name of the first storage pool for the second container.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 6dd0893c021b3ac5ec077cc56e4cc9274ceb4a62 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Thu, 20 Aug 2020 16:31:35 +0100
Subject: [PATCH] lxd/db/instances: Ensure correct pool name is returned in
 GetInstancePool

This fixes an issue when:

 - Two storage pools
 - Two projects
 - Instance called `c1` is created in first project and storage pool
 - Instance called `c1` is created in second project and storage pool

This breaks because this function returns the name of the first storage pool 
for the second container.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/db/instances.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lxd/db/instances.go b/lxd/db/instances.go
index 20a0a1d80c..b4362c4d11 100644
--- a/lxd/db/instances.go
+++ b/lxd/db/instances.go
@@ -677,6 +677,7 @@ SELECT storage_pools.name FROM storage_pools
    AND storage_volumes_all.node_id=?
    AND storage_volumes_all.name=?
    AND storage_volumes_all.type IN(?,?)
+   AND storage_volumes_all.project_id = instances.project_id
 `
        inargs := []interface{}{project, c.nodeID, instanceName, 
StoragePoolVolumeTypeContainer, StoragePoolVolumeTypeVM}
        outargs := []interface{}{&poolName}
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to