Nova-api cast to conductor is an asynchronous rpc, which cannot handle exceptions.
When nova-conductor makes a synchronous rpc call to nova-scheduler to select a target node for evacuation, it triggers an oslo_messaging.exceptions.MessagingTimeout.
try: # if this is a rebuild of instance on the same host with # new image. if not evacuate and orig_image_ref != image_ref: self._validate_image_traits_for_rebuild(context, instance, image_ref) self._restrict_request_spec_to_cell( context, instance, request_spec) request_spec.ensure_project_and_user_id(instance) request_spec.ensure_network_information(instance) compute_utils.heal_reqspec_is_bfv( context, request_spec, instance)
if recreate: scheduler_utils.fill_provider_mapping( request_spec, selection)
except (exception.NoValidHost, exception.UnsupportedPolicyException, exception.AllocationUpdateFailed, # the next two can come from fill_provider_mapping and # signals a software error. NotImplementedError, ValueError) as ex: ......
Nova-api cast to conductor is an asynchronous rpc, which cannot handle exceptions. exceptions. MessagingTimeou t.
When nova-conductor makes a synchronous rpc call to nova-scheduler to select a target node for evacuation, it triggers an oslo_messaging.
```python trace_cls( "rpc") ger(base. Base): instance( self, context, instance, orig_image_ref, image_ref,
injected_ files, new_pass, orig_sys_metadata,
bdms, recreate, on_shared_storage,
preserve_ ephemeral= False, host=None,
request_ spec=None) :
@profiler.
class ComputeTaskMana
@targets_cell
def rebuild_
......
......
```
called `_schedule_ instances`
```python instances( self, context, request_spec,
instance_ uuids=None, return_ alternates= False):
scheduler_ utils.setup_ instance_ group(context, request_spec) StopWatch( ) as timer:
host_ lists = self.query_ client. select_ destinations(
context, request_spec, instance_uuids, return_ objects= True,
return_ alternates= return_ alternates)
LOG.debug( 'Took %0.2f seconds to select destinations for %s '
'instance( s).', timer.elapsed(), len(instance_ uuids))
def _schedule_
with timeutils.
return host_lists
```
We just need to catch `MessagingTimeout` in the except block and reuse the existing exception handling logic to elegantly solve the problem.