Skip to content

Commit

Permalink
Merge pull request #11967 from monstermunchkin/issues/11947
Browse files Browse the repository at this point in the history
Add instance type to instances of offline cluster members
  • Loading branch information
tomponline authored Jul 7, 2023
2 parents e7a0bfa + b30784f commit 45c59c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lxd/db/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions lxd/instances_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
}

Expand Down

0 comments on commit 45c59c2

Please sign in to comment.