The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7906
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) === To avoid unexpectedly only filtering for container types. Fixes 7897 Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 7a408f07b9b002e0a35373d392f8977d044582b0 Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Mon, 21 Sep 2020 16:22:37 +0100 Subject: [PATCH] lxd: Ensure all use of db.InstanceFilter defines instance type To avoid unexpectedly only filtering for container types. Fixes 7897 Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/db/instances.go | 4 +++- lxd/project/permissions.go | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lxd/db/instances.go b/lxd/db/instances.go index d05267cb40..4a17a53e71 100644 --- a/lxd/db/instances.go +++ b/lxd/db/instances.go @@ -324,7 +324,9 @@ SELECT instances.name, nodes.id, nodes.address, nodes.heartbeat // Load all instances across all projects and expands their config and devices // using the profiles they are associated to. func (c *ClusterTx) instanceListExpanded() ([]Instance, error) { - instances, err := c.GetInstances(InstanceFilter{}) + instances, err := c.GetInstances(InstanceFilter{ + Type: instancetype.Any, + }) if err != nil { return nil, errors.Wrap(err, "Load instances") } diff --git a/lxd/project/permissions.go b/lxd/project/permissions.go index c24bed6ed6..8a238d25ba 100644 --- a/lxd/project/permissions.go +++ b/lxd/project/permissions.go @@ -854,7 +854,10 @@ func fetchProject(tx *db.ClusterTx, projectName string, skipIfNoLimits bool) (*p return nil, errors.Wrap(err, "Fetch profiles from database") } - instances, err := tx.GetInstances(db.InstanceFilter{Project: projectName}) + instances, err := tx.GetInstances(db.InstanceFilter{ + Type: instancetype.Any, + Project: projectName, + }) if err != nil { return nil, errors.Wrap(err, "Fetch project instances from database") }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel