d76c62
From 314e0b35249ff662cb76d9b03f33aeb700c6a43a Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <314e0b35249ff662cb76d9b03f33aeb700c6a43a@dist-git>
d76c62
From: Jonathon Jongsma <jjongsma@redhat.com>
d76c62
Date: Thu, 20 Feb 2020 10:52:26 -0600
d76c62
Subject: [PATCH] qemu: don't access vmdef within qemu_agent.c
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
In order to avoid holding an agent job and a normal job at the same
d76c62
time, we want to avoid accessing the domain's definition while holding
d76c62
the agent job. To achieve this, qemuAgentGetFSInfo() only returns the
d76c62
raw information from the agent query to the caller. The caller can then
d76c62
release the agent job and then proceed to look up the disk alias from
d76c62
the vm definition. This necessitates moving a few helper functions to
d76c62
qemu_driver.c and exposing the agent data structure (qemuAgentFSInfo) in
d76c62
the header.
d76c62
d76c62
In addition, because the agent function no longer returns the looked-up
d76c62
disk alias, we can't test the alias within qemuagenttest.  Instead we
d76c62
simply test that we parse and return the raw agent data correctly.
d76c62
d76c62
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
d76c62
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
d76c62
(cherry picked from commit 599ae372d8cf0923757c5a3792acb07dcf3e8802)
d76c62
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1759566
d76c62
Message-Id: <20200220165227.11491-5-jjongsma@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_agent.c  | 219 +----------------------------------
d76c62
 src/qemu/qemu_agent.h  |  33 ++++--
d76c62
 src/qemu/qemu_driver.c | 255 ++++++++++++++++++++++++++++++++++++++---
d76c62
 tests/qemuagenttest.c  | 196 +++++--------------------------
d76c62
 4 files changed, 299 insertions(+), 404 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
d76c62
index 4739faeed8..ef2d2c500b 100644
d76c62
--- a/src/qemu/qemu_agent.c
d76c62
+++ b/src/qemu/qemu_agent.c
d76c62
@@ -1844,30 +1844,6 @@ qemuAgentSetTime(qemuAgentPtr mon,
d76c62
     return ret;
d76c62
 }
d76c62
 
d76c62
-typedef struct _qemuAgentDiskInfo qemuAgentDiskInfo;
d76c62
-typedef qemuAgentDiskInfo *qemuAgentDiskInfoPtr;
d76c62
-struct _qemuAgentDiskInfo {
d76c62
-    char *serial;
d76c62
-    virPCIDeviceAddress pci_controller;
d76c62
-    char *bus_type;
d76c62
-    unsigned int bus;
d76c62
-    unsigned int target;
d76c62
-    unsigned int unit;
d76c62
-    char *devnode;
d76c62
-};
d76c62
-
d76c62
-typedef struct _qemuAgentFSInfo qemuAgentFSInfo;
d76c62
-typedef qemuAgentFSInfo *qemuAgentFSInfoPtr;
d76c62
-struct _qemuAgentFSInfo {
d76c62
-    char *mountpoint; /* path to mount point */
d76c62
-    char *name;       /* device name in the guest (e.g. "sda1") */
d76c62
-    char *fstype;     /* filesystem type */
d76c62
-    long long total_bytes;
d76c62
-    long long used_bytes;
d76c62
-    size_t ndisks;
d76c62
-    qemuAgentDiskInfoPtr *disks;
d76c62
-};
d76c62
-
d76c62
 static void
d76c62
 qemuAgentDiskInfoFree(qemuAgentDiskInfoPtr info)
d76c62
 {
d76c62
@@ -1880,7 +1856,7 @@ qemuAgentDiskInfoFree(qemuAgentDiskInfoPtr info)
d76c62
     VIR_FREE(info);
d76c62
 }
d76c62
 
d76c62
-static void
d76c62
+void
d76c62
 qemuAgentFSInfoFree(qemuAgentFSInfoPtr info)
d76c62
 {
d76c62
     size_t i;
d76c62
@@ -1899,47 +1875,6 @@ qemuAgentFSInfoFree(qemuAgentFSInfoPtr info)
d76c62
     VIR_FREE(info);
d76c62
 }
d76c62
 
d76c62
-static virDomainFSInfoPtr
d76c62
-qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent,
d76c62
-                        virDomainDefPtr vmdef)
d76c62
-{
d76c62
-    virDomainFSInfoPtr ret = NULL;
d76c62
-    size_t i;
d76c62
-
d76c62
-    if (VIR_ALLOC(ret) < 0)
d76c62
-        goto error;
d76c62
-
d76c62
-    ret->mountpoint = g_strdup(agent->mountpoint);
d76c62
-    ret->name = g_strdup(agent->name);
d76c62
-    ret->fstype = g_strdup(agent->fstype);
d76c62
-
d76c62
-    if (agent->disks &&
d76c62
-        VIR_ALLOC_N(ret->devAlias, agent->ndisks) < 0)
d76c62
-        goto error;
d76c62
-
d76c62
-    ret->ndevAlias = agent->ndisks;
d76c62
-
d76c62
-    for (i = 0; i < ret->ndevAlias; i++) {
d76c62
-        qemuAgentDiskInfoPtr agentdisk = agent->disks[i];
d76c62
-        virDomainDiskDefPtr diskDef;
d76c62
-
d76c62
-        if (!(diskDef = virDomainDiskByAddress(vmdef,
d76c62
-                                               &agentdisk->pci_controller,
d76c62
-                                               agentdisk->bus,
d76c62
-                                               agentdisk->target,
d76c62
-                                               agentdisk->unit)))
d76c62
-            continue;
d76c62
-
d76c62
-        ret->devAlias[i] = g_strdup(diskDef->dst);
d76c62
-    }
d76c62
-
d76c62
-    return ret;
d76c62
-
d76c62
- error:
d76c62
-    virDomainFSInfoFree(ret);
d76c62
-    return NULL;
d76c62
-}
d76c62
-
d76c62
 static int
