From fb4b68d5d9a44fc1d48044f95cbcd2f42baece5b Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Fri, 7 Jul 2023 15:30:44 +0200 Subject: [PATCH] lxd/db: Return instance type from GetInstancesByMemberAddress Signed-off-by: Thomas Hipp --- lxd/db/instances.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lxd/db/instances.go b/lxd/db/instances.go index fc13c3f26b33..229474d4a126 100644 --- a/lxd/db/instances.go +++ b/lxd/db/instances.go @@ -147,6 +147,7 @@ type Instance struct { Name string Project string Location string + Type instancetype.Type } // GetInstancesByMemberAddress returns the instances associated to each cluster member address. @@ -157,7 +158,7 @@ func (c *ClusterTx) GetInstancesByMemberAddress(ctx context.Context, offlineThre var q strings.Builder q.WriteString(`SELECT - instances.id, instances.name, + instances.id, instances.name, instances.type, nodes.id, nodes.name, nodes.address, nodes.heartbeat, projects.name FROM instances @@ -193,7 +194,7 @@ func (c *ClusterTx) GetInstancesByMemberAddress(ctx context.Context, offlineThre var memberAddress string var memberID int64 var memberHeartbeat time.Time - err := rows.Scan(&inst.ID, &inst.Name, &memberID, &inst.Location, &memberAddress, &memberHeartbeat, &inst.Project) + err := rows.Scan(&inst.ID, &inst.Name, &inst.Type, &memberID, &inst.Location, &memberAddress, &memberHeartbeat, &inst.Project) if err != nil { return nil, err } From b30784f901fcb07f78ad16db03d3e5c25e7867cd Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Fri, 7 Jul 2023 15:32:06 +0200 Subject: [PATCH] lxd: Add instance type to instances of offline cluster members This sets the instance type correctly for instances of offline cluster members. Fixes #11947 Signed-off-by: Thomas Hipp --- lxd/instances_get.go | 1 + 1 file changed, 1 insertion(+) diff --git a/lxd/instances_get.go b/lxd/instances_get.go index b1c6ab513926..4a660ffea910 100644 --- a/lxd/instances_get.go +++ b/lxd/instances_get.go @@ -318,6 +318,7 @@ func doInstancesGet(s *state.State, r *http.Request) (any, error) { StatusCode: api.Error, Location: inst.Location, Project: inst.Project, + Type: inst.Type.String(), }, }