Simplest fix would be to raise BuildAbortException with the original spawn failure, and simply log "Could not clean up failed build" line. Please see the code snippet [1]
Three reasons for doing this:
1. The only reason why the call landed there was because spawn failed. So knowing that error is more important than anything else
2. IMHO, "Could not clean up failed build" does not give any useful information about any failure. Its probably OK to log it, but not very useful to have that as instance fault.
3. Combining all of the statements is not possible because of the character limit of "message" field
[1]
try:
yield resources
except Exception as exc:
with excutils.save_and_reraise_exception() as ctxt:
if not isinstance(exc, (exception.InstanceNotFound, exception.UnexpectedDeletingTaskStateError)): LOG.exception(_LE('Instance failed to spawn'), instance=instance)
# Make sure the async call finishes
if network_info is not None: network_info.wait(do_raise=False)
# if network_info is empty we're likely here because of
# network allocation failure. Since nothing can be reused on
# rescheduling it's better to deallocate network to eliminate
# the chance of orphaned ports in neutron deallocate_networks = False if network_info else True try: self._shutdown_instance(context, instance, block_device_mapping, requested_networks, try_deallocate_networks=deallocate_networks) except Exception: ctxt.reraise = False LOG.exception(_LE('Could not clean up failed build,' <<<< ' not rescheduling'), <<< instance=instance) <<< raise exception.BuildAbortException( instance_uuid=instance.uuid, reason=exc) <<<
@Melanie, @Mark,
Simplest fix would be to raise BuildAbortException with the original spawn failure, and simply log "Could not clean up failed build" line. Please see the code snippet [1]
Three reasons for doing this:
1. The only reason why the call landed there was because spawn failed. So knowing that error is more important than anything else
2. IMHO, "Could not clean up failed build" does not give any useful information about any failure. Its probably OK to log it, but not very useful to have that as instance fault.
3. Combining all of the statements is not possible because of the character limit of "message" field
[1] save_and_ reraise_ exception( ) as ctxt: InstanceNotFoun d,
exception .UnexpectedDele tingTaskStateEr ror)):
LOG. exception( _LE('Instance failed to spawn'),
instance= instance)
network_ info.wait( do_raise= False)
deallocate_ networks = False if network_info else True
try:
self. _shutdown_ instance( context, instance,
block_device_ mapping, requested_networks,
try_deallocate_ networks= deallocate_ networks)
except Exception:
ctxt. reraise = False
LOG. exception( _LE('Could not clean up failed build,' <<<<
' not rescheduling'), <<<
instance= instance) <<<
raise exception. BuildAbortExcep tion(
instance_ uuid=instance. uuid, reason=exc) <<<
try:
yield resources
except Exception as exc:
with excutils.
if not isinstance(exc, (exception.
# Make sure the async call finishes
if network_info is not None:
# if network_info is empty we're likely here because of
# network allocation failure. Since nothing can be reused on
# rescheduling it's better to deallocate network to eliminate
# the chance of orphaned ports in neutron