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

[libvirt] [PATCH] report invalid x86 cpu map error



Let libvirtd handle invalid x86 cpu map error, and report the real reason.

This issue can be reproduced :
1, rm -rf /share/libvirt/cpu_map
2, start libvirtd
3, virsh create INSTANCE.xml

Libvirtd reports error :
error: invalid argument: Failed to parse group 'tss'

In face, libvirtd gets invalid cpu map.
With this patch, libvirtd reports error :
error: unsupported configuration: invalid x86 cpu map

Signed-off-by: zhenwei pi <pizhenwei bytedance com>
---
 src/cpu/cpu_x86.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index d3a88da21d..91419d91d4 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2902,8 +2902,11 @@ virCPUx86ValidateFeatures(virCPUDefPtr cpu)
     virCPUx86MapPtr map;
     size_t i;
 
-    if (!(map = virCPUx86GetMap()))
+    if (!(map = virCPUx86GetMap())) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        _("invalid x86 cpu map"));
         return -1;
+    }
 
     for (i = 0; i < cpu->nfeatures; i++) {
         if (!x86FeatureFind(map, cpu->features[i].name)) {
-- 
2.11.0


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