2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

28 Commits

Author SHA1 Message Date
Ben Pfaff
f89ffb0e2f poll-loop: Make wakeup logging more portable and easier to understand.
Until now, when the poll_loop module's log level was turned up to "debug",
it would log a backtrace of the call stack for the event that caused poll()
to wake up in poll_block().  This was pretty useful from time to time to
find out why ovs-vswitchd was using more CPU than expected, because we
could find out what was causing it to wake up.

But there were some issues.  One is simply that the backtrace was printed
as a series of hexadecimal numbers, so GDB or another debugger was needed
to translate it into human-readable format.  Compiler optimizations meant
that even the human-readable backtrace wasn't, in my experience, as helpful
as it could have been.  And, of course, one needed to have the binary to
interpret the backtrace.  When the backtrace couldn't be interpreted or
wasn't meaningful, there was essentially nothing to fall back on.

This commit changes the way that "debug" logging for poll_block() wakeups
works.  Instead of logging a backtrace, it logs the source code file name
and line number of the call to a poll_loop function, using __FILE__ and
__LINE__.  This is by itself much more meaningful than a sequence of
hexadecimal numbers, since no additional interpretation is necessary.  It
can be useful even if the Open vSwitch version is only approximately known.

In addition to the file and line, this commit adds, for wakeups caused by
file descriptors, information about the file descriptor itself: what kind
of file it is (regular file, directory, socket, etc.), the name of the file
(on Linux only), and the local and remote endpoints for socket file
descriptors.

Here are a few examples of the new output format:

932-ms timeout at ../ofproto/in-band.c:507
[POLLIN] on fd 20 (192.168.0.20:35388<->192.168.0.3:6633) at ../lib/stream-fd.c:149
[POLLIN] on fd 7 (FIFO pipe:[48049]) at ../lib/fatal-signal.c:168
2011-05-13 14:38:15 -07:00
Andrew Evans
0b3e7a8b71 ovsdb-server: Write manager status information to Manager table.
This commit makes the status of manager connections visible via the Manager
table in the database.  Two new columns have been created for this purpose:
'is_connected' and 'status'.  The former is a boolean flag, and the latter is a
string-string map which may contain the keys "last_error", "state", and
"time_in_state".

Requested-by: Keith Amidon <keith@nicira.com>
Reviewed by: Ben Pfaff.
Feature #3692.
2011-02-01 14:45:20 -08:00
Andrew Evans
c18ea70d06 util: New ovs_retval_to_string() function.
Many OVS functions return 0, EOF, or errno. There are several places in the
codebase where a return value is converted to a string. All must decide whether
the return value is set, and if it is, whether it is an errno value, EOF, or
otherwise invalid. This commit consolidates that code.

Reviewed by Ben Pfaff.
2011-01-30 17:54:59 -08:00
Ben Pfaff
b3907fbc6c queue: Get rid of ovs_queue data structure.
ovs_queue doesn't seem very useful; it's just a singly-linked list.  It's
more generally useful to use a general-purpose "struct list" for lists of
packets, so this commit adds such a member to "struct ofpbuf" and shifts
the existing users to use it.
2010-12-06 10:03:31 -08:00
Ben Pfaff
94db54073e Add "Manager" and "manager_options" to allow options for OVSDB connections.
I'm retaining the "managers" column in the Open_vSwitch table for now, but
I hope that applications transition to using "manager_options" eventually
so that we could drop it.

CC: Andrew Lambeth <wal@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
2010-11-05 10:22:18 -07:00
Ben Pfaff
d98e600755 vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.
It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon,
so this commit switches to the more common form.
2010-10-29 09:48:47 -07:00
Ben Pfaff
33ff0dceb4 jsonrpc: Indentation fix. 2010-08-25 14:55:47 -07:00
Ben Pfaff
5136ce492c vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.
Adding a macro to define the vlog module in use adds a level of
indirection, which makes it easier to change how the vlog module must be
defined.  A followup commit needs to do that, so getting these widespread
changes out of the way first should make that commit easier to review.
2010-07-21 15:47:09 -07:00
Ben Pfaff
36a7b32d79 Suppress ovsdb-server log messages about connections from ovs-vsctl.
In the ovsdb-server log there are fairly continuous messages like these:

Apr 26 11:27:55|15254|reconnect|INFO|unix:/tmp/stream-unix.31734.0: connected
Apr 26 11:27:55|15255|reconnect|INFO|unix:/tmp/stream-unix.31734.0: connection dropped
Apr 26 11:28:00|15256|reconnect|INFO|unix:/tmp/stream-unix.31810.0: connecting...
Apr 26 11:28:00|15257|reconnect|INFO|unix:/tmp/stream-unix.31810.0: connected
Apr 26 11:28:00|15258|reconnect|INFO|unix:/tmp/stream-unix.31810.0: connection dropped

These just indicate that ovs-vsctl is connecting to ovsdb-server from,
for example, the "vif" script.  But there's no need to log all that detail;
it's simply not useful.  This commit suppresses it.

