nova/nova
Matt Riedemann e9261764c9 Handle Invalid exceptions as expected in attach_interface
The bug prompting this is a tempest test which is requesting
a port attachment to a server but not specifying a port or
network to use, so nova-compute looks for a valid network
and finds there are two and raises NetworkAmbiguous. This
is treated as a 400 error in the API but because this is a
synchronous RPC call from nova-api to nova-compute,
oslo.messaging logs an exception traceback for the unexpected
error. That traceback is pretty gross in the compute logs for
something that is a user error and the cloud operator has
nothing to do to fix it.

We can handle the traceback by registering our expected
exceptions for the attach_interface method with oslo.messaging,
which is what this change does.

While looking to just add NetworkAmbiguous it became clear that
lots of different user errors can be raised from this method
and none of those should result in a traceback, so this change
just expects Invalid and its subclasses.

The one exception is InterfaceAttachFailed which is raised when
something in allocate_port_for_instance or driver.attach_interface
fails. That is an unexpected situation so the parent class for
InterfaceAttachFailed is changed from Invalid to NovaException so
it continues to be traced in the logs as an exception.
InterfaceAttachFailedNoNetwork is kept as Invalid since it is a
user error (trying to attach an interface when the user has no
access to any networks).

test_tagged_attach_interface_raises is adjusted to show the
ExpectedException handling for one of the Invalid cases.

Change-Id: I927ff1d8c8f45405833d6012b7d7af37b98b10a0
Closes-Bug: #1823198
(cherry picked from commit ade6c93936)
2019-07-23 22:49:49 +00:00
..
api Merge "Delete resource providers for all nodes when deleting compute service" into stable/stein 2019-07-01 16:25:12 +00:00
cells Per aggregate scheduling weight 2019-01-21 11:48:44 +08:00
cmd Eventlet monkey patching should be as early as possible 2019-03-25 09:22:01 +01:00
common
compute Handle Invalid exceptions as expected in attach_interface 2019-07-23 22:49:49 +00:00
conductor Noop CantStartEngineError in targets_cell if API DB not configured 2019-06-04 13:32:51 +00:00
conf Fix help for ironic.peer_list config 2019-05-01 12:50:19 +00:00
console Move create of ComputeAPI object in websocketproxy 2019-04-02 15:43:18 +00:00
consoleauth Fix stacktraces with redis caching backend 2018-09-27 13:15:11 -04:00
db Fix retry of instance_update_and_get_original 2019-05-15 16:29:53 +01:00
hacking Add a hacking rule for deprecated assertion methods 2018-10-25 11:49:10 +09:00
image Share snapshot image membership with instance owner 2019-02-08 18:06:27 -05:00
ipv6
keymgr
locale Imported Translations from Zanata 2018-09-23 06:53:32 +00:00
network Revert resize: wait for events according to hybrid plug 2019-07-12 19:16:28 -04:00
notifications Remove CellMappingPayload database_connection and transport_url fields 2019-04-04 21:25:52 +00:00
objects Revert resize: wait for events according to hybrid plug 2019-07-12 19:16:28 -04:00
pci Add get_instance_pci_request_from_vif 2019-03-07 11:37:53 +02:00
policies Merge "Remove deprecated 'flavors' policy" 2019-02-23 06:13:00 +00:00
privsep Merge "Move slight bonkers IP management to privsep." 2019-03-20 13:21:29 +00:00
scheduler Init HostState.failed_builds 2019-06-29 02:36:21 +00:00
servicegroup Fix deprecation warning for threadgroup.add_timer 2019-02-07 09:37:00 -05:00
tests Handle Invalid exceptions as expected in attach_interface 2019-07-23 22:49:49 +00:00
virt Revert resize: wait for events according to hybrid plug 2019-07-12 19:16:28 -04:00
vnc Deprecate the nova-xvpvncproxy service 2018-10-15 10:03:13 +01:00
volume Use migration_status during volume migrating and retyping 2019-05-07 11:39:28 +00:00
__init__.py Eventlet monkey patching should be as early as possible 2019-03-25 09:22:01 +01:00
availability_zones.py AZ list performance optimization: avoid double service list DB fetch 2019-04-29 19:05:05 +00:00
baserpc.py
block_device.py Add method to generate device names universally 2019-01-15 18:55:11 +00:00
cache_utils.py
config.py Configure placement DB context manager for nova-manage/status 2018-09-05 10:29:48 -04:00
context.py Fix target used in nova.policy.check_is_admin 2019-05-21 10:55:14 +01:00
crypto.py
debugger.py
exception.py Handle Invalid exceptions as expected in attach_interface 2019-07-23 22:49:49 +00:00
exception_wrapper.py Add full traceback to ExceptionPayload in versioned notifications 2018-06-19 16:46:46 +08:00
filters.py
hooks.py
i18n.py
loadables.py
manager.py
monkey_patch.py Eventlet monkey patching should be as early as possible 2019-03-25 09:22:01 +01:00
policy.py Fix target used in nova.policy.check_is_admin 2019-05-21 10:55:14 +01:00
profiler.py
quota.py Merge "quota: remove defaults kwarg in get_project_quotas" 2019-02-26 13:26:24 +00:00
rc_fields.py Switch to using os-resource-classes 2019-02-07 11:11:09 +00:00
rpc.py Fix jsonutils.to_primitive UserWarning 2018-12-17 22:56:50 -05:00
safe_utils.py
service.py Move conductor wait_until_ready() delay before manager init 2018-08-31 12:50:10 -07:00
service_auth.py
test.py Eventlet monkey patching should be as early as possible 2019-03-25 09:22:01 +01:00
utils.py Eventlet monkey patching should be as early as possible 2019-03-25 09:22:01 +01:00
version.py
weights.py Per aggregate scheduling weight 2019-01-21 11:48:44 +08:00
wsgi.py