return "unknown QEMU command error";
}
-/* Checks whether the agent reply msg is an error caused by an unsupported
- * command.
- *
- * Returns true when reply is CommandNotFound or CommandDisabled
- * false otherwise
- */
-static bool
-qemuAgentErrorCommandUnsupported(virJSONValuePtr reply)
-{
- const char *klass;
- virJSONValuePtr error;
-
- if (!reply)
- return false;
-
- error = virJSONValueObjectGet(reply, "error");
-
- if (!error)
- return false;
-
- klass = virJSONValueObjectGetString(error, "class");
- return STREQ_NULLABLE(klass, "CommandNotFound") ||
- STREQ_NULLABLE(klass, "CommandDisabled");
-}
-
/* Ignoring OOM in this method, since we're already reporting
* a more important error
*
}
/* Returns: number of entries in '@info' 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
qemuAgentGetFSInfo(qemuAgentPtr agent,
- qemuAgentFSInfoPtr **info)
+ qemuAgentFSInfoPtr **info,
+ bool report_unsupported)
{
size_t i;
int ret = -1;
virJSONValuePtr data;
size_t ndata = 0;
qemuAgentFSInfoPtr *info_ret = NULL;
+ int rc;
cmd = qemuAgentMakeCommand("guest-get-fsinfo", NULL);
if (!cmd)
return ret;
- if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0) {
- if (qemuAgentErrorCommandUnsupported(reply))
- ret = -2;
- goto cleanup;
- }
+ if ((rc = qemuAgentCommandFull(agent, cmd, &reply, agent->timeout,
+ report_unsupported)) < 0)
+ return rc;
if (!(data = virJSONValueObjectGet(reply, "return"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
int qemuAgentFSFreeze(qemuAgentPtr mon,
const char **mountpoints, unsigned int nmountpoints);
int qemuAgentFSThaw(qemuAgentPtr mon);
-int qemuAgentGetFSInfo(qemuAgentPtr mon, qemuAgentFSInfoPtr **info);
+int qemuAgentGetFSInfo(qemuAgentPtr mon,
+ qemuAgentFSInfoPtr **info,
+ bool report_unsupported);
int qemuAgentSuspend(qemuAgentPtr mon,
unsigned int target);
goto endjob;
agent = qemuDomainObjEnterAgent(vm);
- ret = qemuAgentGetFSInfo(agent, info);
+ ret = qemuAgentGetFSInfo(agent, info, true);
qemuDomainObjExitAgent(vm, agent);
endjob:
goto exitagent;
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_FILESYSTEM) {
- rc = qemuAgentGetFSInfo(agent, &agentfsinfo);
+ rc = qemuAgentGetFSInfo(agent, &agentfsinfo, true);
if (rc < 0) {
if (!(rc == -2 && types == 0))
goto exitagent;
goto cleanup;
if ((ninfo = qemuAgentGetFSInfo(qemuMonitorTestGetAgent(test),
- &info)) < 0)
+ &info, true)) < 0)
goto cleanup;
if (ninfo != 3) {
"}") < 0)
goto cleanup;
- if (qemuAgentGetFSInfo(qemuMonitorTestGetAgent(test), &info) >= 0) {
+ if (qemuAgentGetFSInfo(qemuMonitorTestGetAgent(test), &info, true) >= 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"agent get-fsinfo command should have failed");
goto cleanup;