coordination #64322
closedcoordination #103962: [saga][epic] Easy multi-machine handling: MM-tests as first-class citizens
[epic] Improve feedback on multi-machine API errors
0%
Description
Problem¶
Currently the error feedback of the multi-machine API is not great, e.g. when the creation of a mutex fails one only gets "return code 400" but no further information what the problem could be:
[2020-03-04T15:17:02.724 CET] [debug] mutex create 'radvd.mutex'
[2020-03-04T15:17:03.902 CET] [warn] !!! lockapi::mutex_create: Unknown return code 400 for lock api
[2020-03-04T15:17:03.983 CET] [debug] Create mutex failed at /var/lib/openqa/pool/22/os-autoinst-distri-opensuse/lib/wickedbase.pm line 552.
In this case it would be good to know that the mutex name is considered invalid. Other multi-machine APIs likely have bad error feedback, too.
Further information¶
When looking into the error mentioned above I came up with the following suggestion:
The regex for the validation is defined in mutex_create in openQA/lib/OpenQA/WebAPI/Controller/API/V1/Locks.pm.
The _validation_error helper defined in openQA/lib/OpenQA/WebAPI/Plugin/Helpers.pm would actually return a semi-useful error message. However, in api_call in os-autoinst/mmapi.pm or _try_lock in os-autoinst/lockapi.pm the error is not logged (just the return code 400). It would be good if the validation error would be logged so you would get at least "Invalid request parameters (name)" somewhere in the os-autoinst log. The message from the validation helper could be improved as well to make it clear why the name is considered invalid.
Attempt to improve the problem: https://github.com/os-autoinst/os-autoinst/pull/1359