d76c62
 qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
d76c62
                             qemuAgentFSInfoPtr fsinfo)
d76c62
@@ -2013,7 +1948,6 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
d76c62
         GET_DISK_ADDR(pci, &disk->pci_controller.bus, "bus");
d76c62
         GET_DISK_ADDR(pci, &disk->pci_controller.slot, "slot");
d76c62
         GET_DISK_ADDR(pci, &disk->pci_controller.function, "function");
d76c62
-
d76c62
 #undef GET_DISK_ADDR
d76c62
     }
d76c62
 
d76c62
@@ -2024,9 +1958,9 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
d76c62
  *          -2 when agent command is not supported by the agent
d76c62
  *          -1 otherwise
d76c62
  */
d76c62
-static int
d76c62
-qemuAgentGetFSInfoInternal(qemuAgentPtr mon,
d76c62
-                           qemuAgentFSInfoPtr **info)
d76c62
+int
d76c62
+qemuAgentGetFSInfo(qemuAgentPtr mon,
d76c62
+                   qemuAgentFSInfoPtr **info)
d76c62
 {
d76c62
     size_t i;
d76c62
     int ret = -1;
d76c62
@@ -2158,151 +2092,6 @@ qemuAgentGetFSInfoInternal(qemuAgentPtr mon,
d76c62
     return ret;
d76c62
 }
d76c62
 
d76c62
-/* Returns: 0 on success
d76c62
- *          -1 otherwise
d76c62
- */
d76c62
-int
d76c62
-qemuAgentGetFSInfo(qemuAgentPtr mon,
d76c62
-                   virDomainFSInfoPtr **info,
d76c62
-                   virDomainDefPtr vmdef)
d76c62
-{
d76c62
-    int ret = -1;
d76c62
-    qemuAgentFSInfoPtr *agentinfo = NULL;
d76c62
-    virDomainFSInfoPtr *info_ret = NULL;
d76c62
-    size_t i;
d76c62
-    int nfs;
d76c62
-
d76c62
-    nfs = qemuAgentGetFSInfoInternal(mon, &agentinfo);
d76c62
-    if (nfs < 0)
d76c62
-        return ret;
d76c62
-    if (VIR_ALLOC_N(info_ret, nfs) < 0)
d76c62
-        goto cleanup;
d76c62
-
d76c62
-    for (i = 0; i < nfs; i++) {
d76c62
-        if (!(info_ret[i] = qemuAgentFSInfoToPublic(agentinfo[i], vmdef)))
d76c62
-            goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    *info = g_steal_pointer(&info_ret);
d76c62
-    ret = nfs;
d76c62
-
d76c62
- cleanup:
d76c62
-    for (i = 0; i < nfs; i++) {
d76c62
-        qemuAgentFSInfoFree(agentinfo[i]);
d76c62
-        /* if there was an error, free any memory we've allocated for the
d76c62
-         * return value */
d76c62
-        if (info_ret)
d76c62
-            virDomainFSInfoFree(info_ret[i]);
d76c62
-    }
d76c62
-    VIR_FREE(agentinfo);
d76c62
-    VIR_FREE(info_ret);
d76c62
-    return ret;
d76c62
-}
d76c62
-
d76c62
-/* Returns: 0 on success
d76c62
- *          -2 when agent command is not supported by the agent
d76c62
- *          -1 otherwise
d76c62
- */
d76c62
-int
d76c62
-qemuAgentGetFSInfoParams(qemuAgentPtr mon,
d76c62
-                         virTypedParameterPtr *params,
d76c62
-                         int *nparams, int *maxparams,
d76c62
-                         virDomainDefPtr vmdef)
d76c62
-{
d76c62
-    int ret = -1;
d76c62
-    qemuAgentFSInfoPtr *fsinfo = NULL;
d76c62
-    size_t i, j;
d76c62
-    int nfs;
d76c62
-
d76c62
-    if ((nfs = qemuAgentGetFSInfoInternal(mon, &fsinfo)) < 0)
d76c62
-        return nfs;
d76c62
-
d76c62
-    if (virTypedParamsAddUInt(params, nparams, maxparams,
d76c62
-                              "fs.count", nfs) < 0)
d76c62
-        goto cleanup;
d76c62
-
d76c62
-    for (i = 0; i < nfs; i++) {
d76c62
-        char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
d76c62
-        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                   "fs.%zu.name", i);
d76c62
-        if (virTypedParamsAddString(params, nparams, maxparams,
d76c62
-                                    param_name, fsinfo[i]->name) < 0)
d76c62
-            goto cleanup;
d76c62
-        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                   "fs.%zu.mountpoint", i);
d76c62
-        if (virTypedParamsAddString(params, nparams, maxparams,
d76c62
-                                    param_name, fsinfo[i]->mountpoint) < 0)
d76c62
-            goto cleanup;
d76c62
-        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                   "fs.%zu.fstype", i);
d76c62
-        if (virTypedParamsAddString(params, nparams, maxparams,
d76c62
-                                    param_name, fsinfo[i]->fstype) < 0)
d76c62
-            goto cleanup;
d76c62
-
d76c62
-        /* disk usage values are not returned by older guest agents, so
d76c62
-         * only add the params if the value is set */
d76c62
-        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                   "fs.%zu.total-bytes", i);
d76c62
-        if (fsinfo[i]->total_bytes != -1 &&
d76c62
-            virTypedParamsAddULLong(params, nparams, maxparams,
d76c62
-                                    param_name, fsinfo[i]->total_bytes) < 0)
d76c62
-            goto cleanup;
d76c62
-
d76c62
-        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                   "fs.%zu.used-bytes", i);
d76c62
-        if (fsinfo[i]->used_bytes != -1 &&
d76c62
-            virTypedParamsAddULLong(params, nparams, maxparams,
d76c62
-                                    param_name, fsinfo[i]->used_bytes) < 0)
d76c62
-            goto cleanup;
d76c62
-
d76c62
-        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                   "fs.%zu.disk.count", i);
d76c62
-        if (virTypedParamsAddUInt(params, nparams, maxparams,
d76c62
-                                  param_name, fsinfo[i]->ndisks) < 0)
d76c62
-            goto cleanup;
d76c62
-        for (j = 0; j < fsinfo[i]->ndisks; j++) {
d76c62
-            virDomainDiskDefPtr diskdef = NULL;
d76c62
-            qemuAgentDiskInfoPtr d = fsinfo[i]->disks[j];
d76c62
-            /* match the disk to the target in the vm definition */
d76c62
-            diskdef = virDomainDiskByAddress(vmdef,
d76c62
-                                             &d->pci_controller,
d76c62
-                                             d->bus,
d76c62
-                                             d->target,
d76c62
-                                             d->unit);
d76c62
-            if (diskdef) {
d76c62
-                g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                           "fs.%zu.disk.%zu.alias", i, j);
d76c62
-                if (diskdef->dst &&
d76c62
-                    virTypedParamsAddString(params, nparams, maxparams,
d76c62
-                                            param_name, diskdef->dst) < 0)
d76c62
-                    goto cleanup;
d76c62
-            }
d76c62
-
d76c62
-            g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                       "fs.%zu.disk.%zu.serial", i, j);
d76c62
-            if (d->serial &&
d76c62
-                virTypedParamsAddString(params, nparams, maxparams,
d76c62
-                                        param_name, d->serial) < 0)
d76c62
-                goto cleanup;
d76c62
-
d76c62
-            g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
-                       "fs.%zu.disk.%zu.device", i, j);
d76c62
-            if (d->devnode &&
d76c62
-                virTypedParamsAddString(params, nparams, maxparams,
d76c62
-                                        param_name, d->devnode) < 0)
d76c62
-                goto cleanup;
d76c62
-        }
d76c62
-    }
d76c62
-    ret = nfs;
d76c62
-
d76c62
- cleanup:
d76c62
-    for (i = 0; i < nfs; i++)
d76c62
-        qemuAgentFSInfoFree(fsinfo[i]);
d76c62
-    VIR_FREE(fsinfo);
d76c62
-
d76c62
-    return ret;
d76c62
-}
d76c62
-
d76c62
 /*
d76c62
  * qemuAgentGetInterfaces:
d76c62
  * @mon: Agent monitor
d76c62
diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h
d76c62
index 85e436cf68..5656fe60ff 100644
d76c62
--- a/src/qemu/qemu_agent.h
d76c62
+++ b/src/qemu/qemu_agent.h
d76c62
@@ -65,19 +65,38 @@ typedef enum {
d76c62
     QEMU_AGENT_SHUTDOWN_LAST,
d76c62
 } qemuAgentShutdownMode;
d76c62
 
d76c62
+typedef struct _qemuAgentDiskInfo qemuAgentDiskInfo;
d76c62
+typedef qemuAgentDiskInfo *qemuAgentDiskInfoPtr;
d76c62
+struct _qemuAgentDiskInfo {
d76c62
+    char *serial;
d76c62
+    virPCIDeviceAddress pci_controller;
d76c62
+    char *bus_type;
d76c62
+    unsigned int bus;
d76c62
+    unsigned int target;
d76c62
+    unsigned int unit;
d76c62
+    char *devnode;
d76c62
+};
d76c62
+
d76c62
+typedef struct _qemuAgentFSInfo qemuAgentFSInfo;
d76c62
+typedef qemuAgentFSInfo *qemuAgentFSInfoPtr;
d76c62
+struct _qemuAgentFSInfo {
d76c62
+    char *mountpoint; /* path to mount point */
d76c62
+    char *name;       /* device name in the guest (e.g. "sda1") */
d76c62
+    char *fstype;     /* filesystem type */
d76c62
+    long long total_bytes;
d76c62
+    long long used_bytes;
d76c62
+    size_t ndisks;
d76c62
+    qemuAgentDiskInfoPtr *disks;
d76c62
+};
d76c62
+void qemuAgentFSInfoFree(qemuAgentFSInfoPtr info);
d76c62
+
d76c62
 int qemuAgentShutdown(qemuAgentPtr mon,
d76c62
                       qemuAgentShutdownMode mode);
