[PATCH RFC 4/4] libxl: domainInterfaceAddresses agent support

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

 



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

Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx>
---
 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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