summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-07-17 19:36:44 +0000
committerGerrit Code Review <review@openstack.org>2014-07-17 19:36:45 +0000
commitd6c2a70f79fd03ef624feddee359ee1cab50d039 (patch)
tree73d9e05eee69c4a77e3d3531cfc1a4bcd172773b
parent57e4e9d1100ba6c3def7d2ca443abab5936b72cf (diff)
parent963ad71af4750e28745b6de262da11816b403801 (diff)
downloadnova-d6c2a70f79fd03ef624feddee359ee1cab50d039.tar.gz
Merge "Deallocate the network if rescheduling for Ironic"
-rw-r--r--nova/compute/manager.py7
-rw-r--r--nova/tests/compute/test_compute_mgr.py4
2 files changed, 6 insertions, 5 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index e6d10d762d..f71f7e4c84 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -1911,9 +1911,10 @@ class ComputeManager(manager.Manager):
self._set_instance_error_state(context, instance.uuid)
return
retry['exc'] = traceback.format_exception(*sys.exc_info())
- # dhcp_options are per host, so if they're set we need to
- # deallocate the networks and reallocate on the next host.
- if self.driver.dhcp_options_for_instance(instance):
+ # The MAC address for this instance is tied to the host so if
+ # we're going to reschedule we have to free the network details
+ # and reallocate on the next host.
+ if self.driver.macs_for_instance(instance):
self._cleanup_allocated_networks(context, instance,
requested_networks)
diff --git a/nova/tests/compute/test_compute_mgr.py b/nova/tests/compute/test_compute_mgr.py
index 91abb7696c..1fcfec5d53 100644
--- a/nova/tests/compute/test_compute_mgr.py
+++ b/nova/tests/compute/test_compute_mgr.py
@@ -1857,7 +1857,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
def test_rescheduled_exception_deallocate_network_if_dhcp(self):
self.mox.StubOutWithMock(self.compute, '_build_and_run_instance')
self.mox.StubOutWithMock(self.compute.driver,
- 'dhcp_options_for_instance')
+ 'macs_for_instance')
self.mox.StubOutWithMock(self.compute, '_cleanup_allocated_networks')
self.mox.StubOutWithMock(self.compute.compute_task_api,
'build_instances')
@@ -1869,7 +1869,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
self.filter_properties).AndRaise(
exception.RescheduledException(reason='',
instance_uuid=self.instance['uuid']))
- self.compute.driver.dhcp_options_for_instance(self.instance).AndReturn(
+ self.compute.driver.macs_for_instance(self.instance).AndReturn(
{'fake': 'options'})
self.compute._cleanup_allocated_networks(self.context, self.instance,
self.requested_networks)