d76c62
 
d76c62
 int qemuAgentFSFreeze(qemuAgentPtr mon,
d76c62
                       const char **mountpoints, unsigned int nmountpoints);
d76c62
 int qemuAgentFSThaw(qemuAgentPtr mon);
d76c62
-int qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info,
d76c62
-                       virDomainDefPtr vmdef);
d76c62
-
d76c62
-int qemuAgentGetFSInfoParams(qemuAgentPtr mon,
d76c62
-                             virTypedParameterPtr *params,
d76c62
-                             int *nparams, int *maxparams,
d76c62
-                             virDomainDefPtr vmdef);
d76c62
+int qemuAgentGetFSInfo(qemuAgentPtr mon, qemuAgentFSInfoPtr **info);
d76c62
 
d76c62
 int qemuAgentSuspend(qemuAgentPtr mon,
d76c62
                      unsigned int target);
d76c62
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
d76c62
index 69e4f7264b..ac3a7ad282 100644
d76c62
--- a/src/qemu/qemu_driver.c
d76c62
+++ b/src/qemu/qemu_driver.c
d76c62
@@ -21839,6 +21839,111 @@ qemuNodeAllocPages(virConnectPtr conn,
d76c62
                                 startCell, cellCount, add);
d76c62
 }
d76c62
 
