Allow configuration of DB drivers on docker install

Added the ability to supply 'pubsub_driver' and 'nb_db_driver'
parameters to the docker deployment.
This allows installation with databases different than etcd.
The default driver is still the etcd one, to maintain backward
compatibility.

Related-Bug: #1778007
Change-Id: Ibbd3b0fc4116dd5ac6514730773f771c0b27e5f7
This commit is contained in:
Shachar Snapiri 2018-09-03 10:22:55 +03:00
parent 590d23f94f
commit 1b5efe44f4
2 changed files with 18 additions and 4 deletions

View File

@ -2,7 +2,7 @@
[df]
pub_sub_driver = etcd_pubsub_driver
pub_sub_driver = PUBSUB_DRIVER
enable_selective_topology_distribution = False
enable_df_pub_sub = True
apps_list = portbinding,l2,l3_proactive,dhcp,dnat,sg,portqos,classifier,tunneling,provider,metadata_service,active_port_detection,migration
@ -13,7 +13,7 @@ management_ip = MANAGEMENT_IP
enable_dpdk = False
enable_neutron_notifier = False
remote_db_hosts = DB_SERVER_IP
nb_db_class = etcd_nb_db_driver
nb_db_class = NB_DB_DRIVER
auto_detect_port_behind_port = False
publisher_rate_limit_count = 1
publisher_rate_limit_timeout = 180

View File

@ -18,6 +18,14 @@ while test ${#} -gt 0; do
--db_init)
DB_INIT=1
;;
--nb_db_driver)
shift
NB_DB_DRIVER=$1
;;
--pubsub_driver)
shift
PUBSUB_DRIVER=$1
;;
--)
shift
break
@ -30,14 +38,20 @@ while test ${#} -gt 0; do
shift
done
# SET DRAGONFLOW_IP and DB_IP on the ini file
# Use defaults if not supplied
NB_DB_DRIVER=${NB_DB_DRIVER:-etcd_nb_db_driver}
PUBSUB_DRIVER=${PUBSUB_DRIVER:-etcd_pubsub_driver}
if [ ! -d /etc/dragonflow ]; then
mkdir -p /etc/dragonflow
fi
# Set parameters to the ini file
if [ ! -e /etc/dragonflow/dragonflow.ini ]; then
sed -e "s/LOCAL_IP/$DRAGONFLOW_IP/g" etc/standalone/dragonflow.ini | \
sed -e "s/MANAGEMENT_IP/$MANAGEMENT_IP/g" | \
sed -e "s/DB_SERVER_IP/$DB_IP/g" > /etc/dragonflow/dragonflow.ini
sed -e "s/DB_SERVER_IP/$DB_IP/g" | \
sed -e "s/NB_DB_DRIVER/$NB_DB_DRIVER/g" | \
sed -e "s/PUBSUB_DRIVER/$PUBSUB_DRIVER/g" > /etc/dragonflow/dragonflow.ini
fi
if [ ! -e /etc/dragonflow/dragonflow_datapath_layout.yaml ]; then
cp etc/dragonflow_datapath_layout.yaml /etc/dragonflow