HI,
I’m in the process of upgrading from OpenNebula 4.6 to 5.4.6 and I use the XML-RPC interface via Python. I seem to have hit an undocumented change in the XML-RPC response structure for failing calls.
According to XML-RPC API — OpenNebula 5.4.15 documentation, the XML-RPC response structure consists of 3 elements:
Type | Data Type | Description |
---|---|---|
OUT | Boolean | True or false whenever is successful or not. |
OUT | String | If an error occurs this is the error message. |
OUT | Int | Error code. |
I’m seeing that behavior on successful calls, but I get 4 elements on failing calls.
In opennebula-5.4.6/src/rm/Request.cc, I see 3 elements returned on success:
void Request::success_response(int id, RequestAttributes& att)
{
vector<xmlrpc_c::value> arrayData;arrayData.push_back(xmlrpc_c::value_boolean(true)); arrayData.push_back(xmlrpc_c::value_int(id)); arrayData.push_back(xmlrpc_c::value_int(SUCCESS)); xmlrpc_c::value_array arrayresult(arrayData); *(att.retval) = arrayresult;
}
But 4 elements returned on failure:
void Request::failure_response(ErrorCode ec, const string& str_val,
RequestAttributes& att)
{
vector<xmlrpc_c::value> arrayData;arrayData.push_back(xmlrpc_c::value_boolean(false)); arrayData.push_back(xmlrpc_c::value_string(str_val)); arrayData.push_back(xmlrpc_c::value_int(ec)); arrayData.push_back(xmlrpc_c::value_int(att.resp_id)); xmlrpc_c::value_array arrayresult(arrayData); *(att.retval) = arrayresult;
}
Not sure if you consider this a doc or code bug. But it would be easier to script against the API if it wasn’t necessary to test the number of elements returned.
Thanks,
Kevin