summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnova/compute/manager.py2
-rw-r--r--nova/tests/compute/test_compute.py24
2 files changed, 25 insertions, 1 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 1def5b069..bd4e6f772 100755
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -1344,7 +1344,7 @@ class ComputeManager(manager.SchedulerDependentManager):
# get network info before tearing down
try:
network_info = self._get_instance_nw_info(context, instance)
- except exception.NetworkNotFound:
+ except (exception.NetworkNotFound, exception.NoMoreFixedIps):
network_info = network_model.NetworkInfo()
# NOTE(vish) get bdms before destroying the instance
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index 8c6fce3a5..abb4d8e39 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -1214,6 +1214,30 @@ class ComputeTestCase(BaseTestCase):
LOG.info(_("After terminating instances: %s"), instances)
self.assertEqual(len(instances), 0)
+ def test_terminate_no_fixed_ips(self):
+ # This is as reported in LP bug 1192893
+ instance = jsonutils.to_primitive(self._create_fake_instance())
+
+ self.compute.run_instance(self.context, instance=instance)
+
+ instances = db.instance_get_all(self.context)
+ LOG.info(_("Running instances: %s"), instances)
+ self.assertEqual(len(instances), 1)
+
+ self.mox.StubOutWithMock(self.compute, '_get_instance_nw_info')
+ self.compute._get_instance_nw_info(
+ mox.IgnoreArg(),
+ mox.IgnoreArg()).AndRaise(
+ exception.NoMoreFixedIps()
+ )
+ self.mox.ReplayAll()
+
+ self.compute.terminate_instance(self.context, instance=instance)
+
+ instances = db.instance_get_all(self.context)
+ LOG.info(_("After terminating instances: %s"), instances)
+ self.assertEqual(len(instances), 0)
+
def test_terminate_failure_leaves_task_state(self):
"""Ensure that a failure in terminate_instance does not result
in the task state being reverted from DELETING (see LP 1046236).