[PATCHv3 4/4] virNodeGetCPUMap: Implement driver support

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

 



From: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>

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

Signed-off-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>
---
 src/lxc/lxc_driver.c       |  1 +
 src/openvz/openvz_driver.c |  1 +
 src/qemu/qemu_driver.c     |  1 +
 src/test/test_driver.c     | 31 +++++++++++++++++++++++++++++++
 src/uml/uml_driver.c       |  1 +
 5 files changed, 35 insertions(+)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 87305db..2072f00 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2736,6 +2736,7 @@ static virDriver lxcDriver = {
     .nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */
     .nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.6.5 */
     .nodeGetFreeMemory = nodeGetFreeMemory, /* 0.6.5 */
+    .nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
     .domainEventRegister = lxcDomainEventRegister, /* 0.7.0 */
     .domainEventDeregister = lxcDomainEventDeregister, /* 0.7.0 */
     .isEncrypted = lxcIsEncrypted, /* 0.7.3 */
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 2f51c1c..fb3c552 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -2127,6 +2127,7 @@ static virDriver openvzDriver = {
     .nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.12 */
     .nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.9.12 */
     .nodeGetFreeMemory = nodeGetFreeMemory, /* 0.9.12 */
+    .nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
     .getCapabilities = openvzGetCapabilities, /* 0.4.6 */
     .listDomains = openvzListDomains, /* 0.3.1 */
     .numOfDomains = openvzNumDomains, /* 0.3.1 */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 57e6403..18be7d9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14203,6 +14203,7 @@ static virDriver qemuDriver = {
     .domainGetCPUStats = qemuDomainGetCPUStats, /* 0.9.11 */
     .nodeGetMemoryParameters = nodeGetMemoryParameters, /* 0.10.2 */
     .nodeSetMemoryParameters = nodeSetMemoryParameters, /* 0.10.2 */
+    .nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
 };


diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c9f9115..58c4e67 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5687,6 +5687,36 @@ static int testListAllDomains(virConnectPtr conn,
     return ret;
 }

+static int
+testNodeGetCPUMap(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 +5786,7 @@ static virDriver testDriver = {
     .domainEventRegisterAny = testDomainEventRegisterAny, /* 0.8.0 */
     .domainEventDeregisterAny = testDomainEventDeregisterAny, /* 0.8.0 */
     .isAlive = testIsAlive, /* 0.9.8 */
+    .nodeGetCPUMap = testNodeGetCPUMap, /* 1.0.0 */
 };

 static virNetworkDriver testNetworkDriver = {
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index ba37eb7..2c6e820 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2612,6 +2612,7 @@ static virDriver umlDriver = {
     .nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */
     .nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.5.0 */
     .nodeGetFreeMemory = nodeGetFreeMemory, /* 0.5.0 */
+    .nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
     .domainEventRegister = umlDomainEventRegister, /* 0.9.4 */
     .domainEventDeregister = umlDomainEventDeregister, /* 0.9.4 */
     .isEncrypted = umlIsEncrypted, /* 0.7.3 */
-- 
1.7.11.7

--
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]