diff options
author | Zuul <zuul@review.opendev.org> | 2022-02-21 23:11:39 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-02-21 23:11:39 +0000 |
commit | b9b32676dafd1b25ec63671c3e725492501a3627 (patch) | |
tree | b730589c627869bb7dd8bc9333a88fc19e26f835 /nova/network | |
parent | 2f6ca566061422054865a19e6fb0074e7db398c1 (diff) | |
parent | ecb5f1717191379b5ade160ae814f7da8b91e7e8 (diff) | |
download | nova-b9b32676dafd1b25ec63671c3e725492501a3627.tar.gz |
Merge "Raise InstanceNotFound on fkey constraint fail saving info cache"
Diffstat (limited to 'nova/network')
-rw-r--r-- | nova/network/neutron.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/network/neutron.py b/nova/network/neutron.py index 9f948c27bd..0146a2bf52 100644 --- a/nova/network/neutron.py +++ b/nova/network/neutron.py @@ -124,6 +124,19 @@ def update_instance_cache_with_nw_info(impl, context, instance, nw_info=None): ic.network_info = nw_info ic.save() instance.info_cache = ic + except exception.InstanceNotFound as e: + # The instance could have moved during a cross-cell migration when we + # receive an external event from neutron. Avoid logging a traceback + # when it happens. + msg = str(e) + if e.__class__.__name__.endswith('_Remote'): + # If this exception was raised remotely over RPC, the traceback(s) + # will be appended to the message. Truncate it in that case. + msg = utils.safe_truncate(msg.split('\n', 1)[0], 255) + LOG.info('Failed storing info cache due to: %s. ' + 'The instance may have moved to another cell during a ' + 'cross-cell migration', msg, instance=instance) + raise exception.InstanceNotFound(message=msg) except Exception: with excutils.save_and_reraise_exception(): LOG.exception('Failed storing info cache', instance=instance) |