Bug 1402359

Summary: Calling storage apis with incorrect arguments log tracebacks in vdsm log
Product: [oVirt] vdsm Reporter: Nir Soffer <nsoffer>
Component: CoreAssignee: Idan Shaby <ishaby>
Status: CLOSED WONTFIX QA Contact: Elad <ebenahar>
Severity: low Docs Contact:
Priority: low    
Version: 4.18.0CC: bugs, ebenahar, tnisan, ylavi
Target Milestone: ---Flags: sbonazzo: ovirt-4.3-
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-02 08:27:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Nir Soffer 2016-12-07 10:53:44 UTC
Description of problem:

Calling storage apis with incorrect arguments log tracebacks in the log:

2016-12-07 10:09:52,868 ERROR (jsonrpc/3) [storage.TaskManager.Task] (Task='a046981d-7fb2-4081-9bd9-f12e45ddf817') Unexpected error (task:870)
Traceback (most recent call last):
  File "/usr/share/vdsm/storage/task.py", line 877, in _run
    return fn(*args, **kargs)
  File "/usr/lib/python2.7/site-packages/vdsm/logUtils.py", line 50, in wrapper
    res = f(*args, **kwargs)
  File "/usr/share/vdsm/storage/hsm.py", line 2496, in getStoragePoolInfo
    pool = self.getPool(spUUID)
  File "/usr/share/vdsm/storage/hsm.py", line 327, in getPool
    raise se.StoragePoolUnknown(spUUID)
StoragePoolUnknown: Unknown pool id, pool not connected: (u'xxxyyy',)

In this case, the pool id (xxxyyy) was incorrect.

This is a user error and not vdsm error, so we should log a warning instead.
The text of the exception is a good description of the warning, so we just
need to handle the exception properly in the top level error handler.

To handle exceptions  properly, vdsm needs to have a sane exception hierarchy:

    VdsmError
        ClientError
            InvalidArgument
            PoolNotConnected
            ...
        ServerError
            
Then the top level handler can log ClientError as warnings, and ServerError with
useful traceback.

Version-Release number of selected component (if applicable):
Any

How reproducible:
Always

Steps to Reproduce:
1. Call with invalid argument, or call a method which is not allowed in the
   current state (e.g spm method when spm is not started).

We have the same issue in other parts of the code (infra, virt, sla).

Comment 1 Tal Nisan 2018-07-02 08:27:29 UTC
Closing old bugs, please reopen if still needed, in any case patches are welcome.