@@ -66,11 +66,11 @@ running_pid()
6666# running name
6767#
6868# Checks for a running process named 'name' by looking for a pidfile
69- # named /var/run/${name}.pid
69+ # named /var/run/openvswitch/ ${name}.pid
7070running ()
7171{
7272 local name=$1
73- local pidfile=/var/run/${name} .pid
73+ local pidfile=/var/run/openvswitch/ ${name} .pid
7474
7575 # No pidfile, probably no daemon present
7676 [ ! -f " $pidfile " ] && return 1
@@ -84,11 +84,11 @@ running()
8484# force_stop name
8585#
8686# Checks for a running process named 'name', by looking for a pidfile
87- # named /var/run/${name}.pid, and then kills it and waits for it to
88- # die.
87+ # named /var/run/openvswitch/ ${name}.pid, and then kills it and waits
88+ # for it to die.
8989force_stop () {
9090 local name=$1
91- local pidfile=/var/run/${name} .pid
91+ local pidfile=/var/run/openvswitch/ ${name} .pid
9292
9393 [ ! -f " $pidfile " ] && return
9494 if running $name ; then
@@ -206,14 +206,16 @@ case "$1" in
206206
207207 # Create an empty configuration database if it doesn't exist.
208208 if test ! -e /etc/openvswitch/conf.db; then
209+ install -d -m 755 -o root -g root /etc/openvswitch
210+
209211 # Create configuration database.
210212 ovsdb-tool -vANY:console:emer \
211- create /etc/openvswitch-switch /conf \
213+ create /etc/openvswitch/conf.db \
212214 /usr/share/openvswitch/vswitch.ovsschema
213215 else
214216 # Upgrade or downgrade schema and compact database.
215217 ovsdb-tool -vANY:console:emer \
216- convert /etc/openvswitch-switch /conf \
218+ convert /etc/openvswitch/conf.db \
217219 /usr/share/openvswitch/vswitch.ovsschema
218220 fi
219221
@@ -223,19 +225,29 @@ case "$1" in
223225 monitor_opt=
224226 fi
225227
228+ if [ ! -d /var/run/openvswitch ]; then
229+ install -d -m 755 -o root -g root /var/run/openvswitch
230+ fi
231+
232+ if [ ! -d /var/log/openvswitch ]; then
233+ install -d -m 755 -o root -g root /var/log/openvswitch
234+ fi
235+
226236 # Start ovsdb-server.
227237 set --
238+ set -- " $@ " /etc/openvswitch/conf.db
228239 set -- " $@ " --verbose=ANY:console:emer --verbose=ANY:syslog:err
229- set -- " $@ " --log-file
240+ set -- " $@ " --log-file=/var/log/openvswitch/ovsdb-server.log
230241 set -- " $@ " --detach --pidfile $monitor_opt
231- set -- " $@ " --remote punix:/var/run/ovsdb-server
232- set -- " $@ " /etc/openvswitch-switch/conf
242+ set -- " $@ " --remote punix:/var/run/openvswitch/db.sock
243+ set -- " $@ " --remote db:Open_vSwitch,managers
233244 set -- " $@ " --private-key=db:SSL,private_key
234245 set -- " $@ " --certificate=db:SSL,certificate
235246 set -- " $@ " --bootstrap-ca-cert=db:SSL,ca_cert
236247 set -- " $@ " $OVSDB_SERVER_OPTS
237248 echo -n " Starting ovsdb-server: "
238- start-stop-daemon --start --quiet --pidfile /var/run/ovsdb-server.pid \
249+ start-stop-daemon --start --quiet \
250+ --pidfile /var/run/openvswitch/ovsdb-server.pid \
239251 --exec $ovsdb_server -- " $@ "
240252 if running ovsdb-server; then
241253 echo " ovsdb-server."
@@ -248,12 +260,13 @@ case "$1" in
248260 # Start ovs-vswitchd.
249261 set --
250262 set -- " $@ " --verbose=ANY:console:emer --verbose=ANY:syslog:err
251- set -- " $@ " --log-file
263+ set -- " $@ " --log-file=/var/log/openvswitch/ovs-vswitchd.log
252264 set -- " $@ " --detach --pidfile $monitor_opt
253- set -- " $@ " unix:/var/run/ovsdb-server
265+ set -- " $@ " unix:/var/run/openvswitch/db.sock
254266 set -- " $@ " $OVS_VSWITCHD_OPTS
255267 echo -n " Starting ovs-vswitchd: "
256- start-stop-daemon --start --quiet --pidfile /var/run/ovs-vswitchd.pid \
268+ start-stop-daemon --start --quiet \
269+ --pidfile /var/run/openvswitch/ovs-vswitchd.pid \
257270 --exec $ovs_vswitchd -- " $@ "
258271 if running ovs-vswitchd; then
259272 echo " ovs-vswitchd."
@@ -264,13 +277,13 @@ case "$1" in
264277 stop)
265278 echo -n " Stopping ovs-vswitchd: "
266279 start-stop-daemon --stop --quiet --oknodo \
267- --pidfile /var/run/ovs-vswitchd.pid \
280+ --pidfile /var/run/openvswitch/ ovs-vswitchd.pid \
268281 --exec $ovs_vswitchd
269282 echo " ovs-vswitchd."
270283
271284 echo -n " Stopping ovsdb-server: "
272285 start-stop-daemon --stop --quiet --oknodo \
273- --pidfile /var/run/ovsdb-server.pid \
286+ --pidfile /var/run/openvswitch/ ovsdb-server.pid \
274287 --exec $ovsdb_server
275288 echo " ovsdb-server."
276289 ;;
0 commit comments