提交 dc98750a 编写于 作者: T Tomáš Ryšavý 提交者: Michal Privoznik

test driver: added pages sizes into XML into test driver.

Signed-off-by: NTomáš Ryšavý <tom.rysavy.0@gmail.com>
上级 13ae5da9
...@@ -309,7 +309,7 @@ testBuildCapabilities(virConnectPtr conn) ...@@ -309,7 +309,7 @@ testBuildCapabilities(virConnectPtr conn)
virCapsGuestPtr guest; virCapsGuestPtr guest;
int guest_types[] = { VIR_DOMAIN_OSTYPE_HVM, int guest_types[] = { VIR_DOMAIN_OSTYPE_HVM,
VIR_DOMAIN_OSTYPE_XEN }; VIR_DOMAIN_OSTYPE_XEN };
size_t i; size_t i, j;
if ((caps = virCapabilitiesNew(VIR_ARCH_I686, false, false)) == NULL) if ((caps = virCapabilitiesNew(VIR_ARCH_I686, false, false)) == NULL)
goto error; goto error;
...@@ -319,19 +319,36 @@ testBuildCapabilities(virConnectPtr conn) ...@@ -319,19 +319,36 @@ testBuildCapabilities(virConnectPtr conn)
if (virCapabilitiesAddHostFeature(caps, "nonpae") < 0) if (virCapabilitiesAddHostFeature(caps, "nonpae") < 0)
goto error; goto error;
if (VIR_ALLOC_N(caps->host.pagesSize, 2) < 0)
goto error;
caps->host.pagesSize[caps->host.nPagesSize++] = 4;
caps->host.pagesSize[caps->host.nPagesSize++] = 2048;
for (i = 0; i < privconn->numCells; i++) { for (i = 0; i < privconn->numCells; i++) {
virCapsHostNUMACellCPUPtr cpu_cells; virCapsHostNUMACellCPUPtr cpu_cells;
virCapsHostNUMACellPageInfoPtr pages;
size_t nPages;
if (VIR_ALLOC_N(cpu_cells, privconn->cells[i].numCpus) < 0) if (VIR_ALLOC_N(cpu_cells, privconn->cells[i].numCpus) < 0 ||
goto error; VIR_ALLOC_N(pages, caps->host.nPagesSize) < 0) {
VIR_FREE(cpu_cells);
goto error;
}
nPages = caps->host.nPagesSize;
memcpy(cpu_cells, privconn->cells[i].cpus, memcpy(cpu_cells, privconn->cells[i].cpus,
sizeof(*cpu_cells) * privconn->cells[i].numCpus); sizeof(*cpu_cells) * privconn->cells[i].numCpus);
for (j = 0; j < nPages; j++)
pages[j].size = caps->host.pagesSize[j];
pages[0].avail = privconn->cells[i].mem / pages[0].size;
if (virCapabilitiesAddHostNUMACell(caps, i, 0, if (virCapabilitiesAddHostNUMACell(caps, i, privconn->cells[i].mem,
privconn->cells[i].numCpus, privconn->cells[i].numCpus,
cpu_cells, 0, NULL, 0, NULL) < 0) cpu_cells, 0, NULL, nPages, pages) < 0)
goto error; goto error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册