d76c62
+static int
d76c62
+qemuDomainGetFSInfoAgent(virQEMUDriverPtr driver,
d76c62
+                         virDomainObjPtr vm,
d76c62
+                         qemuAgentFSInfoPtr **info)
d76c62
+{
d76c62
+    int ret = -1;
d76c62
+    qemuAgentPtr agent;
d76c62
+
d76c62
+    if (qemuDomainObjBeginAgentJob(driver, vm,
d76c62
+                                   QEMU_AGENT_JOB_QUERY) < 0)
d76c62
+        return ret;
d76c62
+
d76c62
+    if (virDomainObjCheckActive(vm) < 0)
d76c62
+        goto endjob;
d76c62
+
d76c62
+    if (!qemuDomainAgentAvailable(vm, true))
d76c62
+        goto endjob;
d76c62
+
d76c62
+    agent = qemuDomainObjEnterAgent(vm);
d76c62
+    ret = qemuAgentGetFSInfo(agent, info);
d76c62
+    qemuDomainObjExitAgent(vm, agent);
d76c62
+
d76c62
+ endjob:
d76c62
+    qemuDomainObjEndAgentJob(vm);
d76c62
+    return ret;
d76c62
+}
d76c62
+
d76c62
+static virDomainFSInfoPtr
d76c62
+qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent,
d76c62
+                        virDomainDefPtr vmdef)
d76c62
+{
d76c62
+    virDomainFSInfoPtr ret = NULL;
d76c62
+    size_t i;
d76c62
+
d76c62
+    if (VIR_ALLOC(ret) < 0)
d76c62
+        goto error;
d76c62
+
d76c62
+    ret->mountpoint = g_strdup(agent->mountpoint);
d76c62
+    ret->name = g_strdup(agent->name);
d76c62
+    ret->fstype = g_strdup(agent->fstype);
d76c62
+
d76c62
+    if (agent->disks &&
d76c62
+        VIR_ALLOC_N(ret->devAlias, agent->ndisks) < 0)
d76c62
+        goto error;
d76c62
+
d76c62
+    ret->ndevAlias = agent->ndisks;
d76c62
+
d76c62
+    for (i = 0; i < ret->ndevAlias; i++) {
d76c62
+        qemuAgentDiskInfoPtr agentdisk = agent->disks[i];
d76c62
+        virDomainDiskDefPtr diskDef;
d76c62
+
d76c62
+        if (!(diskDef = virDomainDiskByAddress(vmdef,
d76c62
+                                               &agentdisk->pci_controller,
d76c62
+                                               agentdisk->bus,
d76c62
+                                               agentdisk->target,
d76c62
+                                               agentdisk->unit)))
d76c62
+            continue;
d76c62
+
d76c62
+        ret->devAlias[i] = g_strdup(diskDef->dst);
d76c62
+    }
d76c62
+
d76c62
+    return ret;
d76c62
+
d76c62
+ error:
d76c62
+    virDomainFSInfoFree(ret);
d76c62
+    return NULL;
d76c62
+}
d76c62
+
d76c62
+/* Returns: 0 on success
d76c62
+ *          -1 otherwise
d76c62
+ */
d76c62
+static int
d76c62
+virDomainFSInfoFormat(qemuAgentFSInfoPtr *agentinfo,
d76c62
+                      int nagentinfo,
d76c62
+                      virDomainDefPtr vmdef,
d76c62
+                      virDomainFSInfoPtr **info)
d76c62
+{
d76c62
+    int ret = -1;
d76c62
+    virDomainFSInfoPtr *info_ret = NULL;
d76c62
+    size_t i;
d76c62
+
d76c62
+    if (nagentinfo < 0)
d76c62
+        return ret;
d76c62
+    if (VIR_ALLOC_N(info_ret, nagentinfo) < 0)
d76c62
+        goto cleanup;
d76c62
+
d76c62
+    for (i = 0; i < nagentinfo; i++) {
d76c62
+        if (!(info_ret[i] = qemuAgentFSInfoToPublic(agentinfo[i], vmdef)))
d76c62
+            goto cleanup;
d76c62
+    }
d76c62
+
d76c62
+    *info = g_steal_pointer(&info_ret);
d76c62
+    ret = nagentinfo;
d76c62
+
d76c62
+ cleanup:
d76c62
+    for (i = 0; i < nagentinfo; i++) {
d76c62
+        qemuAgentFSInfoFree(agentinfo[i]);
d76c62
+        /* if there was an error, free any memory we've allocated for the
d76c62
+         * return value */
d76c62
+        if (info_ret)
d76c62
+            virDomainFSInfoFree(info_ret[i]);
d76c62
+    }
d76c62
+    VIR_FREE(info_ret);
d76c62
+    return ret;
d76c62
+}
d76c62
 
d76c62
 static int
