Skip to content

Commit

Permalink
lxd/instance/drivers/driver/qemu: Only call statusCode for local inst…
Browse files Browse the repository at this point in the history
…ances in Render

Signed-off-by: Thomas Parrott <[email protected]>
  • Loading branch information
tomponline committed Dec 19, 2024
1 parent f614e77 commit 39e396b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lxd/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -7808,18 +7808,23 @@ func (d *qemu) 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,
Location: d.node,
Type: d.Type().String(),
StatusCode: api.Error, // Default to error status for remote instances that are unreachable.
}

// 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 = d.architectureName
instState.Config = d.localConfig
Expand Down

0 comments on commit 39e396b

Please sign in to comment.