Merge "Fix deferred delete use of objects"

This commit is contained in:
Jenkins
2013-08-08 23:36:11 +00:00
committed by Gerrit Code Review
4 changed files with 12 additions and 10 deletions

View File

@@ -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:

View File

@@ -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:

View File

@@ -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)

View File

@@ -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',