提交 e3ba6703 编写于 作者: V Viktor Mihajlovski 提交者: Eric Blake

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: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
上级 d34439c9
...@@ -2736,6 +2736,7 @@ static virDriver lxcDriver = { ...@@ -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 */
......
...@@ -2127,6 +2127,7 @@ static virDriver openvzDriver = { ...@@ -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 */
......
...@@ -14203,6 +14203,7 @@ static virDriver qemuDriver = { ...@@ -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 */
}; };
......
...@@ -5687,6 +5687,36 @@ static int testListAllDomains(virConnectPtr conn, ...@@ -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 = { ...@@ -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 = {
......
...@@ -2612,6 +2612,7 @@ static virDriver umlDriver = { ...@@ -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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册