1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

Add NUMA support to virshAllocpagesPagesizeCompleter.

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Roland Schulz 2018-05-22 11:54:44 +02:00 committed by Michal Privoznik
parent 9267342206
commit 74e7c79066

View File

@ -579,6 +579,9 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl,
double size = 0; double size = 0;
size_t i = 0; size_t i = 0;
const char *suffix = NULL; const char *suffix = NULL;
const char *cellnum = NULL;
bool cellno = vshCommandOptBool(cmd, "cellno");
char *path = NULL;
char *pagesize = NULL; char *pagesize = NULL;
char *cap_xml = NULL; char *cap_xml = NULL;
char **ret = NULL; char **ret = NULL;
@ -595,7 +598,17 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl,
if (!(virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))) if (!(virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt)))
goto error; goto error;
npages = virXPathNodeSet("/capabilities/host/cpu/pages", ctxt, &pages); if (cellno && vshCommandOptStringQuiet(ctl, cmd, "cellno", &cellnum) > 0) {
if (virAsprintf(&path,
"/capabilities/host/topology/cells/cell[@id=\"%s\"]/pages",
cellnum) < 0)
goto error;
} else {
if (virAsprintf(&path, "/capabilities/host/cpu/pages") < 0)
goto error;
}
npages = virXPathNodeSet(path, ctxt, &pages);
if (npages <= 0) if (npages <= 0)
goto error; goto error;
@ -622,6 +635,7 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl,
VIR_FREE(pages[i]); VIR_FREE(pages[i]);
VIR_FREE(pages); VIR_FREE(pages);
VIR_FREE(cap_xml); VIR_FREE(cap_xml);
VIR_FREE(path);
VIR_FREE(pagesize); VIR_FREE(pagesize);
VIR_FREE(unit); VIR_FREE(unit);