summaryrefslogtreecommitdiff
path: root/vswitchd
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-06-20 14:21:06 -0700
committerBen Pfaff <blp@nicira.com>2011-06-21 13:02:28 -0700
commit3fe8050596e3cff28c007b5d7c1ec9c461849995 (patch)
treea75b4db7ac77e647994fa3e6953444be61e7fb72 /vswitchd
parent8de67146f837bec4f103607cc5e0c7020c79e444 (diff)
downloadopenvswitch-3fe8050596e3cff28c007b5d7c1ec9c461849995.tar.gz
bridge: Enable system stats only if turned on in the database.
Most hypervisors have no use for this column, so populating it just wastes CPU time. It can still be enabled explicitly via other-config. CC: Peter Balland <peter@nicira.com> CC: David Tsai <dtsai@nicira.com> Bug #5961. NIC-397.
Diffstat (limited to 'vswitchd')
-rw-r--r--vswitchd/bridge.c21
-rw-r--r--vswitchd/vswitch.ovsschema6
-rw-r--r--vswitchd/vswitch.xml18
3 files changed, 42 insertions, 3 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 3a9cfa9de..d0a5764d3 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1291,6 +1291,23 @@ iface_refresh_stats(struct iface *iface)
#undef IFACE_STATS
}
+static bool
+enable_system_stats(const struct ovsrec_open_vswitch *cfg)
+{
+ const char *enable;
+
+ /* Use other-config:enable-system-stats by preference. */
+ enable = get_ovsrec_key_value(&cfg->header_,
+ &ovsrec_open_vswitch_col_other_config,
+ "enable-statistics");
+ if (enable) {
+ return !strcmp(enable, "true");
+ }
+
+ /* Disable by default. */
+ return false;
+}
+
static void
refresh_system_stats(const struct ovsrec_open_vswitch *cfg)
{
@@ -1298,7 +1315,9 @@ refresh_system_stats(const struct ovsrec_open_vswitch *cfg)
struct shash stats;
shash_init(&stats);
- get_system_stats(&stats);
+ if (enable_system_stats(cfg)) {
+ get_system_stats(&stats);
+ }
ovsdb_datum_from_shash(&datum, &stats);
ovsdb_idl_txn_write(&cfg->header_, &ovsrec_open_vswitch_col_statistics,
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index dee2a045d..315affcb8 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@
{"name": "Open_vSwitch",
- "version": "5.0.1",
- "cksum": "246745439 14434",
+ "version": "5.1.0",
+ "cksum": "154459795 14545",
"tables": {
"Open_vSwitch": {
"columns": {
@@ -16,6 +16,8 @@
"type": {"key": {"type": "uuid",
"refTable": "SSL"},
"min": 0, "max": 1}},
+ "other_config": {
+ "type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}},
"external_ids": {
"type": {"key": "string", "value": "string",
"min": 0, "max": "unlimited"}},
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 3be4ccba4..e399eeea2 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -25,6 +25,19 @@
SSL used globally by the daemon.
</column>
+ <column name="other_config">
+ Key-value pairs for configuring rarely used Open vSwitch features. The
+ currently defined key-value pairs are:
+ <dl>
+ <dt><code>enable-statistics</code></dt>
+ <dd>
+ Set to <code>true</code> to enable populating the <ref
+ column="statistics"/> column or <code>false</code> (the default)
+ disable populating it.
+ </dd>
+ </dl>
+ </column>
+
<column name="external_ids">
Key-value pairs for use by external frameworks that integrate
with Open vSwitch, rather than by Open vSwitch itself. System
@@ -75,6 +88,11 @@
apply to a platform are omitted.
</p>
+ <p>
+ Statistics are disabled unless <ref column="other-config"
+ key="enable-statistics"/> is set to <code>true</code>.
+ </p>
+
<dl>
<dt><code>cpu</code></dt>
<dd>