d76c62
 qemuDomainGetFSInfo(virDomainPtr dom,
d76c62
@@ -21847,8 +21952,9 @@ qemuDomainGetFSInfo(virDomainPtr dom,
d76c62
 {
d76c62
     virQEMUDriverPtr driver = dom->conn->privateData;
d76c62
     virDomainObjPtr vm;
d76c62
-    qemuAgentPtr agent;
d76c62
+    qemuAgentFSInfoPtr *agentinfo = NULL;
d76c62
     int ret = -1;
d76c62
+    int nfs;
d76c62
 
d76c62
     virCheckFlags(0, ret);
d76c62
 
d76c62
@@ -21858,25 +21964,22 @@ qemuDomainGetFSInfo(virDomainPtr dom,
d76c62
     if (virDomainGetFSInfoEnsureACL(dom->conn, vm->def) < 0)
d76c62
         goto cleanup;
d76c62
 
d76c62
-    if (qemuDomainObjBeginJobWithAgent(driver, vm,
d76c62
-                                       QEMU_JOB_QUERY,
d76c62
-                                       QEMU_AGENT_JOB_QUERY) < 0)
d76c62
+    if ((nfs = qemuDomainGetFSInfoAgent(driver, vm, &agentinfo)) < 0)
d76c62
+        goto cleanup;
d76c62
+
d76c62
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
d76c62
         goto cleanup;
d76c62
 
d76c62
     if (virDomainObjCheckActive(vm) < 0)
d76c62
         goto endjob;
d76c62
 
d76c62
-    if (!qemuDomainAgentAvailable(vm, true))
d76c62
-        goto endjob;
d76c62
-
d76c62
-    agent = qemuDomainObjEnterAgent(vm);
d76c62
-    ret = qemuAgentGetFSInfo(agent, info, vm->def);
d76c62
-    qemuDomainObjExitAgent(vm, agent);
d76c62
+    ret = virDomainFSInfoFormat(agentinfo, nfs, vm->def, info);
d76c62
 
d76c62
  endjob:
d76c62
-    qemuDomainObjEndJobWithAgent(driver, vm);
d76c62
+    qemuDomainObjEndJob(driver, vm);
d76c62
 
d76c62
  cleanup:
d76c62
+    g_free(agentinfo);
d76c62
     virDomainObjEndAPI(&vm;;
d76c62
     return ret;
d76c62
 }
d76c62
@@ -22882,6 +22985,103 @@ qemuDomainGetGuestInfoCheckSupport(unsigned int *types)
d76c62
     *types = *types & supportedGuestInfoTypes;
d76c62
 }
d76c62
 
d76c62
+/* Returns: 0 on success
d76c62
+ *          -1 otherwise
d76c62
+ */
d76c62
+static int
d76c62
+qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
d76c62
+                            int nfs,
d76c62
+                            virDomainDefPtr vmdef,
d76c62
+                            virTypedParameterPtr *params,
d76c62
+                            int *nparams, int *maxparams)
d76c62
+{
d76c62
+    int ret = -1;
d76c62
+    size_t i, j;
d76c62
+
d76c62
+    /* FIXME: get disk target */
d76c62
+
d76c62
+    if (virTypedParamsAddUInt(params, nparams, maxparams,
d76c62
+                              "fs.count", nfs) < 0)
d76c62
+        goto cleanup;
d76c62
+
d76c62
+    for (i = 0; i < nfs; i++) {
d76c62
+        char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
d76c62
+        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                   "fs.%zu.name", i);
d76c62
+        if (virTypedParamsAddString(params, nparams, maxparams,
d76c62
+                                    param_name, fsinfo[i]->name) < 0)
d76c62
+            goto cleanup;
d76c62
+        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                   "fs.%zu.mountpoint", i);
d76c62
+        if (virTypedParamsAddString(params, nparams, maxparams,
d76c62
+                                    param_name, fsinfo[i]->mountpoint) < 0)
d76c62
+            goto cleanup;
d76c62
+        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                   "fs.%zu.fstype", i);
d76c62
+        if (virTypedParamsAddString(params, nparams, maxparams,
d76c62
+                                    param_name, fsinfo[i]->fstype) < 0)
d76c62
+            goto cleanup;
d76c62
+
d76c62
+        /* disk usage values are not returned by older guest agents, so
d76c62
+         * only add the params if the value is set */
d76c62
+        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                   "fs.%zu.total-bytes", i);
d76c62
+        if (fsinfo[i]->total_bytes != -1 &&
d76c62
+            virTypedParamsAddULLong(params, nparams, maxparams,
d76c62
+                                    param_name, fsinfo[i]->total_bytes) < 0)
d76c62
+            goto cleanup;
d76c62
+
d76c62
+        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                   "fs.%zu.used-bytes", i);
d76c62
+        if (fsinfo[i]->used_bytes != -1 &&
d76c62
+            virTypedParamsAddULLong(params, nparams, maxparams,
d76c62
+                                    param_name, fsinfo[i]->used_bytes) < 0)
d76c62
+            goto cleanup;
d76c62
+
d76c62
+        g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                   "fs.%zu.disk.count", i);
d76c62
+        if (virTypedParamsAddUInt(params, nparams, maxparams,
d76c62
+                                  param_name, fsinfo[i]->ndisks) < 0)
d76c62
+            goto cleanup;
d76c62
+        for (j = 0; j < fsinfo[i]->ndisks; j++) {
d76c62
+            virDomainDiskDefPtr diskdef = NULL;
d76c62
+            qemuAgentDiskInfoPtr d = fsinfo[i]->disks[j];
d76c62
+            /* match the disk to the target in the vm definition */
d76c62
+            diskdef = virDomainDiskByAddress(vmdef,
d76c62
+                                             &d->pci_controller,
d76c62
+                                             d->bus,
d76c62
+                                             d->target,
d76c62
+                                             d->unit);
d76c62
+            if (diskdef) {
d76c62
+                g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                           "fs.%zu.disk.%zu.alias", i, j);
d76c62
+                if (diskdef->dst &&
d76c62
+                    virTypedParamsAddString(params, nparams, maxparams,
d76c62
+                                            param_name, diskdef->dst) < 0)
d76c62
+                    goto cleanup;
d76c62
+            }
d76c62
+
d76c62
+            g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                       "fs.%zu.disk.%zu.serial", i, j);
d76c62
+            if (d->serial &&
d76c62
+                virTypedParamsAddString(params, nparams, maxparams,
d76c62
+                                        param_name, d->serial) < 0)
d76c62
+                goto cleanup;
d76c62
+
d76c62
+            g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
d76c62
+                       "fs.%zu.disk.%zu.device", i, j);
d76c62
+            if (d->devnode &&
d76c62
+                virTypedParamsAddString(params, nparams, maxparams,
d76c62
+                                        param_name, d->devnode) < 0)
d76c62
+                goto cleanup;
d76c62
+        }
d76c62
+    }
d76c62
+    ret = nfs;
d76c62
+
d76c62
+ cleanup:
d76c62
+    return ret;
d76c62
+}
d76c62
+
d76c62
 static int
