提交 b6366531 编写于 作者: M Michal Privoznik 提交者: Cole Robinson

qemu_agent: Produce more readable error messages

Not every error message from qemu-ga has to have the 'class' field
filled out. For instance, I've seen this error message lately:

  qemuAgentCheckError:1047 : unable to execute QEMU agent command \
  {"execute":"guest-set-time"}: \
  {"error":{"desc":"Invalid parameter type, expected: integer"}}

However, this got translated into rather generic error message:

  internal error: unable to execute QEMU agent command
  'guest-set-time': unknown QEMU command error

So we've dropped better error message in favor of a generic one.
This is due to our code which expects 'class' which is not
present here.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
(cherry picked from commit b7fe5a65)
上级 3b4b9aee
......@@ -1009,14 +1009,12 @@ static const char *
qemuAgentStringifyError(virJSONValuePtr error)
{
const char *klass = virJSONValueObjectGetString(error, "class");
const char *detail = NULL;
const char *detail = virJSONValueObjectGetString(error, "desc");
/* The QMP 'desc' field is usually sufficient for our generic
* error reporting needs.
* error reporting needs. However, if not present, translate
* the class into something readable.
*/
if (klass)
detail = virJSONValueObjectGetString(error, "desc");
if (!detail)
detail = qemuAgentStringifyErrorClass(klass);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册