Support use openstack's base-service etcd

This is to support openstack's etcd bast service, but not remove the
functionality.

Also change the default port for etcd to 2379, since that's the port
set in openstack.

Have the gate test against openstack's etcd, rather than dragonflow's
etcd.

Remove the option df-etcd-server. Since we use openstack's etcd service,
it doesn't make sense to install our own.

Change-Id: Id14c04e0a22016534b9bd810af13429c15dd6f2f
This commit is contained in:
Omer Anson 2017-06-22 11:08:30 +03:00
parent b212a48877
commit 49a78472ed
4 changed files with 11 additions and 90 deletions

View File

@ -17,7 +17,7 @@
# http://git.openstack.org/cgit/openstack-infra/project-config/tree/jenkins/jobs/dragonflow.yaml
#
export OVERRIDE_ENABLED_SERVICES=key,n-api,n-cpu,n-cond,n-sch,n-crt,n-cauth,n-obj,g-api,g-reg,c-sch,c-api,c-vol,rabbit,mysql,dstat,df-controller,df-etcd,df-etcd-server,df-zmq-publisher-service,q-svc,df-l3-agent,df-metadata,q-qos,placement-api,q-trunk
export OVERRIDE_ENABLED_SERVICES=key,n-api,n-cpu,n-cond,n-sch,n-crt,n-cauth,n-obj,g-api,g-reg,c-sch,c-api,c-vol,rabbit,mysql,dstat,df-controller,df-etcd,etcd3,df-zmq-publisher-service,q-svc,df-l3-agent,df-metadata,q-qos,placement-api,q-trunk
export DEVSTACK_LOCAL_CONFIG+=$'\n'"DF_PUB_SUB=True"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"DF_SELECTIVE_TOPO_DIST=True"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"ENABLE_PORT_STATUS_NOTIFIER=False"

View File