d76c62
 qemuDomainGetGuestInfo(virDomainPtr dom,
d76c62
                        unsigned int types,
d76c62
@@ -22897,6 +23097,9 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
d76c62
     g_autofree char *hostname = NULL;
d76c62
     unsigned int supportedTypes = types;
d76c62
     int rc;
d76c62
+    int nfs = 0;
d76c62
+    qemuAgentFSInfoPtr *agentfsinfo = NULL;
d76c62
+    size_t i;
d76c62
 
d76c62
     virCheckFlags(0, -1);
d76c62
     qemuDomainGetGuestInfoCheckSupport(&supportedTypes);
d76c62
@@ -22907,13 +23110,12 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
d76c62
     if (virDomainGetGuestInfoEnsureACL(dom->conn, vm->def) < 0)
d76c62
         goto cleanup;
d76c62
 
d76c62
-    if (qemuDomainObjBeginJobWithAgent(driver, vm,
d76c62
-                                       QEMU_JOB_QUERY,
d76c62
-                                       QEMU_AGENT_JOB_QUERY) < 0)
d76c62
+    if (qemuDomainObjBeginAgentJob(driver, vm,
d76c62
+                                   QEMU_AGENT_JOB_QUERY) < 0)
d76c62
         goto cleanup;
d76c62
 
d76c62
     if (!qemuDomainAgentAvailable(vm, true))
d76c62
-        goto endjob;
d76c62
+        goto endagentjob;
d76c62
 
d76c62
     agent = qemuDomainObjEnterAgent(vm);
d76c62
 
d76c62
@@ -22948,7 +23150,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
d76c62
         }
d76c62
     }
d76c62
     if (supportedTypes & VIR_DOMAIN_GUEST_INFO_FILESYSTEM) {
d76c62
-        rc = qemuAgentGetFSInfoParams(agent, params, nparams, &maxparams, vm->def);
d76c62
+        rc = nfs = qemuAgentGetFSInfo(agent, &agentfsinfo);
d76c62
         if (rc < 0 && !(rc == -2 && types == 0))
d76c62
             goto exitagent;
d76c62
     }
d76c62
@@ -22958,10 +23160,29 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
d76c62
  exitagent:
d76c62
     qemuDomainObjExitAgent(vm, agent);
d76c62
 
d76c62
+ endagentjob:
d76c62
+    qemuDomainObjEndAgentJob(vm);
d76c62
+
d76c62
+    if (nfs > 0) {
d76c62
+        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
d76c62
+            goto cleanup;
d76c62
+
d76c62
+        if (virDomainObjCheckActive(vm) < 0)
d76c62
+            goto endjob;
d76c62
+
d76c62
+        /* we need to convert the agent fsinfo struct to parameters and match
d76c62
+         * it to the vm disk target */
d76c62
+        qemuAgentFSInfoFormatParams(agentfsinfo, nfs, vm->def, params, nparams, &maxparams);
d76c62
+
d76c62
  endjob:
d76c62
-    qemuDomainObjEndJobWithAgent(driver, vm);
d76c62
+        qemuDomainObjEndJob(driver, vm);
d76c62
+    }
d76c62
 
d76c62
  cleanup:
d76c62
+    for (i = 0; i < nfs; i++)
d76c62
+        qemuAgentFSInfoFree(agentfsinfo[i]);
d76c62
+    VIR_FREE(agentfsinfo);
d76c62
+
d76c62
     virDomainObjEndAPI(&vm;;
d76c62
     return ret;
d76c62
 }
d76c62
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
d76c62
index 644dc9d08b..a45ce4f44a 100644
d76c62
--- a/tests/qemuagenttest.c
d76c62
+++ b/tests/qemuagenttest.c
d76c62
@@ -247,14 +247,14 @@ testQemuAgentGetFSInfo(const void *data)
d76c62
     virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
d76c62
     qemuMonitorTestPtr test = NULL;
d76c62
     virDomainDefPtr def = NULL;
d76c62
-    virDomainFSInfoPtr *info = NULL;
d76c62
+    qemuAgentFSInfoPtr *info = NULL;
d76c62
     int ret = -1, ninfo = 0, i;
d76c62
 
d76c62
     if (testQemuAgentGetFSInfoCommon(xmlopt, &test, &def) < 0)
d76c62
         goto cleanup;
d76c62
 
d76c62
     if ((ninfo = qemuAgentGetFSInfo(qemuMonitorTestGetAgent(test),
d76c62
-                                    &info, def)) < 0)
d76c62
+                                    &info)) < 0)
d76c62
         goto cleanup;
d76c62
 
d76c62
     if (ninfo != 3) {
d76c62
@@ -266,35 +266,48 @@ testQemuAgentGetFSInfo(const void *data)
d76c62
     if (STRNEQ(info[2]->name, "sda1") ||
d76c62
         STRNEQ(info[2]->mountpoint, "/") ||
d76c62
         STRNEQ(info[2]->fstype, "ext4") ||
d76c62
-        info[2]->ndevAlias != 1 ||
d76c62
-        !info[2]->devAlias || !info[2]->devAlias[0] ||
d76c62
-        STRNEQ(info[2]->devAlias[0], "hdc")) {
d76c62
+        info[2]->ndisks != 1 ||
d76c62
+        !info[2]->disks || !info[2]->disks[0]) {
d76c62
         virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "unexpected filesystems information returned for sda1 (%s,%s)",
d76c62
-            info[2]->name, info[2]->devAlias ? info[2]->devAlias[0] : "null");
d76c62
+            "unexpected filesystems information returned for sda1 (%s)",
d76c62
+            info[2]->name);
d76c62
         ret = -1;
