From: Luyao Huang Date: Wed, 21 Oct 2015 04:13:40 +0000 (+0800) Subject: util: Adjust error paths for virNumaSetPagePoolSize X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e802d7efb4c0809a5fc756048dc34b2d15b7618d;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git util: Adjust error paths for virNumaSetPagePoolSize Commit id '1c24cfe9' added new checks and error messaes for failure scenarios. Let's adjust those error messages to after the call to virNumaGetHugePageInfoPath in order to provide a more specific error message depending on node and page_size After this patch: # virsh allocpages --pagesize 2047 --pagecount 1 --cellno 0 error: operation failed: page size 2047 is not available on node 0 # virsh allocpages --pagesize 2047 --pagecount 1 error: operation failed: page size 2047 is not available Signed-off-by: Luyao Huang --- diff --git a/src/util/virnuma.c b/src/util/virnuma.c index cb80972e6..815cbc12c 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -836,19 +836,25 @@ virNumaSetPagePoolSize(int node, goto cleanup; } - if (node != -1 && !virNumaNodeIsAvailable(node)) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("NUMA node %d is not available"), - node); - goto cleanup; - } - if (virNumaGetHugePageInfoPath(&nr_path, node, page_size, "nr_hugepages") < 0) goto cleanup; if (!virFileExists(nr_path)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("page size or NUMA node not available")); + if (node != -1) { + if (!virNumaNodeIsAvailable(node)) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("NUMA node %d is not available"), + node); + } else { + virReportError(VIR_ERR_OPERATION_FAILED, + _("page size %u is not available on node %d"), + page_size, node); + } + } else { + virReportError(VIR_ERR_OPERATION_FAILED, + _("page size %u is not available"), + page_size); + } goto cleanup; }