vlib: add plugin override support
Allow a plugin to override (suppress loading of) other plugins. This
mechanism allows a developer to prevent specific plugins from being
loaded.
To do so, provide an "overrides" list in the plugin definition:
VLIB_PLUGIN_REGISTER () =
{
<snip>
.overrides = "avf_plugin.so,ioam_plugin.so,dpdk_plugin.so",
};
or some such. Simply list the plugins in question as shown above. The
.overrides structure member is limited to 256 octets. The named .elf
section mechanism used to discover the vlib_plugin_registration_t's
precludes the use of a variable-length array of strings.
Use the vlib log to eliminate plugin and built-in vat plugin loader
console spew.
Added vlib_log_register_class_rate_limit(...) to allow procedural
configuration of the log rate-limit. We *never* want to rate-limit
plugin loader messages.
Type: feature
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I0a9327b8cf5508482f057342783252112cb44170
diff --git a/src/vlib/log.c b/src/vlib/log.c
index b11d081..342c0d2 100644
--- a/src/vlib/log.c
+++ b/src/vlib/log.c
@@ -172,8 +172,8 @@
}
-vlib_log_class_t
-vlib_log_register_class (char *class, char *subclass)
+static vlib_log_class_t
+vlib_log_register_class_internal (char *class, char *subclass, u32 limit)
{
vlib_log_main_t *lm = &log_main;
vlib_log_class_data_t *c = NULL;
@@ -199,12 +199,26 @@
vec_add2 (c->subclasses, s, 1);
s->index = s - c->subclasses;
s->name = subclass ? format (0, "%s", subclass) : 0;
- s->rate_limit = lm->default_rate_limit;
+ s->rate_limit = (limit == 0) ? lm->default_rate_limit : limit;
s->level = lm->default_log_level;
s->syslog_level = lm->default_syslog_log_level;
return (c->index << 16) | (s->index);
}
+vlib_log_class_t
+vlib_log_register_class (char *class, char *subclass)
+{
+ return vlib_log_register_class_internal (class, subclass,
+ 0 /* default rate limit */ );
+}
+
+vlib_log_class_t
+vlib_log_register_class_rate_limit (char *class, char *subclass, u32 limit)
+{
+ return vlib_log_register_class_internal (class, subclass, limit);
+}
+
+
u8 *
format_vlib_log_level (u8 * s, va_list * args)
{