d76c62
         goto cleanup;
d76c62
     }
d76c62
     if (STRNEQ(info[1]->name, "dm-1") ||
d76c62
         STRNEQ(info[1]->mountpoint, "/opt") ||
d76c62
         STRNEQ(info[1]->fstype, "vfat") ||
d76c62
-        info[1]->ndevAlias != 2 ||
d76c62
-        !info[1]->devAlias || !info[1]->devAlias[0] || !info[1]->devAlias[1] ||
d76c62
-        STRNEQ(info[1]->devAlias[0], "vda") ||
d76c62
-        STRNEQ(info[1]->devAlias[1], "vdb")) {
d76c62
+        info[1]->ndisks != 2 ||
d76c62
+        !info[1]->disks || !info[1]->disks[0] || !info[1]->disks[1] ||
d76c62
+        STRNEQ(info[1]->disks[0]->bus_type, "virtio") ||
d76c62
+        info[1]->disks[0]->bus != 0 ||
d76c62
+        info[1]->disks[0]->target != 0 ||
d76c62
+        info[1]->disks[0]->unit != 0 ||
d76c62
+        info[1]->disks[0]->pci_controller.domain != 0 ||
d76c62
+        info[1]->disks[0]->pci_controller.bus != 0 ||
d76c62
+        info[1]->disks[0]->pci_controller.slot != 6 ||
d76c62
+        info[1]->disks[0]->pci_controller.function != 0 ||
d76c62
+        STRNEQ(info[1]->disks[1]->bus_type, "virtio") ||
d76c62
+        info[1]->disks[1]->bus != 0 ||
d76c62
+        info[1]->disks[1]->target != 0 ||
d76c62
+        info[1]->disks[1]->unit != 0 ||
d76c62
+        info[1]->disks[1]->pci_controller.domain != 0 ||
d76c62
+        info[1]->disks[1]->pci_controller.bus != 0 ||
d76c62
+        info[1]->disks[1]->pci_controller.slot != 7 ||
d76c62
+        info[1]->disks[1]->pci_controller.function != 0) {
d76c62
         virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "unexpected filesystems information returned for dm-1 (%s,%s)",
d76c62
-            info[0]->name, info[0]->devAlias ? info[0]->devAlias[0] : "null");
d76c62
+            "unexpected filesystems information returned for dm-1 (%s)",
d76c62
+            info[0]->name);
d76c62
         ret = -1;
d76c62
         goto cleanup;
d76c62
     }
d76c62
     if (STRNEQ(info[0]->name, "sdb1") ||
d76c62
         STRNEQ(info[0]->mountpoint, "/mnt/disk") ||
d76c62
         STRNEQ(info[0]->fstype, "xfs") ||
d76c62
-        info[0]->ndevAlias != 0 || info[0]->devAlias) {
d76c62
+        info[0]->ndisks != 0 || info[0]->disks) {
d76c62
         virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "unexpected filesystems information returned for sdb1 (%s,%s)",
d76c62
-            info[0]->name, info[0]->devAlias ? info[0]->devAlias[0] : "null");
d76c62
+            "unexpected filesystems information returned for sdb1 (%s)",
d76c62
+            info[0]->name);
d76c62
         ret = -1;
d76c62
         goto cleanup;
d76c62
     }
d76c62
@@ -313,7 +326,7 @@ testQemuAgentGetFSInfo(const void *data)
d76c62
                                "}") < 0)
d76c62
         goto cleanup;
d76c62
 
d76c62
-    if (qemuAgentGetFSInfo(qemuMonitorTestGetAgent(test), &info, def) != -1) {
d76c62
+    if (qemuAgentGetFSInfo(qemuMonitorTestGetAgent(test), &info) >= 0) {
d76c62
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
d76c62
                        "agent get-fsinfo command should have failed");
d76c62
         goto cleanup;
d76c62
@@ -323,159 +336,13 @@ testQemuAgentGetFSInfo(const void *data)
d76c62
 
d76c62
  cleanup:
d76c62
     for (i = 0; i < ninfo; i++)
d76c62
-        virDomainFSInfoFree(info[i]);
d76c62
+        qemuAgentFSInfoFree(info[i]);
d76c62
     VIR_FREE(info);
d76c62
     virDomainDefFree(def);
d76c62
     qemuMonitorTestFree(test);
d76c62
     return ret;
d76c62
 }
d76c62
 
