Daniel P. Berrange 581b5f
commit 19bac57b26c2d46ac8a7601158f210f34acdceac
Daniel P. Berrange 581b5f
Author: Daniel P. Berrange <berrange@redhat.com>
Daniel P. Berrange 581b5f
Date:   Thu Aug 13 11:56:31 2009 +0100
Daniel P. Berrange 581b5f
Daniel P. Berrange 581b5f
    Make LXC / UML drivers robust against NUMA topology brokenness
Daniel P. Berrange 581b5f
    
Daniel P. Berrange 581b5f
    Some kernel versions expose broken NUMA topology for some machines.
Daniel P. Berrange 581b5f
    This causes the LXC/UML drivers to fail to start. QEMU driver was
Daniel P. Berrange 581b5f
    already fixed for this problem
Daniel P. Berrange 581b5f
    
Daniel P. Berrange 581b5f
    * src/lxc_conf.c: Log and ignore failure to populate NUMA info
Daniel P. Berrange 581b5f
    * src/uml_conf.c: Log and ignore failure to populate NUMA info
Daniel P. Berrange 581b5f
    * src/capabilities.c: Reset nnumaCell to 0 after freeing
Daniel P. Berrange 581b5f
Daniel P. Berrange 581b5f
diff --git a/src/capabilities.c b/src/capabilities.c
Daniel P. Berrange 581b5f
index c6766b6..193a9fe 100644
Daniel P. Berrange 581b5f
--- a/src/capabilities.c
Daniel P. Berrange 581b5f
+++ b/src/capabilities.c
Daniel P. Berrange 581b5f
@@ -139,6 +139,7 @@ virCapabilitiesFreeNUMAInfo(virCapsPtr caps)
Daniel P. Berrange 581b5f
     for (i = 0 ; i < caps->host.nnumaCell ; i++)
Daniel P. Berrange 581b5f
         virCapabilitiesFreeHostNUMACell(caps->host.numaCell[i]);
Daniel P. Berrange 581b5f
     VIR_FREE(caps->host.numaCell);
Daniel P. Berrange 581b5f
+    caps->host.nnumaCell = 0;
Daniel P. Berrange 581b5f
 }
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
 /**
Daniel P. Berrange 581b5f
diff --git a/src/lxc_conf.c b/src/lxc_conf.c
Daniel P. Berrange 581b5f
index d06a024..fef60ba 100644
Daniel P. Berrange 581b5f
--- a/src/lxc_conf.c
Daniel P. Berrange 581b5f
+++ b/src/lxc_conf.c
Daniel P. Berrange 581b5f
@@ -30,6 +30,8 @@
Daniel P. Berrange 581b5f
 #include "lxc_conf.h"
Daniel P. Berrange 581b5f
 #include "nodeinfo.h"
Daniel P. Berrange 581b5f
 #include "virterror_internal.h"
Daniel P. Berrange 581b5f
+#include "logging.h"
Daniel P. Berrange 581b5f
+
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
 #define VIR_FROM_THIS VIR_FROM_LXC
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
@@ -46,8 +48,14 @@ virCapsPtr lxcCapsInit(void)
Daniel P. Berrange 581b5f
                                    0, 0)) == NULL)
Daniel P. Berrange 581b5f
         goto no_memory;
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
-    if (nodeCapsInitNUMA(caps) < 0)
Daniel P. Berrange 581b5f
-        goto no_memory;
Daniel P. Berrange 581b5f
+    /* Some machines have problematic NUMA toplogy causing
Daniel P. Berrange 581b5f
+     * unexpected failures. We don't want to break the QEMU
Daniel P. Berrange 581b5f
+     * driver in this scenario, so log errors & carry on
Daniel P. Berrange 581b5f
+     */
Daniel P. Berrange 581b5f
+    if (nodeCapsInitNUMA(caps) < 0) {
Daniel P. Berrange 581b5f
+        virCapabilitiesFreeNUMAInfo(caps);
Daniel P. Berrange 581b5f
+        VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities");
Daniel P. Berrange 581b5f
+    }
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
     /* XXX shouldn't 'borrow' KVM's prefix */
Daniel P. Berrange 581b5f
     virCapabilitiesSetMacPrefix(caps, (unsigned char []){ 0x52, 0x54, 0x00 });
Daniel P. Berrange 581b5f
diff --git a/src/uml_conf.c b/src/uml_conf.c
Daniel P. Berrange 581b5f
index 48e05a8..4f756d4 100644
Daniel P. Berrange 581b5f
--- a/src/uml_conf.c
Daniel P. Berrange 581b5f
+++ b/src/uml_conf.c
Daniel P. Berrange 581b5f
@@ -45,6 +45,7 @@
Daniel P. Berrange 581b5f
 #include "nodeinfo.h"
Daniel P. Berrange 581b5f
 #include "verify.h"
Daniel P. Berrange 581b5f
 #include "bridge.h"
Daniel P. Berrange 581b5f
+#include "logging.h"
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
 #define VIR_FROM_THIS VIR_FROM_UML
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
@@ -63,8 +64,14 @@ virCapsPtr umlCapsInit(void) {
Daniel P. Berrange 581b5f
                                    0, 0)) == NULL)
Daniel P. Berrange 581b5f
         goto no_memory;
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
-    if (nodeCapsInitNUMA(caps) < 0)
Daniel P. Berrange 581b5f
-        goto no_memory;
Daniel P. Berrange 581b5f
+    /* Some machines have problematic NUMA toplogy causing
Daniel P. Berrange 581b5f
+     * unexpected failures. We don't want to break the QEMU
Daniel P. Berrange 581b5f
+     * driver in this scenario, so log errors & carry on
Daniel P. Berrange 581b5f
+     */
Daniel P. Berrange 581b5f
+    if (nodeCapsInitNUMA(caps) < 0) {
Daniel P. Berrange 581b5f
+        virCapabilitiesFreeNUMAInfo(caps);
Daniel P. Berrange 581b5f
+        VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities");
Daniel P. Berrange 581b5f
+    }
Daniel P. Berrange 581b5f
 
Daniel P. Berrange 581b5f
     if ((guest = virCapabilitiesAddGuest(caps,
Daniel P. Berrange 581b5f
                                          "uml",