summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nova/api/openstack/compute/contrib/deferred_delete.py2
-rw-r--r--nova/api/openstack/compute/plugins/v3/deferred_delete.py2
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_deferred_delete.py8
-rw-r--r--nova/tests/api/openstack/compute/plugins/v3/test_deferred_delete.py10
4 files changed, 12 insertions, 10 deletions
diff --git a/nova/api/openstack/compute/contrib/deferred_delete.py b/nova/api/openstack/compute/contrib/deferred_delete.py
index ff20417706..53b0aa92bd 100644
--- a/nova/api/openstack/compute/contrib/deferred_delete.py
+++ b/nova/api/openstack/compute/contrib/deferred_delete.py
@@ -37,7 +37,7 @@ class DeferredDeleteController(wsgi.Controller):
"""Restore a previously deleted instance."""
context = req.environ["nova.context"]
authorize(context)
- instance = self.compute_api.get(context, id)
+ instance = self.compute_api.get(context, id, want_objects=True)
try:
self.compute_api.restore(context, instance)
except exception.QuotaError as error:
diff --git a/nova/api/openstack/compute/plugins/v3/deferred_delete.py b/nova/api/openstack/compute/plugins/v3/deferred_delete.py
index ed73413aa2..9642ed11de 100644
--- a/nova/api/openstack/compute/plugins/v3/deferred_delete.py
+++ b/nova/api/openstack/compute/plugins/v3/deferred_delete.py
@@ -61,7 +61,7 @@ class DeferredDeleteController(wsgi.Controller):
context = req.environ["nova.context"]
authorize(context)
try:
- instance = self.compute_api.get(context, id)
+ instance = self.compute_api.get(context, id, want_objects=True)
except exception.InstanceNotFound as e:
raise webob.exc.HTTPNotFound(explanation=e.format_message())
try:
diff --git a/nova/tests/api/openstack/compute/contrib/test_deferred_delete.py b/nova/tests/api/openstack/compute/contrib/test_deferred_delete.py
index c397c88e87..bf7e5050a3 100644
--- a/nova/tests/api/openstack/compute/contrib/test_deferred_delete.py
+++ b/nova/tests/api/openstack/compute/contrib/test_deferred_delete.py
@@ -80,8 +80,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
fake_instance = 'fake_instance'
- compute_api.API.get(self.fake_context, self.fake_uuid).AndReturn(
- fake_instance)
+ compute_api.API.get(self.fake_context, self.fake_uuid,
+ want_objects=True).AndReturn(fake_instance)
compute_api.API.restore(self.fake_context, fake_instance)
self.mox.ReplayAll()
@@ -98,8 +98,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
state='fake_state', method='fake_method',
instance_uuid='fake')
- compute_api.API.get(self.fake_context, self.fake_uuid).AndReturn(
- fake_instance)
+ compute_api.API.get(self.fake_context, self.fake_uuid,
+ want_objects=True).AndReturn(fake_instance)
compute_api.API.restore(self.fake_context, fake_instance).AndRaise(
exc)
diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_deferred_delete.py b/nova/tests/api/openstack/compute/plugins/v3/test_deferred_delete.py
index 1aab28726c..2d311749ac 100644
--- a/nova/tests/api/openstack/compute/plugins/v3/test_deferred_delete.py
+++ b/nova/tests/api/openstack/compute/plugins/v3/test_deferred_delete.py
@@ -44,8 +44,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
fake_instance = 'fake_instance'
- compute_api.API.get(self.fake_context, self.fake_uuid).AndReturn(
- fake_instance)
+ compute_api.API.get(self.fake_context, self.fake_uuid,
+ want_objects=True).AndReturn(fake_instance)
compute_api.API.force_delete(self.fake_context, fake_instance)
self.mox.ReplayAll()
@@ -56,7 +56,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
def test_force_delete_instance_not_found(self):
self.mox.StubOutWithMock(compute_api.API, 'get')
- compute_api.API.get(self.fake_context, self.fake_uuid).AndRaise(
+ compute_api.API.get(self.fake_context, self.fake_uuid,
+ want_objects=True).AndRaise(
exception.InstanceNotFound(instance_id='instance-0000'))
self.mox.ReplayAll()
@@ -72,7 +73,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
fake_instance = 'fake_instance'
- compute_api.API.get(self.fake_context, self.fake_uuid).AndReturn(
+ compute_api.API.get(self.fake_context, self.fake_uuid,
+ want_objects=True).AndReturn(
fake_instance)
exc = exception.InstanceInvalidState(attr='fake_attr',