Skip to content

Commit

Permalink
lxd/instance/drivers/driver/lxc: Only call statusCode for local insta…
Browse files Browse the repository at this point in the history
…nces in Render

Signed-off-by: Thomas Parrott <[email protected]>
  • Loading branch information
tomponline committed Dec 19, 2024
1 parent b88c124 commit 0ef7f0d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lxd/instance/drivers/driver_lxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3283,17 +3283,22 @@ func (d *lxc) Render(options ...func(response any) error) (state any, etag any,
// Prepare the ETag
etag = []any{d.architecture, d.localConfig, d.localDevices, d.ephemeral, d.profiles}

statusCode := d.statusCode()
instState := api.Instance{
ExpandedConfig: d.expandedConfig,
ExpandedDevices: d.expandedDevices.CloneNative(),
Name: d.name,
Status: statusCode.String(),
StatusCode: statusCode,
StatusCode: api.Error, // Default to error status for remote instances that are unreachable.
Location: d.node,
Type: d.Type().String(),
}

// If instance is local then request status.
if d.state.ServerName == d.Location() {
instState.StatusCode = d.statusCode()
}

instState.Status = instState.StatusCode.String()

instState.Description = d.description
instState.Architecture = architectureName
instState.Config = d.localConfig
Expand Down

0 comments on commit 0ef7f0d

Please sign in to comment.