virNodeGetCPUMap: Implement driver support

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

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
This commit is contained in:
Viktor Mihajlovski 2012-10-16 16:05:15 +02:00 committed by Eric Blake
parent d34439c9e4
commit e3ba67037b
5 changed files with 35 additions and 0 deletions

View File

@ -2736,6 +2736,7 @@ static virDriver lxcDriver = {
.nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */ .nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.6.5 */ .nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.6.5 */
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.6.5 */ .nodeGetFreeMemory = nodeGetFreeMemory, /* 0.6.5 */
.nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
.domainEventRegister = lxcDomainEventRegister, /* 0.7.0 */ .domainEventRegister = lxcDomainEventRegister, /* 0.7.0 */
.domainEventDeregister = lxcDomainEventDeregister, /* 0.7.0 */ .domainEventDeregister = lxcDomainEventDeregister, /* 0.7.0 */
.isEncrypted = lxcIsEncrypted, /* 0.7.3 */ .isEncrypted = lxcIsEncrypted, /* 0.7.3 */

View File

@ -2127,6 +2127,7 @@ static virDriver openvzDriver = {
.nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.12 */ .nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.12 */
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.9.12 */ .nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.9.12 */
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.9.12 */ .nodeGetFreeMemory = nodeGetFreeMemory, /* 0.9.12 */
.nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
.getCapabilities = openvzGetCapabilities, /* 0.4.6 */ .getCapabilities = openvzGetCapabilities, /* 0.4.6 */
.listDomains = openvzListDomains, /* 0.3.1 */ .listDomains = openvzListDomains, /* 0.3.1 */
.numOfDomains = openvzNumDomains, /* 0.3.1 */ .numOfDomains = openvzNumDomains, /* 0.3.1 */

View File

@ -14203,6 +14203,7 @@ static virDriver qemuDriver = {
.domainGetCPUStats = qemuDomainGetCPUStats, /* 0.9.11 */ .domainGetCPUStats = qemuDomainGetCPUStats, /* 0.9.11 */
.nodeGetMemoryParameters = nodeGetMemoryParameters, /* 0.10.2 */ .nodeGetMemoryParameters = nodeGetMemoryParameters, /* 0.10.2 */
.nodeSetMemoryParameters = nodeSetMemoryParameters, /* 0.10.2 */ .nodeSetMemoryParameters = nodeSetMemoryParameters, /* 0.10.2 */
.nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
}; };

View File

@ -5687,6 +5687,36 @@ static int testListAllDomains(virConnectPtr conn,
return ret; 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 = { static virDriver testDriver = {
.no = VIR_DRV_TEST, .no = VIR_DRV_TEST,
@ -5756,6 +5786,7 @@ static virDriver testDriver = {
.domainEventRegisterAny = testDomainEventRegisterAny, /* 0.8.0 */ .domainEventRegisterAny = testDomainEventRegisterAny, /* 0.8.0 */
.domainEventDeregisterAny = testDomainEventDeregisterAny, /* 0.8.0 */ .domainEventDeregisterAny = testDomainEventDeregisterAny, /* 0.8.0 */
.isAlive = testIsAlive, /* 0.9.8 */ .isAlive = testIsAlive, /* 0.9.8 */
.nodeGetCPUMap = testNodeGetCPUMap, /* 1.0.0 */
}; };
static virNetworkDriver testNetworkDriver = { static virNetworkDriver testNetworkDriver = {

View File

@ -2612,6 +2612,7 @@ static virDriver umlDriver = {
.nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */ .nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.5.0 */ .nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.5.0 */
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.5.0 */ .nodeGetFreeMemory = nodeGetFreeMemory, /* 0.5.0 */
.nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
.domainEventRegister = umlDomainEventRegister, /* 0.9.4 */ .domainEventRegister = umlDomainEventRegister, /* 0.9.4 */
.domainEventDeregister = umlDomainEventDeregister, /* 0.9.4 */ .domainEventDeregister = umlDomainEventDeregister, /* 0.9.4 */
.isEncrypted = umlIsEncrypted, /* 0.7.3 */ .isEncrypted = umlIsEncrypted, /* 0.7.3 */