Allow querying of guest interface address through agent
through command `virsh domifaddr test --source agent`

Signed-off-by: Joao Martins <joao.m.mart...@oracle.com>
---
 src/libxl/libxl_driver.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index cf5e702..8f8fbec 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -6261,6 +6261,8 @@ libxlDomainInterfaceAddresses(virDomainPtr dom,
                               unsigned int source,
                               unsigned int flags)
 {
+    libxlDriverPrivatePtr driver = dom->conn->privateData;
+    libxlDomainObjPrivatePtr priv;
     virDomainObjPtr vm = NULL;
     int ret = -1;
 
@@ -6282,6 +6284,22 @@ libxlDomainInterfaceAddresses(virDomainPtr dom,
     case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE:
         ret = libxlGetDHCPInterfaces(dom, vm, ifaces);
         break;
+    case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT:
+        priv = vm->privateData;
+        if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_QUERY) < 0)
+            goto cleanup;
+
+        if (!libxlDomainAgentAvailable(vm, true))
+            goto endjob;
+
+        libxlDomainObjEnterAgent(vm);
+        ret = qemuAgentGetInterfaces(priv->agent, ifaces);
+        libxlDomainObjExitAgent(vm);
+
+    endjob:
+        libxlDomainObjEndJob(driver, vm);
+
+        break;
 
     default:
         virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
-- 
2.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to