In nodeGetFreePages, if startCell is given by '0', and the max node number is '0' too. The for-loop wouldn't be executed. So convert it to while-loop.
Before: > virsh freepages --cellno 0 --pagesize 4 error: internal error: no suitable info found After: > virsh freepages --cellno 0 --pagesize 4 4KiB: 472637 Signed-off-by: Jincheng Miao <jm...@redhat.com> --- src/nodeinfo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 2459922..1fe190a 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -2042,18 +2042,19 @@ nodeGetFreePages(unsigned int npages, } lastCell = MIN(lastCell, startCell + cellCount); + cell = startCell; - for (cell = startCell; cell < lastCell; cell++) { + do { for (i = 0; i < npages; i++) { unsigned int page_size = pages[i]; unsigned int page_free; - if (virNumaGetPageInfo(cell, page_size, 0, NULL, &page_free) < 0) + if (virNumaGetPageInfo(cell++, page_size, 0, NULL, &page_free) < 0) goto cleanup; counts[ncounts++] = page_free; } - } + } while (cell < lastCell); if (!ncounts) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -- 1.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list