Set host prior to allocating network information.

Make sure 'host' field on the instance is set before allocating
network information.

bug 1065004

Change-Id: I7b929fd50a057c8c69a0b83e07cdc5cd9cb55b45
This commit is contained in:
Brian Elliott 2012-10-16 15:58:20 +00:00
parent bff0ee6777
commit 2649f14673

View File

@ -482,13 +482,14 @@ class ComputeManager(manager.SchedulerDependentManager):
self._notify_about_instance_usage( self._notify_about_instance_usage(
context, instance, "create.start", context, instance, "create.start",
extra_usage_info=extra_usage_info) extra_usage_info=extra_usage_info)
network_info = self._allocate_network(context, instance, network_info = None
requested_networks)
try: try:
limits = filter_properties.get('limits', {}) limits = filter_properties.get('limits', {})
with self.resource_tracker.resource_claim(context, instance, with self.resource_tracker.resource_claim(context, instance,
limits): limits):
network_info = self._allocate_network(context, instance,
requested_networks)
block_device_info = self._prep_block_device(context, block_device_info = self._prep_block_device(context,
instance) instance)
instance = self._spawn(context, instance, image_meta, instance = self._spawn(context, instance, image_meta,
@ -533,7 +534,7 @@ class ComputeManager(manager.SchedulerDependentManager):
try: try:
self._deallocate_network(context, instance) self._deallocate_network(context, instance)
except Exception: except Exception:
# do not attempt retry if network de-allocation occurs: # do not attempt retry if network de-allocation failed:
_log_original_error() _log_original_error()
raise raise