[PATCH 2/3] util: move the pagesize and node check and error report to one place

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just like 1c24cfe9, check the pagesize and numa node if we cannot find
the hugepage path. And improve the error message again.

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 <lhuang@xxxxxxxxxx>
---
 src/util/virnuma.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index cb80972..815cbc1 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;
     }
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]