Merge lp://qastaging/~johannes.erdfelt/nova/deferred-delete-instance into lp://qastaging/~hudson-openstack/nova/trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp://qastaging/~johannes.erdfelt/nova/deferred-delete-instance |
Merge into: | lp://qastaging/~hudson-openstack/nova/trunk |
Diff against target: |
103 lines (+30/-24) 2 files modified
nova/compute/api.py (+17/-23) nova/db/sqlalchemy/api.py (+13/-1) |
To merge this branch: | bzr merge lp://qastaging/~johannes.erdfelt/nova/deferred-delete-instance |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Behrens (community) | Needs Fixing | ||
Paul Voccio (community) | Approve | ||
Matt Dietz (community) | Approve | ||
Brian Waldon (community) | Needs Information | ||
Brian Lamar (community) | Needs Information | ||
Review via email: mp+74530@code.qastaging.launchpad.net |
Description of the change
Instance deletions in Openstack are immediate. This can cause data to be lost accidentally.
This branch adds a new configuration flag, reclaim_
New actions, restore and forceDelete allow a previously deleted instance to be restored, or reclaimed immediately.
Unmerged revisions
- 1557. By Johannes Erdfelt
-
Make sure context gets passed to new _delete() method
- 1556. By Johannes Erdfelt
-
Merge with trunk
- 1555. By Johannes Erdfelt
-
Consolidate similar code
- 1554. By Johannes Erdfelt
-
Handle soft deleted instances identically to hard deleted instances
- 1553. By Johannes Erdfelt
-
Merge with trunk
55 + "Restore a previously deleted instance."
56 +
I think you need more quotes to make this a docstring, and line 56 should be removed. Same goes for:
62 + "Force delete of instance before deferred cleanup."
63 +
Maybe this is pedantic, but I think these are too far indented, 4 spaces should suffice but it doesn't mess with pep8 so feel free to ignore me:
85 + actions = [ ActionExtension ("servers" , "restore", ActionExtension ("servers" , "forceDelete", delete) ,
86 + extensions.
87 + self._restore),
88 + extensions.
89 + self._force_
90 + ]
I'd argue that instead of having:
vm_state = vm_states.DELETED QUEUED_ DELETE
task_state = task_states.
...that we have something like this:
vm_state = vm_states. SOFT_DELETE
or
vm_state = vm_states. SCHEDULED_ FOR_DELETION
I really go back and forth on this because I feel like task_states should be short-lived tasks and that vm_states are longer and potentially 'more permanent' if that makes sense. Having a vm_state of DELETED when it's not actually deleted seems confusing to me (although I understand for all intents and purposes that it's deleted).
My other question/comment is slightly larger, but wouldn't require a lot more work to implement. Would it be better to have a Compute API schedule_delete() method which can be called separately of delete()? The reason I ask is that I like methods to do one thing and do it well. If someone calls Compute API delete() they might expect the instance to be deleted. There is no indication given in the function call that the instance will simply be shut down.
nova.compute. api:API. schedule_ delete( self, context, instance_id, datetime/ seconds_ in_the_ future)
might be more explicit.
Overall I love the tests and code, just want to make sure the interface is correct.