[libvirt PATCH v3 3/5] qemu: refactor 'qemuAgentGetInterfaces'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add report_unsupported parameter to qemuAgentGetInterfaces

Signed-off-by: zhanglei <zhanglei@xxxxxxxxxx>
---
 src/qemu/qemu_agent.c  | 9 ++++++---
 src/qemu/qemu_agent.h  | 3 ++-
 src/qemu/qemu_driver.c | 2 +-
 tests/qemuagenttest.c  | 2 +-
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 5f421be6f6..a7f943e0dc 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -2245,17 +2245,20 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfacePtr **ifaces_ret,
  */
 int
 qemuAgentGetInterfaces(qemuAgent *agent,
-                       virDomainInterfacePtr **ifaces)
+                       virDomainInterfacePtr **ifaces,
+                       bool report_unsupported)
 {
     g_autoptr(virJSONValue) cmd = NULL;
     g_autoptr(virJSONValue) reply = NULL;
     virJSONValue *ret_array = NULL;
+    int rc;
 
     if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
         return -1;
 
-    if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0)
-        return -1;
+    if ((rc = qemuAgentCommandFull(agent, cmd, &reply, agent->timeout,
+                                   report_unsupported)) < 0)
+        return rc;
 
     if (!(ret_array = virJSONValueObjectGetArray(reply, "return"))) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h
index 81b45b8e5d..94eab9de9f 100644
--- a/src/qemu/qemu_agent.h
+++ b/src/qemu/qemu_agent.h
@@ -151,7 +151,8 @@ int qemuAgentSetTime(qemuAgent *mon,
                      bool sync);
 
 int qemuAgentGetInterfaces(qemuAgent *mon,
-                           virDomainInterfacePtr **ifaces);
+                           virDomainInterfacePtr **ifaces,
+                           bool report_unsupported);
 
 int qemuAgentSetUserPassword(qemuAgent *mon,
                              const char *user,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dfc27572c4..5071faab5e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18950,7 +18950,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom,
             goto endjob;
 
         agent = qemuDomainObjEnterAgent(vm);
-        ret = qemuAgentGetInterfaces(agent, ifaces);
+        ret = qemuAgentGetInterfaces(agent, ifaces, true);
         qemuDomainObjExitAgent(vm, agent);
 
     endjob:
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index bef6dfd152..8fb3da7fef 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -907,7 +907,7 @@ testQemuAgentGetInterfaces(const void *data)
         goto cleanup;
 
     if ((ifaces_count = qemuAgentGetInterfaces(qemuMonitorTestGetAgent(test),
-                                               &ifaces)) < 0)
+                                               &ifaces, true)) < 0)
         goto cleanup;
 
     if (ifaces_count != 4) {
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux