]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix valgrind crash in LXC & avoid probing unneccessarily
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 30 Jan 2009 16:51:33 +0000 (16:51 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 30 Jan 2009 16:51:33 +0000 (16:51 +0000)
ChangeLog
src/lxc_driver.c

index c9caba2f434fc8a7d53a8b5733ea3a3a08f3a427..a6deaf87123f76113ed95b96df09e189e1a2f640 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jan 30 16:51:22 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
+
+       * src/lxc_driver.c: Avoid probing for LXC until we know we're
+       going to try opening the connection. Disable when using valgrind
+
 Fri Jan 30 16:48:22 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
 
        * src/storage_conf.c: Fix leak of volume objects when free'ing
index e14229d2d78e19b47aa3187204755764a0355088..87865053ffb8aed17cfe83db7ac28d32fc96f1e5 100644 (file)
@@ -80,14 +80,14 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn,
                                 virConnectAuthPtr auth ATTRIBUTE_UNUSED,
                                 int flags ATTRIBUTE_UNUSED)
 {
-    if (!lxcProbe())
-        goto declineConnection;
-
     if (lxc_driver == NULL)
         goto declineConnection;
 
     /* Verify uri was specified */
     if (conn->uri == NULL) {
+        if (!lxcProbe())
+            goto declineConnection;
+
         conn->uri = xmlParseURI("lxc:///");
         if (!conn->uri) {
             virReportOOMError(conn);
@@ -96,8 +96,11 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn,
     } else if (conn->uri->scheme == NULL ||
                STRNEQ(conn->uri->scheme, "lxc")) {
         goto declineConnection;
+    } else if (!lxcProbe()) {
+        goto declineConnection;
     }
 
+
     conn->privateData = lxc_driver;
 
     return VIR_DRV_OPEN_SUCCESS;
@@ -1119,6 +1122,15 @@ static int lxcStartup(void)
 {
     uid_t uid = getuid();
     unsigned int i;
+    char *ld;
+
+    /* Valgrind gets very annoyed when we clone containers, so
+     * disable LXC when under valgrind
+     * XXX remove this when valgrind is fixed
+     */
+    ld = getenv("LD_PRELOAD");
+    if (ld && strstr(ld, "vgpreload"))
+        return -1;
 
     /* Check that the user is root */
     if (0 != uid) {