}
/* Returns: 0 on success
- * -2 when agent command is not supported by the agent
- * -1 otherwise
+ * -2 when agent command is not supported by the agent and
+ * 'report_unsupported' is false (libvirt error is not reported)
+ * -1 otherwise (libvirt error is reported)
*/
int
qemuAgentGetOSInfo(qemuAgentPtr agent,
virTypedParameterPtr *params,
int *nparams,
- int *maxparams)
+ int *maxparams,
+ bool report_unsupported)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValuePtr data = NULL;
+ int rc;
if (!(cmd = qemuAgentMakeCommand("guest-get-osinfo", NULL)))
return -1;
- if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0) {
- if (qemuAgentErrorCommandUnsupported(reply))
- return -2;
- return -1;
- }
+ if ((rc = qemuAgentCommandFull(agent, cmd, &reply, agent->timeout,
+ report_unsupported)) < 0)
+ return rc;
if (!(data = virJSONValueObjectGetObject(reply, "return"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
int qemuAgentGetOSInfo(qemuAgentPtr mon,
virTypedParameterPtr *params,
int *nparams,
- int *maxparams);
+ int *maxparams,
+ bool report_unsupported);
int qemuAgentGetTimezone(qemuAgentPtr mon,
virTypedParameterPtr *params,
goto exitagent;
}
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_OS) {
- rc = qemuAgentGetOSInfo(agent, params, nparams, &maxparams);
+ rc = qemuAgentGetOSInfo(agent, params, nparams, &maxparams, true);
if (rc < 0 && !(rc == -2 && types == 0))
goto exitagent;
}
/* get osinfo */
if (qemuAgentGetOSInfo(qemuMonitorTestGetAgent(test),
- ¶ms, &nparams, &maxparams) < 0)
+ ¶ms, &nparams, &maxparams, true) < 0)
goto cleanup;
if (nparams != 8) {
/* get users with domain */
if (qemuAgentGetOSInfo(qemuMonitorTestGetAgent(test),
- ¶ms, &nparams, &maxparams) < 0)
+ ¶ms, &nparams, &maxparams, true) < 0)
goto cleanup;
if (nparams != 10) {