d76c62
-static int
d76c62
-testQemuAgentGetFSInfoParams(const void *data)
d76c62
-{
d76c62
-    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
d76c62
-    qemuMonitorTestPtr test = NULL;
d76c62
-    virDomainDefPtr def = NULL;
d76c62
-    virTypedParameterPtr params = NULL;
d76c62
-    int nparams = 0, maxparams = 0;
d76c62
-    int ret = -1;
d76c62
-    unsigned int count;
d76c62
-    const char *name, *mountpoint, *fstype, *alias, *serial;
d76c62
-    unsigned int diskcount;
d76c62
-    unsigned long long bytesused, bytestotal;
d76c62
-    const char *alias2;
d76c62
-
d76c62
-    if (testQemuAgentGetFSInfoCommon(xmlopt, &test, &def) < 0)
d76c62
-        goto cleanup;
d76c62
-
d76c62
-    if (qemuAgentGetFSInfoParams(qemuMonitorTestGetAgent(test),
d76c62
-                                 &params, &nparams, &maxparams, def) < 0) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
d76c62
-                       "Failed to execute qemuAgentGetFSInfoParams()");
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    if (virTypedParamsGetUInt(params, nparams, "fs.count", &count) < 0) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
d76c62
-                       "expected filesystem count");
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    if (count != 3) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-                       "expected 3 filesystems information, got %d", count);
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    if (virTypedParamsGetString(params, nparams, "fs.2.name", &name) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.2.mountpoint", &mountpoint) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.2.fstype", &fstype) < 0 ||
d76c62
-        virTypedParamsGetULLong(params, nparams, "fs.2.used-bytes", &bytesused) <= 0 ||
d76c62
-        virTypedParamsGetULLong(params, nparams, "fs.2.total-bytes", &bytestotal) <= 0 ||
d76c62
-        virTypedParamsGetUInt(params, nparams, "fs.2.disk.count", &diskcount) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.2.disk.0.alias", &alias) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.2.disk.0.serial", &serial) < 0) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "Missing an expected parameter for sda1 (%s,%s)",
d76c62
-            name, alias);
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    if (STRNEQ(name, "sda1") ||
d76c62
-        STRNEQ(mountpoint, "/") ||
d76c62
-        STRNEQ(fstype, "ext4") ||
d76c62
-        bytesused != 229019648 ||
d76c62
-        bytestotal != 952840192 ||
d76c62
-        diskcount != 1 ||
d76c62
-        STRNEQ(alias, "hdc") ||
d76c62
-        STRNEQ(serial, "ARBITRARYSTRING")) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "unexpected filesystems information returned for sda1 (%s,%s)",
d76c62
-            name, alias);
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    if (virTypedParamsGetString(params, nparams, "fs.1.name", &name) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.1.mountpoint", &mountpoint) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.1.fstype", &fstype) < 0 ||
d76c62
-        virTypedParamsGetULLong(params, nparams, "fs.1.used-bytes", &bytesused) == 1 ||
d76c62
-        virTypedParamsGetULLong(params, nparams, "fs.1.total-bytes", &bytestotal) == 1 ||
d76c62
-        virTypedParamsGetUInt(params, nparams, "fs.1.disk.count", &diskcount) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.1.disk.0.alias", &alias) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.1.disk.1.alias", &alias2) < 0) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "Incorrect parameters for dm-1 (%s,%s)",
d76c62
-            name, alias);
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-    if (STRNEQ(name, "dm-1") ||
d76c62
-        STRNEQ(mountpoint, "/opt") ||
d76c62
-        STRNEQ(fstype, "vfat") ||
d76c62
-        diskcount != 2 ||
d76c62
-        STRNEQ(alias, "vda") ||
d76c62
-        STRNEQ(alias2, "vdb")) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "unexpected filesystems information returned for dm-1 (%s,%s)",
d76c62
-            name, alias);
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    alias = NULL;
d76c62
-    if (virTypedParamsGetString(params, nparams, "fs.0.name", &name) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.0.mountpoint", &mountpoint) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.0.fstype", &fstype) < 0 ||
d76c62
-        virTypedParamsGetULLong(params, nparams, "fs.0.used-bytes", &bytesused) == 1 ||
d76c62
-        virTypedParamsGetULLong(params, nparams, "fs.0.total-bytes", &bytestotal) == 1 ||
d76c62
-        virTypedParamsGetUInt(params, nparams, "fs.0.disk.count", &diskcount) < 0 ||
d76c62
-        virTypedParamsGetString(params, nparams, "fs.0.disk.0.alias", &alias) == 1) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "Incorrect parameters for sdb1 (%s,%s)",
d76c62
-            name, alias);
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    if (STRNEQ(name, "sdb1") ||
d76c62
-        STRNEQ(mountpoint, "/mnt/disk") ||
d76c62
-        STRNEQ(fstype, "xfs") ||
d76c62
-        diskcount != 0 ||
d76c62
-        alias != NULL) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
-            "unexpected filesystems information returned for sdb1 (%s,%s)",
d76c62
-            name, alias);
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
d76c62
-        goto cleanup;
d76c62
-
d76c62
-    if (qemuMonitorTestAddItem(test, "guest-get-fsinfo",
d76c62
-                               "{\"error\":"
d76c62
-                               "    {\"class\":\"CommandDisabled\","
d76c62
-                               "     \"desc\":\"The command guest-get-fsinfo "
d76c62
-                                               "has been disabled for "
d76c62
-                                               "this instance\","
d76c62
-                               "     \"data\":{\"name\":\"guest-get-fsinfo\"}"
d76c62
-                               "    }"
d76c62
-                               "}") < 0)
d76c62
-        goto cleanup;
d76c62
-
d76c62
-    if (qemuAgentGetFSInfoParams(qemuMonitorTestGetAgent(test), &params,
d76c62
-                                 &nparams, &maxparams, def) != -2) {
d76c62
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
d76c62
-                       "agent get-fsinfo command should have failed");
d76c62
-        goto cleanup;
d76c62
-    }
d76c62
-
d76c62
-    ret = 0;
d76c62
-
d76c62
- cleanup:
d76c62
-    virTypedParamsFree(params, nparams);
d76c62
-    virDomainDefFree(def);
d76c62
-    qemuMonitorTestFree(test);
d76c62
-    return ret;
d76c62
-}
d76c62
-
d76c62
-
d76c62
 static int
d76c62
 testQemuAgentSuspend(const void *data)
d76c62
 {
d76c62
@@ -1438,7 +1305,6 @@ mymain(void)
d76c62
     DO_TEST(FSFreeze);
d76c62
     DO_TEST(FSThaw);
d76c62
     DO_TEST(FSTrim);
d76c62
-    DO_TEST(GetFSInfoParams);
d76c62
     DO_TEST(GetFSInfo);
d76c62
     DO_TEST(Suspend);
d76c62
     DO_TEST(Shutdown);
d76c62
-- 
d76c62
2.25.0
d76c62