Skip to content

Commit

Permalink
Merge pull request #1323 from stgraber/main
Browse files Browse the repository at this point in the history
incusd/instance/common: Cleanup volatile on device add failure
  • Loading branch information
hallyn authored Oct 20, 2024
2 parents ca5d5e4 + b2c717e commit d3ef305
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/server/instance/drivers/driver_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,9 @@ func (d *common) devicesAdd(inst instance.Instance, instanceRunning bool) (rever
continue
}

// Clear any volatile key that could have been set during validation.
_ = d.deviceVolatileReset(entry.Name, entry.Config, nil)

return nil, fmt.Errorf("Failed add validation for device %q: %w", entry.Name, err)
}

Expand Down Expand Up @@ -1352,6 +1355,9 @@ func (d *common) devicesUpdate(inst instance.Instance, removeDevices deviceConfi
}

if userRequested {
// Clear any volatile key that could have been set during validation.
_ = d.deviceVolatileReset(entry.Name, entry.Config, nil)

return fmt.Errorf("Failed add validation for device %q: %w", entry.Name, err)
}

Expand Down

0 comments on commit d3ef305

Please sign in to comment.