Inconsistent delete API in case of soft-delete

Bug #1436849 reported by Ankit Agrawal
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Low
Unassigned

Bug Description

When instance.vm_state is SOFT_DELETED, if we send duplicate delete request there is an inconsistency in delete api.
If delete api is called with instance name, it returns an error message while calling it with instance id returns success response and sends duplicate delete call to the server.

Steps to reproduce:

1. Set reclaim_instance_interval parameter in nova.conf and restart nova-api and compute services.

2. Create an instance.
$ nova boot --flavor 42 --image 7c0b4737-f630-4adc-9907-4868d2571260 test

3. Soft delete instance.
$ nova delete test
--Will soft delete the instance and update the vm_state to SOFT_DELETED

4. Call delete instance again with instance name.
$ nova delete test
Response: No server with a name or ID of 'test' exists.
ERROR (CommandError): Unable to delete the specified server(s).

5. Call delete instance using instance id.
$ nova delete dc4449fe-5229-4b55-ad49-4fc9a5d8367f
Response: Request to delete server dc4449fe-5229-4b55-ad49-4fc9a5d8367f has been accepted. (sends duplicate delete request)

This is because when we call delete using instance id it fetch instance which is already in SOFT_DELETED state but in case of
using instance name it does not fetch instances which are already in SOFT_DELETED state.

Ideally it should return same response in both the cases (with instance name and id).

Note: Same issue is with force-delete call when instance is in SOFT_DELETED state.

Tags: compute
Changed in nova:
assignee: nobody → Ankit Agrawal (ankitagrawal)
Changed in nova:
importance: Undecided → Low
Changed in nova:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/171523

Changed in nova:
status: Confirmed → In Progress
melanie witt (melwitt)
tags: added: compute
removed: ntt
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Ankit Agrawal (<email address hidden>) on branch: master
Review: https://review.openstack.org/171523

Changed in nova:
assignee: Ankit Agrawal (ankitagrawal) → nobody
status: In Progress → Confirmed
Changed in nova:
assignee: nobody → Anusha Unnam (anusha-unnam)
status: Confirmed → In Progress
Revision history for this message
Anusha Unnam (anusha-unnam) wrote :

According to my understanding of this bug, it can't be fixed. Can we mark the bug as can't fix?

'_get_servers' method in nova/api/openstack/compute/servers.py needs to set filters deleted = true and soft_deleted = true if vm_state = 'soft-delete' inorder to get the soft_deleted instances from db https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L2123. But these filers should come from the request only, like in the case of 'nova list --status soft_deleted'.
This can be fixed may be something like 'nova delete <instance_name> deleted=true' but that is adding a new request parameter. Can we fix this way? Other than this I can't think of an alternate fix.

Anyone please let me know if I am wrong.

Revision history for this message
Sean Dague (sdague) wrote :

There are no currently open reviews on this bug, changing
the status back to the previous state and unassigning. If
there are active reviews related to this bug, please include
links in comments.

Changed in nova:
status: In Progress → Confirmed
assignee: Anusha Unnam (anusha-unnam) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.