Merge "Add nb_db_driver_clean support for nb db devstack"
This commit is contained in:
commit
e48e45ff40
|
@ -10,20 +10,17 @@
|
|||
# - nb_db_driver_clean
|
||||
|
||||
ETCD_VERSION=v2.2.2
|
||||
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 {
|
||||
function _configure_etcd_systemd_service {
|
||||
ETCD_CONF_DIR=/etc/etcd
|
||||
ETCD_CONF=$ETCD_CONF_DIR/etcd.conf
|
||||
ETCD_DATA_DIR="/var/lib/etcd"
|
||||
# Delete any existing etcd database:
|
||||
sudo rm -rf $ETCD_DATA_DIR
|
||||
sudo mkdir -p $ETCD_DATA_DIR
|
||||
|
||||
sudo rm -rf $ETCD_CONF_DIR
|
||||
sudo install -d -o $STACK_USER $ETCD_CONF_DIR
|
||||
cp $DEST/dragonflow/devstack/etcd.service.conf $ETCD_CONF
|
||||
|
||||
|
@ -41,14 +38,8 @@ function configure_etcd_systemd_service {
|
|||
sudo systemctl enable etcd
|
||||
}
|
||||
|
||||
function configure_etcd {
|
||||
|
||||
function _configure_etcd {
|
||||
sudo cp $DEST/dragonflow/devstack/etcd.conf /etc/init/etcd.conf
|
||||
# Delete any existing etcd database:
|
||||
sudo rm -rf /var/etcd
|
||||
|
||||
OVERRIDE_FILE=$DEST/dragonflow/devstack/etcd.override
|
||||
sudo rm -f $OVERRIDE_FILE
|
||||
|
||||
cat <<EOF > $OVERRIDE_FILE
|
||||
# Override file for etcd Upstart script providing some environment variables
|
||||
|
@ -80,12 +71,12 @@ function nb_db_driver_install_server {
|
|||
fi
|
||||
if is_ubuntu; then
|
||||
if [ $UBUNTU_RELEASE_BASE_NUM -ge 16 ] ; then
|
||||
configure_etcd_systemd_service
|
||||
_configure_etcd_systemd_service
|
||||
else
|
||||
configure_etcd
|
||||
_configure_etcd
|
||||
fi
|
||||
elif is_fedora; then
|
||||
configure_etcd_systemd_service
|
||||
_configure_etcd_systemd_service
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -114,3 +105,11 @@ function nb_db_driver_stop_server {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -490,6 +490,7 @@ if [[ "$Q_ENABLE_DRAGONFLOW_LOCAL_CONTROLLER" == "True" ]]; then
|
|||
if [[ "$1" == "unstack" ]]; then
|
||||
stop_df_metadata_agent
|
||||
stop_df
|
||||
nb_db_driver_clean
|
||||
cleanup_ovs
|
||||
stop_ovs
|
||||
uninstall_ovs
|
||||
|
|
|
@ -51,7 +51,7 @@ function nb_db_driver_install_server {
|
|||
|
||||
function nb_db_driver_install_client {
|
||||
echo "Installing RAMCloud client"
|
||||
git_clone https://github.com/dsivov/RamCloudBin.git $RAMCLOUD
|
||||
git_clone https://github.com/dsivov/RamCloudBin.git $RAMCLOUD
|
||||
}
|
||||
|
||||
function nb_db_driver_start_server {
|
||||
|
@ -74,3 +74,7 @@ function nb_db_driver_stop_server {
|
|||
sudo killall server 2&> /dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
function nb_db_driver_clean {
|
||||
sudo rm -rf $RAMCLOUD
|
||||
}
|
||||
|
|
|
@ -17,8 +17,7 @@ NODE_COUNT_END=5
|
|||
REMOTE_PORT_END=`expr $REMOTE_PORT_START + $NODE_COUNT_END`
|
||||
REDIS_PORT=`seq $REMOTE_PORT_START $REMOTE_PORT_END`
|
||||
|
||||
function configure_redis {
|
||||
|
||||
function _configure_redis {
|
||||
pushd /opt/redis3/conf
|
||||
sudo sh -c "grep -q ulimit /etc/profile ||
|
||||
echo ulimit -SHn 40960 >> /etc/profile"
|
||||
|
@ -44,9 +43,8 @@ function configure_redis {
|
|||
}
|
||||
|
||||
function nb_db_driver_install_server {
|
||||
|
||||
if [ "$DF_REDIS_INSTALL_FROM_RUBY" == "True" ]; then
|
||||
echo "Installing rediscluster"
|
||||
echo "Installing Redis cluster"
|
||||
if [ ! -f "$DEST/redis/redis-$REDIS_VERSION/redis" ]; then
|
||||
mkdir -p $DEST/redis
|
||||
if [ ! -f "$DEST/redis/redis-$REDIS_VERSION.tar.gz" ]; then
|
||||
|
@ -66,7 +64,7 @@ function nb_db_driver_install_server {
|
|||
|
||||
sudo chown -hR $STACK_USER /opt/redis3/
|
||||
if is_ubuntu || is_fedora; then
|
||||
configure_redis
|
||||
_configure_redis
|
||||
fi
|
||||
|
||||
mkdir -p $DEST/ruby
|
||||
|
@ -104,13 +102,13 @@ function nb_db_driver_start_server {
|
|||
create=
|
||||
if is_service_enabled df-redis-server ; then
|
||||
if is_ubuntu || is_fedora; then
|
||||
#to acquire if should recreate cluster
|
||||
# to acquire if should recreate cluster
|
||||
for redisserver in $REDIS_SERVER_LIST; do
|
||||
for port in $REDIS_PORT; do
|
||||
test -f /opt/redis3/conf/nodes-$port.conf || { create=true; break 2 ; }
|
||||
done
|
||||
done
|
||||
#start redis
|
||||
# start redis
|
||||
for redisserver in $REDIS_SERVER_LIST; do
|
||||
for port in $REDIS_PORT; do
|
||||
echo $redisserver:$port
|
||||
|
@ -125,9 +123,9 @@ function nb_db_driver_start_server {
|
|||
popd
|
||||
done
|
||||
done
|
||||
#create cluster
|
||||
# create cluster
|
||||
[ "$create" ] && {
|
||||
echo "create the cluster: "$redis_cluster
|
||||
echo "Create the Redis cluster: "$redis_cluster
|
||||
pushd /opt/redis3/bin/
|
||||
echo "yes" |sudo ./redis-trib.rb create --replicas 1 $redis_cluster
|
||||
popd
|
||||
|
@ -142,7 +140,7 @@ function nb_db_driver_stop_server {
|
|||
if is_ubuntu || is_fedora; then
|
||||
for redisserver in $REDIS_SERVER_LIST; do
|
||||
for port in $REDIS_PORT; do
|
||||
echo "shutshow redis: "$redisserver:$port
|
||||
echo "Shutshow Redis: "$redisserver:$port
|
||||
sudo /opt/redis3/bin/redis-cli -p $port shutdown
|
||||
pushd /opt/redis3/
|
||||
sudo rm -rf nodes*.conf
|
||||
|
@ -154,3 +152,16 @@ function nb_db_driver_stop_server {
|
|||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function nb_db_driver_clean {
|
||||
sudo rm -rf /opt/redis3
|
||||
if [ "$DF_REDIS_INSTALL_FROM_RUBY" == "True" ]; then
|
||||
sudo gem uninstall redis
|
||||
else
|
||||
if is_ubuntu; then
|
||||
uninstall_package -y redis-server
|
||||
elif is_fedora; then
|
||||
uninstall_package -y redis
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue