Move openvswitch db file into docker volume

openvswitch db file is created in /etc/openvswitch/conf.db. It will be
lost during upgrade openvswitch_db container.

This patch moves the db file into /var/lib/openvswitch folder, which
located in docker volume.

Change-Id: I73604fddacd21655590b9e66ee2805014795b9f1
Closes-Bug: #1649290
This commit is contained in:
Jeffrey Zhang 2016-12-14 20:44:51 +08:00 committed by Jeffrey Zhang
parent d023e86230
commit f62b16f8a4
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
mkdir -p "/run/openvswitch" mkdir -p "/run/openvswitch"
if [[ ! -e "/etc/openvswitch/conf.db" ]]; then if [[ ! -e "/var/lib/openvswitch/conf.db" ]]; then
ovsdb-tool create "/etc/openvswitch/conf.db" ovsdb-tool create "/var/lib/openvswitch/conf.db"
fi fi

View File

@ -19,12 +19,12 @@ ovs_ext_intf=$3
if [ ! -e $ovs_bridge ] && [ ! -e $ovs_ext_intf ]; then if [ ! -e $ovs_bridge ] && [ ! -e $ovs_ext_intf ]; then
# NOTE: (sbezverk) This part is executed only by kubernetes deployment. # NOTE: (sbezverk) This part is executed only by kubernetes deployment.
# Creating external bridge # Creating external bridge
/usr/sbin/ovsdb-server /etc/openvswitch/conf.db --remote=punix:/var/run/openvswitch/db.sock --run="ovs-vsctl --no-wait --db=unix:/var/run/openvswitch/db.sock add-br $ovs_bridge" /usr/sbin/ovsdb-server /var/lib/openvswitch/conf.db --remote=punix:/var/run/openvswitch/db.sock --run="ovs-vsctl --no-wait --db=unix:/var/run/openvswitch/db.sock add-br $ovs_bridge"
# Plug the external interface into the external bridge. # Plug the external interface into the external bridge.
/usr/sbin/ovsdb-server /etc/openvswitch/conf.db --remote=punix:/var/run/openvswitch/db.sock --run="ovs-vsctl --no-wait --db=unix:/var/run/openvswitch/db.sock add-port $ovs_bridge $ovs_ext_intf" /usr/sbin/ovsdb-server /var/lib/openvswitch/conf.db --remote=punix:/var/run/openvswitch/db.sock --run="ovs-vsctl --no-wait --db=unix:/var/run/openvswitch/db.sock add-port $ovs_bridge $ovs_ext_intf"
# Run ovsdb server process # Run ovsdb server process
/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/var/run/openvswitch/db.sock --remote=ptcp:6640 --log-file=/var/log/kolla/openvswitch/ovsdb-server.log /usr/sbin/ovsdb-server /var/lib/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/var/run/openvswitch/db.sock --remote=ptcp:6640 --log-file=/var/log/kolla/openvswitch/ovsdb-server.log
else else
# NOTE: (sbezverk) This part is executed only by kolla-ansible deployment. # NOTE: (sbezverk) This part is executed only by kolla-ansible deployment.
/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/run/openvswitch/db.sock --remote=ptcp:6640:$ovsdb_ip --log-file=/var/log/kolla/openvswitch/ovsdb-server.log /usr/sbin/ovsdb-server /var/lib/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/run/openvswitch/db.sock --remote=ptcp:6640:$ovsdb_ip --log-file=/var/log/kolla/openvswitch/ovsdb-server.log
fi fi