[PATCH 1/7] virCPUx86DataIsIdentical: Add debug output

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

 



Without this it's impossible to debug scenarios when this function
returns a mismatch but the formatted data looks identical.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/cpu/cpu_x86.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 9826ec6190..18e9cacfd0 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -3309,14 +3309,20 @@ virCPUx86DataIsIdentical(const virCPUData *a,
     if (!a || !b)
         return VIR_CPU_COMPARE_ERROR;

-    if (a->arch != b->arch)
+    if (a->arch != b->arch) {
+        VIR_DEBUG("incompatible architecture a:%u b:%u", a->arch, b->arch);
         return VIR_CPU_COMPARE_INCOMPATIBLE;
+    }

-    if (!((adata = &a->data.x86) && (bdata = &b->data.x86)))
+    if (!((adata = &a->data.x86) && (bdata = &b->data.x86))) {
+        VIR_DEBUG("missing x86 data: a:%p b:%p", adata, bdata);
         return VIR_CPU_COMPARE_ERROR;
+    }

-    if (adata->len != bdata->len)
+    if (adata->len != bdata->len) {
+        VIR_DEBUG("unequal length a:%zu b:%zu", adata->len, bdata->len);
         return VIR_CPU_COMPARE_INCOMPATIBLE;
+    }

     for (i = 0; i < adata->len; ++i) {
         bool found = false;
@@ -3330,8 +3336,10 @@ virCPUx86DataIsIdentical(const virCPUData *a,
             break;
         }

-        if (!found)
+        if (!found) {
+            VIR_DEBUG("mismatched data");
             return VIR_CPU_COMPARE_INCOMPATIBLE;
+        }
     }

     return VIR_CPU_COMPARE_IDENTICAL;
-- 
2.35.1




[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]

  Powered by Linux