Merge "Fix deferred delete use of objects"
This commit is contained in:
@@ -37,7 +37,7 @@ class DeferredDeleteController(wsgi.Controller):
|
|||||||
"""Restore a previously deleted instance."""
|
"""Restore a previously deleted instance."""
|
||||||
context = req.environ["nova.context"]
|
context = req.environ["nova.context"]
|
||||||
authorize(context)
|
authorize(context)
|
||||||
instance = self.compute_api.get(context, id)
|
instance = self.compute_api.get(context, id, want_objects=True)
|
||||||
try:
|
try:
|
||||||
self.compute_api.restore(context, instance)
|
self.compute_api.restore(context, instance)
|
||||||
except exception.QuotaError as error:
|
except exception.QuotaError as error:
|
||||||
|
@@ -61,7 +61,7 @@ class DeferredDeleteController(wsgi.Controller):
|
|||||||
context = req.environ["nova.context"]
|
context = req.environ["nova.context"]
|
||||||
authorize(context)
|
authorize(context)
|
||||||
try:
|
try:
|
||||||
instance = self.compute_api.get(context, id)
|
instance = self.compute_api.get(context, id, want_objects=True)
|
||||||
except exception.InstanceNotFound as e:
|
except exception.InstanceNotFound as e:
|
||||||
raise webob.exc.HTTPNotFound(explanation=e.format_message())
|
raise webob.exc.HTTPNotFound(explanation=e.format_message())
|
||||||
try:
|
try:
|
||||||
|
@@ -80,8 +80,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
|
|||||||
|
|
||||||
fake_instance = 'fake_instance'
|
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,
|
||||||
fake_instance)
|
want_objects=True).AndReturn(fake_instance)
|
||||||
compute_api.API.restore(self.fake_context, fake_instance)
|
compute_api.API.restore(self.fake_context, fake_instance)
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
@@ -98,8 +98,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
|
|||||||
state='fake_state', method='fake_method',
|
state='fake_state', method='fake_method',
|
||||||
instance_uuid='fake')
|
instance_uuid='fake')
|
||||||
|
|
||||||
compute_api.API.get(self.fake_context, self.fake_uuid).AndReturn(
|
compute_api.API.get(self.fake_context, self.fake_uuid,
|
||||||
fake_instance)
|
want_objects=True).AndReturn(fake_instance)
|
||||||
compute_api.API.restore(self.fake_context, fake_instance).AndRaise(
|
compute_api.API.restore(self.fake_context, fake_instance).AndRaise(
|
||||||
exc)
|
exc)
|
||||||
|
|
||||||
|
@@ -44,8 +44,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
|
|||||||
|
|
||||||
fake_instance = 'fake_instance'
|
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,
|
||||||
fake_instance)
|
want_objects=True).AndReturn(fake_instance)
|
||||||
compute_api.API.force_delete(self.fake_context, fake_instance)
|
compute_api.API.force_delete(self.fake_context, fake_instance)
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
@@ -56,7 +56,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
|
|||||||
def test_force_delete_instance_not_found(self):
|
def test_force_delete_instance_not_found(self):
|
||||||
self.mox.StubOutWithMock(compute_api.API, 'get')
|
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'))
|
exception.InstanceNotFound(instance_id='instance-0000'))
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
@@ -72,7 +73,8 @@ class DeferredDeleteExtensionTest(test.TestCase):
|
|||||||
|
|
||||||
fake_instance = 'fake_instance'
|
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)
|
fake_instance)
|
||||||
|
|
||||||
exc = exception.InstanceInvalidState(attr='fake_attr',
|
exc = exception.InstanceInvalidState(attr='fake_attr',
|
||||||
|
Reference in New Issue
Block a user