lxd
lxd copied to clipboard
Force delete instance from API
Please confirm
- [x] I have searched existing issues to check if an issue already exists for my feature request.
Is your feature request related to a problem? Please describe.
Could you please expose force delete of a running instance in the API ?
Describe the solution you'd like
I would like to be able to send a DELETE request to /1.0/instances/{instanceName}?project={projectName}&force=1 to delete a running instance.
It currently returns an error "The instance is running" because the force flag is ignored from this endpoint.
Describe alternatives you've considered
I can stop the instance then delete it. But the force delete would be way simpler.
Additional context
https://github.com/canonical/lxd/blob/main/lxd/instance_delete.go#L81
This is the error I currently see: https://github.com/canonical/lxd/blob/main/lxd/instance_delete.go#L98-L100