openvswitch: use pidfile option
Make appctl to search pidfile for exit command as pid 1 is not always the target process in some cases. For example, pid 1 is "pause" when pid namespace sharing is enabled in your k8s cluster. Change-Id: I90e202245a9522fe53bea7e1f047061a0a280834
This commit is contained in:
parent
ab3626190d
commit
18d85dbf7f
@ -22,6 +22,7 @@ COMMAND="${@:-start}"
|
|||||||
OVS_DB=/run/openvswitch/conf.db
|
OVS_DB=/run/openvswitch/conf.db
|
||||||
OVS_SOCKET=/run/openvswitch/db.sock
|
OVS_SOCKET=/run/openvswitch/db.sock
|
||||||
OVS_SCHEMA=/usr/share/openvswitch/vswitch.ovsschema
|
OVS_SCHEMA=/usr/share/openvswitch/vswitch.ovsschema
|
||||||
|
OVS_PID=/run/openvswitch/ovsdb-server.pid
|
||||||
|
|
||||||
function start () {
|
function start () {
|
||||||
mkdir -p "$(dirname ${OVS_DB})"
|
mkdir -p "$(dirname ${OVS_DB})"
|
||||||
@ -38,11 +39,13 @@ function start () {
|
|||||||
-vconsole:emer \
|
-vconsole:emer \
|
||||||
-vconsole:err \
|
-vconsole:err \
|
||||||
-vconsole:info \
|
-vconsole:info \
|
||||||
|
--pidfile=${OVS_PID} \
|
||||||
--remote=punix:${OVS_SOCKET}
|
--remote=punix:${OVS_SOCKET}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop () {
|
function stop () {
|
||||||
ovs-appctl -T1 -t /run/openvswitch/ovsdb-server.1.ctl exit
|
PID=$(cat $OVS_PID)
|
||||||
|
ovs-appctl -T1 -t /run/openvswitch/ovsdb-server.${PID}.ctl exit
|
||||||
}
|
}
|
||||||
|
|
||||||
$COMMAND
|
$COMMAND
|
||||||
|
@ -20,6 +20,7 @@ set -ex
|
|||||||
COMMAND="${@:-start}"
|
COMMAND="${@:-start}"
|
||||||
|
|
||||||
OVS_SOCKET=/run/openvswitch/db.sock
|
OVS_SOCKET=/run/openvswitch/db.sock
|
||||||
|
OVS_PID=/run/openvswitch/ovs-vswitchd.pid
|
||||||
|
|
||||||
function start () {
|
function start () {
|
||||||
t=0
|
t=0
|
||||||
@ -63,11 +64,13 @@ function start () {
|
|||||||
-vconsole:emer \
|
-vconsole:emer \
|
||||||
-vconsole:err \
|
-vconsole:err \
|
||||||
-vconsole:info \
|
-vconsole:info \
|
||||||
|
--pidfile=${OVS_PID} \
|
||||||
--mlockall
|
--mlockall
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop () {
|
function stop () {
|
||||||
ovs-appctl -T1 -t /run/openvswitch/ovs-vswitchd.1.ctl exit
|
PID=$(cat $OVS_PID)
|
||||||
|
ovs-appctl -T1 -t /run/openvswitch/ovs-vswitchd.${PID}.ctl exit
|
||||||
}
|
}
|
||||||
|
|
||||||
$COMMAND
|
$COMMAND
|
||||||
|
Loading…
Reference in New Issue
Block a user