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

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



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

Signed-off-by: Joao Martins <joao m martins 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


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