Modify the installation script of nova and glance
Modify the installation script of nova and glance, include the README files. Change-Id: I477d453526941be8caa3ee89ee20c575067c416b
This commit is contained in:
parent
995258ecf8
commit
4886a8a246
|
@ -0,0 +1,3 @@
|
|||
#set up where the openstack is installed, before running the installation script,
|
||||
#it's better to run 'source envrc' .
|
||||
export OPENSTACK_INSTALL_DIR=/usr/lib/python2.7/dist-packages
|
|
@ -37,7 +37,7 @@ Installation
|
|||
- Please install the python package: pexpect>=2.3 ( because we use pxssh for loginng and there is a bug in pxssh, see https://mail.python.org/pipermail/python-list/2008-February/510054.html, you should fix this before launch the service. )
|
||||
|
||||
* **Manual Installation**
|
||||
|
||||
- Please **make sure you have installed the glance patches in /juno-patches**.
|
||||
- Make sure you have performed backups properly.
|
||||
* **Manual Installation**
|
||||
|
||||
|
@ -70,14 +70,13 @@ Installation
|
|||
`python /usr/bin/glance-sync --config-file=/etc/glance/glance-sync.conf & `
|
||||
|
||||
* **Automatic Installation**
|
||||
|
||||
1. Enter the glance-patch installation dir: `cd ./tricircle/juno-patches/glance/glance_location_patch/installation` .
|
||||
0. run `source envrc`.
|
||||
1. **make sure you have installed the glance patches in /juno-patches**: Enter the glance-patch installation dir: `cd ./tricircle/juno-patches/glance/glance_location_patch/installation` .
|
||||
2. Optional, modify the shell script variable: `_PYTHON_INSTALL_DIR` .
|
||||
3. Run the install script: `sh install.sh`
|
||||
4. Enter the glancesync installation dir: `cd ./tricircle/glancesync/installation` .
|
||||
5. Modify the cascading&cascaded glances' store scheme configuration, which is in the file: `./tricircle/glancesync/etc/glance/glance_store.yaml` .
|
||||
6. Optional, modify the config options in shell script: `sync_enabled=True`, `sync_server_port=9595`, `sync_server_host=127.0.0.1` with the proper values.
|
||||
7. Run the install script: `sh install.sh`
|
||||
6. Run the install script: `sh install.sh`
|
||||
|
||||
Configurations
|
||||
--------------
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
# Copyright (c) 2014 Huawei Technologies.
|
||||
|
||||
CURPATH=$(cd "$(dirname "$0")"; pwd)
|
||||
_GLANCE_CONF_DIR="/etc/glance"
|
||||
_GLANCE_API_CONF_FILE="glance-api.conf"
|
||||
_GLANCE_SYNC_CMD_FILE="glance-sync"
|
||||
_PYTHON_INSTALL_DIR="/usr/lib64/python2.6/site-packages"
|
||||
_PYTHON_INSTALL_DIR=${OPENSTACK_INSTALL_DIR}
|
||||
if [ ! -n ${_PYTHON_INSTALL_DIR} ];then
|
||||
_PYTHON_INSTALL_DIR="/usr/lib/python2.7/dist-packages"
|
||||
fi
|
||||
_GLANCE_DIR="${_PYTHON_INSTALL_DIR}/glance"
|
||||
|
||||
# if you did not make changes to the installation files,
|
||||
|
@ -28,8 +29,6 @@ _BACKUP_DIR="${_GLANCE_DIR}/glance-sync-backup"
|
|||
|
||||
_SCRIPT_LOGFILE="/var/log/glance/installation/install.log"
|
||||
|
||||
api_config_option_list="sync_enabled=True sync_server_port=9595 sync_server_host=127.0.0.1"
|
||||
|
||||
export PS4='+{$LINENO:${FUNCNAME[0]}}'
|
||||
|
||||
ERRTRAP()
|
||||
|
@ -61,92 +60,101 @@ function process_stop
|
|||
fi
|
||||
}
|
||||
|
||||
function backup
|
||||
{
|
||||
log "checking previous installation..."
|
||||
if [ -d "${_BACKUP_DIR}/glance" ] ; then
|
||||
log "It seems glance cascading has already been installed!"
|
||||
log "Please check README for solution if this is not true."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "backing up current files that might be overwritten..."
|
||||
mkdir -p "${_BACKUP_DIR}/glance"
|
||||
mkdir -p "${_BACKUP_DIR}/etc/glance"
|
||||
|
||||
if [ $? -ne 0 ] ; then
|
||||
rm -r "${_BACKUP_DIR}/glance"
|
||||
rm -r "${_BACKUP_DIR}/etc"
|
||||
log "Error in config backup, aborted."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function restart_services
|
||||
{
|
||||
log "restarting glance ..."
|
||||
service glance-api restart
|
||||
service glance-registry restart
|
||||
process_stop "glance-sync"
|
||||
python /usr/bin/glance-sync --config-file=/etc/glance/glance-sync.conf &
|
||||
}
|
||||
|
||||
function preinstall
|
||||
{
|
||||
if [[ ${EUID} -ne 0 ]]; then
|
||||
log "Please run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "/var/log/glance/installation" ]; then
|
||||
mkdir -p /var/log/glance/installation
|
||||
touch _SCRIPT_LOGFILE
|
||||
fi
|
||||
|
||||
log "checking installation directories..."
|
||||
if [ ! -d "${_GLANCE_DIR}" ] ; then
|
||||
log "Could not find the glance installation. Please check the variables in the beginning of the script."
|
||||
log "aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${_CONF_DIR}/${_GLANCE_SYNC_CMD_FILE}" ]; then
|
||||
log "Could not find the glance-sync file. Please check the variables in the beginning of the script."
|
||||
log "aborted."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
#Start to execute here
|
||||
#
|
||||
|
||||
trap 'ERRTRAP $LINENO' ERR
|
||||
|
||||
if [[ ${EUID} -ne 0 ]]; then
|
||||
log "Please run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "/var/log/glance/installation" ]; then
|
||||
mkdir /var/log/glance/installation
|
||||
touch _SCRIPT_LOGFILE
|
||||
fi
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
log "checking installation directories..."
|
||||
if [ ! -d "${_GLANCE_DIR}" ] ; then
|
||||
log "Could not find the glance installation. Please check the variables in the beginning of the script."
|
||||
log "aborted."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "${_GLANCE_CONF_DIR}/${_GLANCE_API_CONF_FILE}" ] ; then
|
||||
log "Could not find glance-api config file. Please check the variables in the beginning of the script."
|
||||
log "aborted."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "${_CONF_DIR}/${_GLANCE_SYNC_CMD_FILE}" ]; then
|
||||
log "Could not find the glance-sync file. Please check the variables in the beginning of the script."
|
||||
log "aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "checking previous installation..."
|
||||
if [ -d "${_BACKUP_DIR}/glance" ] ; then
|
||||
log "It seems glance cascading has already been installed!"
|
||||
log "Please check README for solution if this is not true."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "backing up current files that might be overwritten..."
|
||||
mkdir -p "${_BACKUP_DIR}/glance"
|
||||
mkdir -p "${_BACKUP_DIR}/etc"
|
||||
mkdir -p "${_BACKUP_DIR}/etc/glance"
|
||||
cp -rf "${_GLANCE_CONF_DIR}/${_GLANCE_API_CONF_FILE}" "${_BACKUP_DIR}/etc/glance/"
|
||||
|
||||
preinstall
|
||||
if [ $? -ne 0 ] ; then
|
||||
rm -r "${_BACKUP_DIR}/glance"
|
||||
rm -r "${_BACKUP_DIR}/etc"
|
||||
log "Error in config backup, aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
backup
|
||||
if [ $? -ne 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
log "copying in new files..."
|
||||
cp -r "${_CODE_DIR}" `dirname ${_GLANCE_DIR}`
|
||||
cp -r "${_CONF_DIR}/glance" "/etc"
|
||||
cp "${_CONF_DIR}/${_GLANCE_SYNC_CMD_FILE}" "/usr/bin/"
|
||||
|
||||
#Config options
|
||||
log "configurate the glance options which is in script/tricircle.cfg"
|
||||
cd `dirname $0`/../../script
|
||||
python config.py glance
|
||||
if [ $? -ne 0 ] ; then
|
||||
log "Error in copying, aborted."
|
||||
log "Recovering original files..."
|
||||
cp -r "${_BACKUP_DIR}/glance" `dirname ${_GLANCE_DIR}` && rm -r "${_BACKUP_DIR}/glance"
|
||||
cp "${_BACKUP_DIR}/etc/glance/*.conf" `dirname ${_GLANCE_CONF_DIR}` && rm -r "${_BACKUP_DIR}/etc"
|
||||
if [ $? -ne 0 ] ; then
|
||||
log "Recovering failed! Please install manually."
|
||||
fi
|
||||
log "configurate the glance options error."
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
|
||||
log "updating config file..."
|
||||
for option in $api_config_option_list
|
||||
do
|
||||
sed -i -e "/$option/d" "${_GLANCE_CONF_DIR}/${_GLANCE_API_CONF_FILE}"
|
||||
sed -i -e "/DEFAULT/a $option" "${_GLANCE_CONF_DIR}/${_GLANCE_API_CONF_FILE}"
|
||||
done
|
||||
|
||||
|
||||
log "restarting glance ..."
|
||||
service openstack-glance-api restart
|
||||
service openstack-glance-registry restart
|
||||
process_stop "glance-sync"
|
||||
python /usr/bin/glance-sync --config-file=/etc/glance/glance-sync.conf &
|
||||
restart_services
|
||||
if [ $? -ne 0 ] ; then
|
||||
log "There was an error in restarting the service, please restart glance manually."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Completed."
|
||||
log "See README to get started."
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -14,15 +14,14 @@
|
|||
# Copyright (c) 2014 Huawei Technologies.
|
||||
|
||||
CURPATH=$(cd "$(dirname "$0")"; pwd)
|
||||
_GLANCE_CONF_DIR="/etc/glance"
|
||||
_GLANCE_API_CONF_FILE="glance-api.conf"
|
||||
_PYTHON_INSTALL_DIR="/usr/lib64/python2.6/site-packages"
|
||||
_PYTHON_INSTALL_DIR=${OPENSTACK_INSTALL_DIR}
|
||||
if [ ! -n ${_PYTHON_INSTALL_DIR} ];then
|
||||
_PYTHON_INSTALL_DIR="/usr/lib/python2.7/dist-packages"
|
||||
fi
|
||||
_GLANCE_DIR="${_PYTHON_INSTALL_DIR}/glance"
|
||||
|
||||
# if you did not make changes to the installation files,
|
||||
# please do not edit the following directories.
|
||||
_CODE_DIR="${CURPATH}/../glance"
|
||||
_CONF_DIR="${CURPATH}/../etc"
|
||||
_PATCH_DIR="${CURPATH}/.."
|
||||
_BACKUP_DIR="${_GLANCE_DIR}/glance-installation-backup"
|
||||
|
||||
|
@ -43,6 +42,32 @@ function log()
|
|||
echo "`date -u +'%Y-%m-%d %T.%N'`: $@" >> $_SCRIPT_LOGFILE
|
||||
}
|
||||
|
||||
function process_stop
|
||||
{
|
||||
PID=`ps -efw|grep "$1"|grep -v grep|awk '{print $2}'`
|
||||
echo "PID is: $PID">>$_SCRIPT_LOGFILE
|
||||
if [ "x${PID}" != "x" ]; then
|
||||
for kill_id in $PID
|
||||
do
|
||||
kill -9 ${kill_id}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "[[stop glance-sync]]$1 stop failed.">>$_SCRIPT_LOGFILE
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "[[stop glance-sync]]$1 stop ok.">>$_SCRIPT_LOGFILE
|
||||
fi
|
||||
}
|
||||
|
||||
function restart_services
|
||||
{
|
||||
log "restarting glance ..."
|
||||
service glance-api restart
|
||||
service glance-registry restart
|
||||
process_stop "glance-sync"
|
||||
python /usr/bin/glance-sync --config-file=/etc/glance/glance-sync.conf &
|
||||
}
|
||||
|
||||
trap 'ERRTRAP $LINENO' ERR
|
||||
|
||||
if [[ ${EUID} -ne 0 ]]; then
|
||||
|
@ -57,18 +82,6 @@ fi
|
|||
|
||||
cd `dirname $0`
|
||||
|
||||
log "checking installation directories..."
|
||||
if [ ! -d "${_GLANCE_DIR}" ] ; then
|
||||
log "Could not find the glance installation. Please check the variables in the beginning of the script."
|
||||
log "aborted."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "${_GLANCE_CONF_DIR}/${_GLANCE_API_CONF_FILE}" ] ; then
|
||||
log "Could not find glance-api config file. Please check the variables in the beginning of the script."
|
||||
log "aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
log "checking previous installation..."
|
||||
if [ -d "${_BACKUP_DIR}/glance" ] ; then
|
||||
|
@ -81,7 +94,6 @@ log "backing up current files that might be overwritten..."
|
|||
mkdir -p "${_BACKUP_DIR}/glance"
|
||||
mkdir -p "${_BACKUP_DIR}/etc"
|
||||
mkdir -p "${_BACKUP_DIR}/etc/glance"
|
||||
cp -rf "${_GLANCE_CONF_DIR}/${_GLANCE_API_CONF_FILE}" "${_BACKUP_DIR}/etc/glance/"
|
||||
|
||||
if [ $? -ne 0 ] ; then
|
||||
rm -r "${_BACKUP_DIR}/glance"
|
||||
|
@ -105,6 +117,13 @@ if [ $? -ne 0 ] ; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
#restart services
|
||||
restart_services
|
||||
if [ $? -ne 0 ] ; then
|
||||
log "There was an error in restarting the service, please restart glance manually."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Completed."
|
||||
log "See README to get started."
|
||||
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
# Copyright (c) 2014 Huawei Technologies.
|
||||
|
||||
CURPATH=$(cd "$(dirname "$0")"; pwd)
|
||||
_PYTHON_INSTALL_DIR="/usr/lib64/python2.6/site-packages"
|
||||
_PYTHON_INSTALL_DIR=${OPENSTACK_INSTALL_DIR}
|
||||
if [ ! -n ${_PYTHON_INSTALL_DIR} ];then
|
||||
_PYTHON_INSTALL_DIR="/usr/lib/python2.7/dist-packages"
|
||||
fi
|
||||
_GLANCE_STORE_DIR="${_PYTHON_INSTALL_DIR}/glance_store"
|
||||
|
||||
# if you did not make changes to the installation files,
|
||||
|
@ -36,6 +39,32 @@ function log()
|
|||
echo "`date -u +'%Y-%m-%d %T.%N'`: $@" >> $_SCRIPT_LOGFILE
|
||||
}
|
||||
|
||||
function process_stop
|
||||
{
|
||||
PID=`ps -efw|grep "$1"|grep -v grep|awk '{print $2}'`
|
||||
echo "PID is: $PID">>$_SCRIPT_LOGFILE
|
||||
if [ "x${PID}" != "x" ]; then
|
||||
for kill_id in $PID
|
||||
do
|
||||
kill -9 ${kill_id}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "[[stop glance-sync]]$1 stop failed.">>$_SCRIPT_LOGFILE
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "[[stop glance-sync]]$1 stop ok.">>$_SCRIPT_LOGFILE
|
||||
fi
|
||||
}
|
||||
|
||||
function restart_services
|
||||
{
|
||||
log "restarting glance ..."
|
||||
service glance-api restart
|
||||
service glance-registry restart
|
||||
process_stop "glance-sync"
|
||||
python /usr/bin/glance-sync --config-file=/etc/glance/glance-sync.conf &
|
||||
}
|
||||
|
||||
trap 'ERRTRAP $LINENO' ERR
|
||||
|
||||
if [[ ${EUID} -ne 0 ]]; then
|
||||
|
@ -60,8 +89,13 @@ fi
|
|||
|
||||
log "copying in new files..."
|
||||
|
||||
cp -rf "${_CODE_DIR}" `dirname ${_PYTHON_INSTALL_DIR}`
|
||||
cp -rf "${_CODE_DIR}" ${_PYTHON_INSTALL_DIR}
|
||||
|
||||
restart_services
|
||||
if [ $? -ne 0 ] ; then
|
||||
log "There was an error in restarting the service, please restart glance manually."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Completed."
|
||||
log "See README to get started."
|
||||
|
|
|
@ -40,6 +40,7 @@ We provide two ways to install the nova proxy code. In this section, we will gui
|
|||
|
||||
- Make sure you have performed backups properly.
|
||||
|
||||
|
||||
- Navigate to the local repository and copy the contents in 'nova' sub-directory to the corresponding places in existing nova, e.g.
|
||||
```cp -r $LOCAL_REPOSITORY_DIR/nova $NOVA_PARENT_DIR```
|
||||
(replace the $... with actual directory name.)
|
||||
|
@ -70,6 +71,8 @@ We provide two ways to install the nova proxy code. In this section, we will gui
|
|||
|
||||
- Make sure you have performed backups properly.
|
||||
|
||||
- run `source envrc`
|
||||
|
||||
- Navigate to the installation directory and run installation script.
|
||||
```
|
||||
cd $LOCAL_REPOSITORY_DIR/installation
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
|
||||
_NOVA_CONF_DIR="/etc/nova"
|
||||
_NOVA_CONF_FILE="nova.conf"
|
||||
_NOVA_INSTALL="/usr/lib64/python2.6/site-packages"
|
||||
_NOVA_INSTALL=${OPENSTACK_INSTALL_DIR}
|
||||
if [ ! -n ${_NOVA_INSTALL} ];then
|
||||
_NOVA_INSTALL="/usr/lib/python2.7/dist-packages"
|
||||
fi
|
||||
_NOVA_DIR="${_NOVA_INSTALL}/nova"
|
||||
|
||||
# if you did not make changes to the installation files,
|
||||
|
@ -25,7 +28,6 @@ _BACKUP_DIR="${_NOVA_INSTALL}/.nova-proxy-installation-backup"
|
|||
|
||||
_SCRIPT_LOGFILE="/var/log/nova-proxy/installation/install.log"
|
||||
|
||||
config_option_list="nova_admin_username=nova nova_admin_password=openstack nova_admin_tenant_name=service proxy_region_name=AZ1 cascading_nova_url=http://cascading_host:8774/v2 cascaded_nova_url=http://cascaded_host:8774/v2 cascaded_neutron_url=http://cascaded_host:9696 cascaded_glance_flag=False cascaded_glance_url=http://cascaded_host:9292 os_region_name=Cascading_Openstack keystone_auth_url=http://cascading_host:5000/v2.0/ cinder_endpoint_template=http://cascading_host:8776/v1/%(project_id)s compute_manager=nova.compute.manager_proxy.ComputeManager image_copy_dest_location_url=file:///var/lib/glance/images image_copy_dest_host=cascaded_host image_copy_dest_user=glance image_copy_dest_password=openstack image_copy_source_location_url=file:///var/lib/glance/images image_copy_source_host=copy_image_host image_copy_source_user=glance image_copy_source_password=openstack"
|
||||
|
||||
function log()
|
||||
{
|
||||
|
@ -45,6 +47,11 @@ fi
|
|||
|
||||
cd `dirname $0`
|
||||
|
||||
if [ ! -d "/var/log/nova-proxy/installation" ]; then
|
||||
mkdir -p /var/log/nova-proxy/installation
|
||||
touch _SCRIPT_LOGFILE
|
||||
fi
|
||||
|
||||
log "checking installation directories..."
|
||||
if [ ! -d "${_NOVA_DIR}" ] ; then
|
||||
log "Could not find the nova installation. Please check the variables in the beginning of the script."
|
||||
|
@ -87,19 +94,16 @@ if [ $? -ne 0 ] ; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
log "updating config file..."
|
||||
for option in $config_option_list
|
||||
do
|
||||
option_key=`echo $option|awk -F "=" '{print $1}'`
|
||||
option_value=`echo $option|awk -F "=" '{print $2}'`
|
||||
sed -i.backup -e "/$option_key *=/d" "${_NOVA_CONF_DIR}/${_NOVA_CONF_FILE}"
|
||||
echo "$option_key,***************$option_value"
|
||||
echo $option_key=$option_value >> "${_NOVA_CONF_DIR}/${_NOVA_CONF_FILE}"
|
||||
|
||||
done
|
||||
cd `dirname $0`/../../script
|
||||
python config.py nova
|
||||
if [ $? -ne 0 ] ; then
|
||||
log "configurate the nova options error."
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
|
||||
log "restarting nova compute..."
|
||||
service openstack-nova-compute restart
|
||||
service nova-compute restart
|
||||
if [ $? -ne 0 ] ; then
|
||||
log "There was an error in restarting the service, please restart nova scheduler manually."
|
||||
exit 1
|
||||
|
@ -108,4 +112,4 @@ fi
|
|||
log "Completed."
|
||||
log "See README to get started."
|
||||
|
||||
exit 0
|
||||
exit 0
|
Loading…
Reference in New Issue