exclude files from the search in the Loader 61/2661/2
authorMartin Klozik <martinx.klozik@intel.com>
Mon, 19 Oct 2015 03:36:45 +0000 (04:36 +0100)
committerMaryam Tahhan <maryam.tahhan@intel.com>
Tue, 20 Oct 2015 14:27:19 +0000 (14:27 +0000)
New configuration parameter EXCLUDE_MODULES defines module names,
which won't be automatically loaded by LoaderServant. It can be used
to exclude obsolete or abstract modules.

Change-Id: If98b50b1505465bcedcf28fe63421c73a4fe160a
JIRA: VSPERF-118
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Billy O Mahony <billy.o.mahony@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
Reviewed-by: Gene Snider <eugene.snider@huawei.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Tv Rao <tv.rao@freescale.com>
Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
conf/00_common.conf
core/loader/loader_servant.py

index ef1c628..51dceb3 100644 (file)
@@ -59,3 +59,13 @@ VERBOSITY = 'debug'
 # from anywhere in the test framework so be careful with naming
 # conventions
 TEST_PARAMS = {}
+
+# ############################
+# Modules
+# ############################
+
+# following modules will be excluded from automatic load by LoaderServant
+# it can be used to suppress automatic load of obsoleted or abstract modules
+# Example:
+#   EXCLUDE_MODULES = ['ovs_vanilla', 'qemu_virtio_net', 'pidstat']
+EXCLUDE_MODULES = []
index 3b729c2..dc6353f 100644 (file)
@@ -26,6 +26,7 @@ from os import sys
 import imp
 import fnmatch
 import logging
+from conf import settings
 
 
 class LoaderServant(object):
@@ -167,6 +168,10 @@ class LoaderServant(object):
             for filename in fnmatch.filter(filenames, '[!.]*.py'):
                 modname = os.path.splitext(os.path.basename(filename))[0]
 
+                # skip module load if it is excluded by configuration
+                if modname in settings.getValue('EXCLUDE_MODULES'):
+                    continue
+
                 try:
                     if modname in sys.modules:
                         mod = sys.modules[modname]