Raised exceptions must not be logged

Bug #1377927 reported by Radoslav Gerganov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.vmware
Fix Released
Medium
Radoslav Gerganov

Bug Description

Fault messages from vCenter are translated to exceptions which are logged and then raised by oslo.vmware. The former is wrong -- there are many cases when the exception is expected and it must not be logged as an error. It is the client who must decide whether something is an error or not.

For example a common pattern is to catch DuplicateName/AlreadyExists exceptions and ignore them in the cases when multiple threads are performing the same operation. In these cases we are getting the following logs from oslo which are confusing:

2014-10-06 15:29:44,492 - oslo.vmware.api - ERROR - Exception which is not in the suggested list of exceptions occurred while invoking _invoke_api.
Traceback (most recent call last):
  File "/Users/rgerganov/src/vmops/.oslo/lib/python2.7/site-packages/oslo/vmware/api.py", line 94, in _func
    result = f(*args, **kwargs)
  File "/Users/rgerganov/src/vmops/.oslo/lib/python2.7/site-packages/oslo/vmware/api.py", line 335, in _invoke_api
    raise clazz(unicode(excep), excep.details)
DuplicateName: The name 'fira' already exists.
Cause: Server raised fault: 'The name 'fira' already exists.'
Faults: [DuplicateName]
Details: {'object': 'group-v343', 'name': 'fira'}
2014-10-06 15:29:44,492 - oslo.vmware.common.loopingcall - ERROR - in dynamic looping call
Traceback (most recent call last):
  File "/Users/rgerganov/src/vmops/.oslo/lib/python2.7/site-packages/oslo/vmware/common/loopingcall.py", line 123, in _inner
    idle = self.f(*self.args, **self.kw)
  File "/Users/rgerganov/src/vmops/.oslo/lib/python2.7/site-packages/oslo/vmware/api.py", line 120, in _func
    func_name)
  File "/Users/rgerganov/src/vmops/.oslo/lib/python2.7/site-packages/oslo/utils/excutils.py", line 82, in __exit__
    six.reraise(self.type_, self.value, self.tb)
  File "/Users/rgerganov/src/vmops/.oslo/lib/python2.7/site-packages/oslo/vmware/api.py", line 94, in _func
    result = f(*args, **kwargs)
  File "/Users/rgerganov/src/vmops/.oslo/lib/python2.7/site-packages/oslo/vmware/api.py", line 335, in _invoke_api
    raise clazz(unicode(excep), excep.details)
DuplicateName: The name 'fira' already exists.
Cause: Server raised fault: 'The name 'fira' already exists.'
Faults: [DuplicateName]
Details: {'object': 'group-v343', 'name': 'fira'}

The proper behaviour is to raise then exception without logging it in oslo.

Changed in oslo.vmware:
importance: Undecided → Medium
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Fixed in https://review.openstack.org/#/c/126287/ somehow the CI did not mark this bug appropriately

Changed in oslo.vmware:
status: New → Fix Committed
milestone: none → next-kilo
Changed in oslo.vmware:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers