[PATCH] test_driver: Implement virConnectGetDomainCapabilities()

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

 



Our test driver lacks implementation for
virConnectGetDomainCapabilities(). Provide one, though a trivial
one. Mostly so that something else than VIR_ERR_NO_SUPPORT error
is returned.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/test/test_driver.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c1d4d71b78..a8705a8da2 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -10000,6 +10000,41 @@ testNetworkSetMetadata(virNetworkPtr net,
     return ret;
 }
 
+static char *
+testConnectGetDomainCapabilities(virConnectPtr conn G_GNUC_UNUSED,
+                                 const char *emulatorbin,
+                                 const char *arch_str,
+                                 const char *machine,
+                                 const char *virttype_str,
+                                 unsigned int flags)
+{
+    g_autoptr(virDomainCaps) domCaps = NULL;
+    virArch arch = VIR_ARCH_NONE;
+    int virttype = VIR_DOMAIN_VIRT_NONE;
+
+    virCheckFlags(0, NULL);
+
+    if (arch_str &&
+        (arch = virArchFromString(arch_str)) == VIR_ARCH_NONE) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("unknown architecture: %1$s"), arch_str);
+        return NULL;
+    }
+
+    if (virttype_str &&
+        (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("unknown virttype: %1$s"), virttype_str);
+        return NULL;
+    }
+
+    if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
+        return NULL;
+
+    return virDomainCapsFormat(domCaps);
+}
+
+
 /*
  * Test driver
  */
@@ -10167,6 +10202,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainCheckpointGetParent = testDomainCheckpointGetParent, /* 5.6.0 */
     .domainCheckpointDelete = testDomainCheckpointDelete, /* 5.6.0 */
     .domainGetMessages = testDomainGetMessages, /* 7.6.0 */
+    .connectGetDomainCapabilities = testConnectGetDomainCapabilities, /* 9.8.0 */
 };
 
 static virNetworkDriver testNetworkDriver = {
-- 
2.41.0




[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