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

[libvirt] [PATCHv2 8/9] virNodeGetCPUMapFlags: Implement driver support



Driver support added for:
- test, pretending 8 host CPUS, 3 being online
- qemu, using nodeGetCPUMapFlags

Signed-off-by: Viktor Mihajlovski <mihajlov linux vnet ibm com>
---
 src/qemu/qemu_driver.c |    1 +
 src/test/test_driver.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0787039..2c6364b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13928,6 +13928,7 @@ static virDriver qemuDriver = {
     .domainGetCPUStats = qemuDomainGetCPUStats, /* 0.9.11 */
     .nodeGetMemoryParameters = nodeGetMemoryParameters, /* 0.10.2 */
     .nodeSetMemoryParameters = nodeSetMemoryParameters, /* 0.10.2 */
+    .nodeGetCPUMapFlags = nodeGetCPUMapFlags, /* 1.0.0 */
 };
 
 
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c9f9115..24f3b11 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5687,6 +5687,35 @@ static int testListAllDomains(virConnectPtr conn,
     return ret;
 }
 
+static int testNodeGetCPUMapFlags(virConnectPtr conn,
+                                  unsigned char **cpumap,
+                                  unsigned int *online,
+                                  unsigned int flags)
+{
+    testConnPtr privconn = conn->privateData;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    testDriverLock(privconn);
+    if (cpumap) {
+        if (VIR_ALLOC_N(*cpumap, 1) < 0) {
+            virReportOOMError();
+            goto cleanup;
+        }
+        *cpumap[0] = 0x15;
+    }
+
+    if (online)
+        *online = 3;
+
+    ret = 8;
+
+cleanup:
+    testDriverUnlock(privconn);
+    return ret;
+}
+
 
 static virDriver testDriver = {
     .no = VIR_DRV_TEST,
@@ -5756,6 +5785,7 @@ static virDriver testDriver = {
     .domainEventRegisterAny = testDomainEventRegisterAny, /* 0.8.0 */
     .domainEventDeregisterAny = testDomainEventDeregisterAny, /* 0.8.0 */
     .isAlive = testIsAlive, /* 0.9.8 */
+    .nodeGetCPUMapFlags = testNodeGetCPUMapFlags, /* 1.0.0 */
 };
 
 static virNetworkDriver testNetworkDriver = {
-- 
1.7.0.4


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