diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-09-14 22:31:00 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-09-14 22:31:00 +0000 |
| commit | a5b339fb75e1e5f525a758ea1fb2fb35d1b9044a (patch) | |
| tree | 27dfb0bf08b60206e606715a3aad580542b87e05 /nova/api | |
| parent | ed0d8bfd0fd7bbe81dd5e39683ec3e90fc86c16c (diff) | |
| download | nova-a5b339fb75e1e5f525a758ea1fb2fb35d1b9044a.tar.gz nova-a5b339fb75e1e5f525a758ea1fb2fb35d1b9044a.tar.xz nova-a5b339fb75e1e5f525a758ea1fb2fb35d1b9044a.zip | |
Cleanup state management to use vm_state instead of task_state
Add schedule_delete() method so delete() actually does what it says it does
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 1 | ||||
| -rw-r--r-- | nova/api/openstack/common.py | 3 | ||||
| -rw-r--r-- | nova/api/openstack/servers.py | 10 |
3 files changed, 12 insertions, 2 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 0efb90d6e..ee9d658e8 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -89,6 +89,7 @@ _STATE_DESCRIPTION_MAP = { vm_states.BUILDING: 'pending', vm_states.REBUILDING: 'pending', vm_states.DELETED: 'terminated', + vm_states.SOFT_DELETE: 'terminated', vm_states.STOPPED: 'stopped', vm_states.MIGRATING: 'migrate', vm_states.RESIZING: 'resize', diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index a836a584c..66e18c557 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -78,6 +78,9 @@ _STATE_MAP = { vm_states.DELETED: { 'default': 'DELETED', }, + vm_states.SOFT_DELETE: { + 'default': 'DELETED', + }, } diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 5affd1f33..c81deb3ac 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -169,6 +169,12 @@ class Controller(object): server['server']['adminPass'] = extra_values['password'] return server + def _delete(self, context, id): + if FLAGS.reclaim_instance_interval: + self.compute_api.soft_delete(context, id) + else: + self.compute_api.delete(context, id) + @scheduler_api.redirect_handler def update(self, req, id, body): """Update server then pass on to version-specific controller""" @@ -566,7 +572,7 @@ class ControllerV10(Controller): def delete(self, req, id): """ Destroys a server """ try: - self.compute_api.delete(req.environ['nova.context'], id) + self._delete(req.environ['nova.context'], id) except exception.NotFound: raise exc.HTTPNotFound() return webob.Response(status_int=202) @@ -644,7 +650,7 @@ class ControllerV11(Controller): def delete(self, req, id): """ Destroys a server """ try: - self.compute_api.delete(req.environ['nova.context'], id) + self._delete(req.environ['nova.context'], id) except exception.NotFound: raise exc.HTTPNotFound() |
