[ovs-dev] [ovsdb-locks 05/11] ovs-vswitchd: Make database socket command-line argument optional.
Ben Pfaff
blp at nicira.com
Thu Jul 14 21:27:26 UTC 2011
In practice the default location is the only one used, so we might as well
make it easy.
---
INSTALL.Linux | 3 +--
vswitchd/ovs-vswitchd.8.in | 10 ++++------
vswitchd/ovs-vswitchd.c | 12 +++++++++---
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/INSTALL.Linux b/INSTALL.Linux
index 6442fcc..6c17ca4 100644
--- a/INSTALL.Linux
+++ b/INSTALL.Linux
@@ -287,8 +287,7 @@ ovsdb-tool (but running it at any time is harmless):
Then start the main Open vSwitch daemon, telling it to connect to the
same Unix domain socket:
- % ovs-vswitchd unix:/usr/local/var/run/openvswitch/db.sock \
- --pidfile --detach
+ % ovs-vswitchd --pidfile --detach
Now you may use ovs-vsctl to set up bridges and other Open vSwitch
features. For example, to create a bridge named br0 and add ports
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index 3e41bab..516e6da 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -14,17 +14,15 @@
ovs\-vswitchd \- Open vSwitch daemon
.
.SH SYNOPSIS
-.B ovs\-vswitchd
-\fIdatabase\fR
+\fBovs\-vswitchd \fR[\fIdatabase\fR]
.
.SH DESCRIPTION
A daemon that manages and controls any number of Open vSwitch switches
on the local machine.
.PP
-The mandatory \fIdatabase\fR argument normally takes the form
-\fBunix:\fIfile\fR, where \fIfile\fR is the name of a Unix domain
-socket on which \fBovsdb\-server\fR is listening. However, all of the
-following forms are accepted:
+The \fIdatabase\fR argument specifies how \fBovs\-vswitchd\fR connects
+to \fBovsdb\-server\fR. The default is \fBunix:@RUNDIR@/db.sock\fR.
+The following forms are accepted:
.so ovsdb/remote-active.man
.so ovsdb/remote-passive.man
.PP
diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c
index a71eecc..07dcd28 100644
--- a/vswitchd/ovs-vswitchd.c
+++ b/vswitchd/ovs-vswitchd.c
@@ -30,6 +30,7 @@
#include "command-line.h"
#include "compiler.h"
#include "daemon.h"
+#include "dirs.h"
#include "dummy.h"
#include "leak-checker.h"
#include "netdev.h"
@@ -190,12 +191,17 @@ parse_options(int argc, char *argv[])
argc -= optind;
argv += optind;
- if (argc != 1) {
+ switch (argc) {
+ case 0:
+ return xasprintf("unix:%s/db.sock", ovs_rundir());
+
+ case 1:
+ return argv[0];
+
+ default:
VLOG_FATAL("database socket is only non-option argument; "
"use --help for usage");
}
-
- return argv[0];
}
static void
--
1.7.4.4
More information about the dev
mailing list