@ -10,76 +10,8 @@
# - nb_db_driver_clean
# - nb_db_driver_configure
ETCD_VERSION=${ETCD_VERSION:-v3.0.15}
OVERRIDE_FILE=$DEST/dragonflow/devstack/etcd.override
if is_ubuntu ; then
UBUNTU_RELEASE_BASE_NUM=`lsb_release -r | awk '{print $2}' | cut -d '.' -f 1`
fi
function _configure_etcd_systemd_service {
ETCD_CONF_DIR=/etc/etcd
ETCD_CONF=$ETCD_CONF_DIR/etcd.conf
ETCD_DATA_DIR="/var/lib/etcd"
sudo mkdir -p $ETCD_DATA_DIR
sudo install -d -o $STACK_USER $ETCD_CONF_DIR
cp $DEST/dragonflow/devstack/etcd.service.conf $ETCD_CONF
iniset $ETCD_CONF DEFAULT ETCD_INITIAL_CLUSTER "$HOSTNAME=http://$REMOTE_DB_IP:2380"
iniset $ETCD_CONF DEFAULT ETCD_INITIAL_CLUSTER_STATE "new"
iniset $ETCD_CONF DEFAULT ETCD_INITIAL_CLUSTER_TOKEN "etcd-cluster-01"
iniset $ETCD_CONF DEFAULT ETCD_INITIAL_ADVERTISE_PEER_URLS "http://$REMOTE_DB_IP:2380"
iniset $ETCD_CONF DEFAULT ETCD_DATA_DIR "$ETCD_DATA_DIR"
iniset $ETCD_CONF DEFAULT ETCD_LISTEN_PEER_URLS "http://0.0.0.0:2380"
iniset $ETCD_CONF DEFAULT ETCD_LISTEN_CLIENT_URLS "http://$REMOTE_DB_IP:4001"
iniset $ETCD_CONF DEFAULT ETCD_ADVERTISE_CLIENT_URLS "http://$REMOTE_DB_IP:4001"
iniset $ETCD_CONF DEFAULT ETCD_NAME "$HOSTNAME"
sudo cp $DEST/dragonflow/devstack/etcd.service /lib/systemd/system/
enable_service etcd
}
function _configure_etcd {
sudo cp $DEST/dragonflow/devstack/etcd.conf /etc/init/etcd.conf
cat <<EOF > $OVERRIDE_FILE
# Override file for etcd Upstart script providing some environment variables
env ETCD_INITIAL_CLUSTER="$HOSTNAME=http://$REMOTE_DB_IP:2380"
env ETCD_INITIAL_CLUSTER_STATE="new"
env ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
env ETCD_INITIAL_ADVERTISE_PEER_URLS="http://$REMOTE_DB_IP:2380"
env ETCD_DATA_DIR="/var/etcd"
env ETCD_LISTEN_PEER_URLS="http://0.0.0.0:2380"
env ETCD_LISTEN_CLIENT_URLS="http://$REMOTE_DB_IP:4001"
env ETCD_ADVERTISE_CLIENT_URLS="http://$REMOTE_DB_IP:4001"
env ETCD_NAME="$HOSTNAME"
EOF
sudo cp $OVERRIDE_FILE /etc/init/etcd.override
}
function nb_db_driver_install_server {
if is_service_enabled df-etcd-server ; then
echo "Installing etcd"
if [ ! -f "$DEST/etcd/etcd-$ETCD_VERSION-linux-amd64/etcd" ]; then
mkdir -p $DEST/etcd
wget https://github.com/coreos/etcd/releases/download/$ETCD_VERSION/etcd-$ETCD_VERSION-linux-amd64.tar.gz -O $DEST/etcd/etcd-$ETCD_VERSION-linux-amd64.tar.gz
tar xzvf $DEST/etcd/etcd-$ETCD_VERSION-linux-amd64.tar.gz -C $DEST/etcd
sudo cp $DEST/etcd/etcd-$ETCD_VERSION-linux-amd64/etcd /usr/local/bin/etcd
fi
if [ ! -f "/usr/local/bin/etcd" ]; then
sudo cp $DEST/etcd/etcd-$ETCD_VERSION-linux-amd64/etcd /usr/local/bin/etcd
fi
if is_ubuntu; then
if [ $UBUNTU_RELEASE_BASE_NUM -ge 16 ] ; then
_configure_etcd_systemd_service
else
_configure_etcd
fi
elif is_fedora; then
_configure_etcd_systemd_service
fi
fi
:
}
function nb_db_driver_install_client {
@ -87,24 +19,15 @@ function nb_db_driver_install_client {
}
function nb_db_driver_start_server {
if is_service_enabled df-etcd-server ; then
start_service etcd
fi
:
}
function nb_db_driver_stop_server {
if is_service_enabled df-etcd-server ; then
stop_service etcd
fi
:
}
function nb_db_driver_clean {
sudo rm -rf $ETCD_DATA_DIR
sudo rm -rf $ETCD_CONF_DIR
sudo rm -rf /var/etcd
sudo rm -f $OVERRIDE_FILE
sudo rm /lib/systemd/system/etcd.service
sudo rm /usr/local/bin/etcd
:
}
function nb_db_driver_configure {

View File

@ -47,11 +47,6 @@ fi
DF_APPS_LIST=${DF_APPS_LIST:-$DEFAULT_APPS_LIST}
TUNNEL_TYPE=${TUNNEL_TYPE:-$DEFAULT_TUNNEL_TYPE}
# How to connect to the database storing the virtual topology.
REMOTE_DB_IP=${REMOTE_DB_IP:-$HOST_IP}
REMOTE_DB_PORT=${REMOTE_DB_PORT:-4001}
REMOTE_DB_HOSTS=${REMOTE_DB_HOSTS:-"$REMOTE_DB_IP:$REMOTE_DB_PORT"}
# OVS related pid files
#----------------------
OVS_DB_SERVICE="ovsdb-server"
@ -84,6 +79,7 @@ if is_service_enabled df-etcd ; then
is_df_db_driver_selected && die $LINENO "More than one database service is set for Dragonflow."
source $DEST/dragonflow/devstack/etcd_driver
NB_DRIVER_CLASS="etcd_nb_db_driver"
REMOTE_DB_PORT=${REMOTE_DB_PORT:-2379}
fi
if is_service_enabled df-ramcloud ; then
is_df_db_driver_selected && die $LINENO "More than one database service is set for Dragonflow."
@ -109,6 +105,11 @@ else
DF_REDIS_PUBSUB="False"
fi
# How to connect to the database storing the virtual topology.
REMOTE_DB_IP=${REMOTE_DB_IP:-$HOST_IP}
REMOTE_DB_PORT=${REMOTE_DB_PORT:-4001}
REMOTE_DB_HOSTS=${REMOTE_DB_HOSTS:-"$REMOTE_DB_IP:$REMOTE_DB_PORT"}
# As the function returns actual value only on pre-install, ignore it on later stages
if [[ "$ACTION" == "stack" && "$STAGE" == "pre-install" ]]; then
is_df_db_driver_selected || die $LINENO "No database service is set for Dragonflow."

View File

@ -66,8 +66,6 @@ Etcd Database:
enable_service df-etcd
enable_service df-etcd-server
Ram Cloud Database:
enable_service df-ramcloud
@ -88,7 +86,6 @@ Redis Database:
enable_service df-redis-server
Detailed Installation
---------------------