Whamcloud - gitweb
LU-5102 utils: Look for modules in $LUSTRE/utils/.libs 68/10468/3
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Wed, 28 May 2014 15:32:43 +0000 (11:32 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 5 Jun 2014 00:57:08 +0000 (00:57 +0000)
This allows locally built lustre utils to look for files outside of
the normal libdir location, and thus be tested without a full install.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: I0f3c3446ddc9aed3cf494c597f4c0a4c432478de
Reviewed-on: http://review.whamcloud.com/10468
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/mount_utils.c

index bb83f45..8054b07 100644 (file)
@@ -459,8 +459,23 @@ struct module_backfs_ops *load_backfs_module(enum ldd_mount_type mount_type)
        snprintf(filename, sizeof(filename), PLUGIN_DIR"/mount_%s.so", fsname);
 
        handle = dlopen(filename, RTLD_LAZY);
+
+       /* Check for $LUSTRE environment variable from test-framework.
+        * This allows using locally built modules to be used.
+        */
+       if (handle == NULL) {
+               char *dirname;
+               dirname = getenv("LUSTRE");
+               if (dirname) {
+                       snprintf(filename, sizeof(filename),
+                                "%s/utils/.libs/mount_%s.so",
+                                dirname, fsname);
+                       handle = dlopen(filename, RTLD_LAZY);
+               }
+       }
+
+       /* Do not clutter up console with missing types */
        if (handle == NULL)
-               /* Do not clutter up console with missing types */
                return NULL;
 
        ops = malloc(sizeof(*ops));