Bug #2715.
2010-06-22 11:49:56 -07:00
Ben Pfaff
d1b801a597 jsonrpc: Suppress duplicate logging.
Both jsonrpc and reconnect were logging ordinary connection closure.
There's no need for both to do it.
2010-06-22 11:49:56 -07:00
Ben Pfaff
41630cfbc3 jsonrpc: Propagate error code to reconnect_disconnected().
Always passing 0 to reconnect_disconnected() means that it uses a generic
log message ("connection dropped").  By passing the error code, as done by
this commit, reconnect_disconnected() can log a more specific message.
2010-06-22 11:49:56 -07:00
Ben Pfaff
1e3c004749 Diagnose attempts to connect the wrong protocol to a network port.
Sometimes, when a user asks me to help debug a problem, it turns out that
an SSL connection was being made on a TCP port, or vice versa, or that an
OpenFlow connection was being made on a JSON-RPC port, or vice versa, and
so on.  This commit adds log messages that diagnose this kind of problem,
e.g. "tcp:127.0.0.1:6633: received JSON-RPC data on OpenFlow channel".
2010-05-11 11:50:45 -07:00
Ben Pfaff
b302749b70 Make fatal signals cause an exit more promptly in special cases.
The fatal-signal library notices and records fatal signals (e.g. SIGTERM)
and terminates the process on the next trip through poll_block().  But
some special utilities do not always invoke poll_block() promptly, e.g.
"ovs-ofctl monitor" does not call poll_block() as long as OpenFlow messages
are available.  But these special cases seem like they are all likely to
call into functions that themselves block (those with "_block" in their
names).  So make a new rule that such functions should always call
fatal_signal_run(), either directly or through poll_block().  This commit
implements and documents that rule.

Bug #2625.
2010-04-13 09:30:32 -07:00
Ben Pfaff
0d11f523a3 ovsdb: Use port 6632 as a default port for database connections.
Until now we have required a port number to be specified explicitly for
database connections.  This commit adopts port 6632 as a default.
2010-04-12 11:15:15 -07:00
Ben Pfaff
c9f3f37a9d jsonrpc: Add support for passive connections.
This allows ovs-vsctl to work as a simple Open vSwitch "manager" if the
XenServer host is configured to connect to it remotely.
2010-04-12 11:03:32 -07:00
Ben Pfaff
7c88a5dc3a jsonrpc: Fix potential memory leak.
This is unlikely to occur very often in practice, because s->stream
usually gets stuffed into s->rpc before long, but it is still a good idea
to fix it.
2010-03-24 16:52:07 -07:00
Ben Pfaff
36d802ae1f json: New function json_to_ds().
Some upcoming code wants to serialize JSON into a "struct ds" dynamic
string buffer, so expose an interface to do this.

This commit doesn't change much, but it renames some functions internal
to json.c to make the naming more consistent.

Also, make jsonrpc_log_msg() use this new function, since it is a more
straightforward way to do what it wants.
2010-01-26 09:49:30 -08:00
Ben Pfaff
7b8dbc8d8f jsonrpc: Fix memory leak in jsonrpc_session_send() when not connected.
Partial fix for bug #2373.
2010-01-12 14:28:00 -08:00
Ben Pfaff
f3d00a23ad jsonrpc: Check RPC status after trying to send, not before.
This usually prevented JSON-RPC over SSL from working.

Reported-by: Jeremy Stribling <strib@nicira.com>
2010-01-11 13:06:42 -08:00
Ben Pfaff
a1ae9a4316 jsonrpc: Properly implement connection timeout.
jsonrpc_session_connect() indirectly called reconnect_disconnected(), which
told the reconnect object that the connection had failed, before it told it
that the connection attempt had started.  When the connection didn't
complete immediately, this caused the connection to time out immediately,
without any backoff.

Reported by Jeremy Stribling.
2010-01-08 15:36:06 -08:00
Ben Pfaff
108496163d stream: Remove spurious #includes from header file. 2010-01-06 14:32:22 -08:00
Ben Pfaff
539e96f623 stream: Add stream_run(), stream_run_wait() functions.
SSL, which will be added in an upcoming commit, requires some background
processing, which is best done in a "run" function in our architecture.
This commit adds stream_run() and stream_run_wait() and calls to them from
the places where they will be required.
2010-01-06 14:26:48 -08:00
Ben Pfaff
4931f33ad9 ovsdb-server: Factor out complication by using jsonrpc_session. 2010-01-04 09:47:01 -08:00
Ben Pfaff
20bed8be25 jsonrpc: Make it easy to get a new JSON-RPC request's id. 2009-12-02 11:19:08 -08:00
Ben Pfaff
dcbb691b00 jsonrpc: New type "jsonrpc_session", which automatically reconnects. 2009-12-02 11:19:03 -08:00
Ben Pfaff
1fd13cde12 jsonrpc: Add logging for messages sent and received, at DBG level.
This made it much easier to see problems while developing some
ovsdb-server features.
2009-11-17 16:02:46 -08:00
Ben Pfaff
d0632593fe ovsdb: Add new ovsdb-client program. 2009-11-06 15:35:34 -08:00
Ben Pfaff
f212909325 Implement JSON-RPC protocol. 2009-11-04 15:24:40 -08:00