Browse Source

Merge "Collapse the glance filesystem into platform"

changes/20/680920/1
Zuul 2 years ago
committed by Gerrit Code Review
parent
commit
1f600b3bb5
  1. 2
      tools/collector/centos/build_srpm.data
  2. 50
      tools/collector/scripts/collect_openstack.sh
  3. 2
      utilities/stx-extensions/centos/build_srpm.data
  4. 9
      utilities/stx-extensions/centos/tis-extensions.spec
  5. 290
      utilities/stx-extensions/files/target
  6. 14
      utilities/stx-extensions/files/target.service

2
tools/collector/centos/build_srpm.data

@ -1,2 +1,2 @@
SRC_DIR="scripts"
TIS_PATCH_VER=28
TIS_PATCH_VER=29

50
tools/collector/scripts/collect_openstack.sh

@ -1,6 +1,6 @@
#! /bin/bash
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
# Copyright (c) 2013-2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -33,35 +33,29 @@ if [ "$nodetype" = "controller" ] ; then
exit 0
fi
delimiter ${LOGFILE} "openstack project list"
openstack project list >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "openstack user list"
openstack user list >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
MQ_STATUS="rabbitmqctl status"
delimiter ${LOGFILE} "${MQ_STATUS} | grep -e '{memory' -A30"
${MQ_STATUS} 2>/dev/null | grep -e '{memory' -A30 >> ${LOGFILE}
delimiter ${LOGFILE} "RabbitMQ Queue Info"
num_queues=$(rabbitmqctl list_queues | wc -l); ((num_queues-=2))
num_bindings=$(rabbitmqctl list_bindings | wc -l); ((num_bindings-=2))
num_exchanges=$(rabbitmqctl list_exchanges | wc -l); ((num_exchanges-=2))
num_connections=$(rabbitmqctl list_connections | wc -l); ((num_connections-=2))
num_channels=$(rabbitmqctl list_channels | wc -l); ((num_channels-=2))
arr=($(rabbitmqctl list_queues messages consumers memory | \
awk '/^[0-9]/ {a+=$1; b+=$2; c+=$3} END {print a, b, c}'))
messages=${arr[0]}; consumers=${arr[1]}; memory=${arr[2]}
printf "%6s %8s %9s %11s %8s %8s %9s %10s\n" "queues" "bindings" "exchanges" "connections" "channels" "messages" "consumers" "memory" >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
printf "%6d %8d %9d %11d %8d %8d %9d %10d\n" $num_queues $num_bindings $num_exchanges $num_connections $num_channels $messages $consumers $memory >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
if [ -e /opt/cgcs/ceilometer/pipeline.yaml ] ; then
cp /opt/cgcs/ceilometer/pipeline.yaml ${extradir}/ceilometer_pipeline.yaml
fi
delimiter ${LOGFILE} "openstack project list"
openstack project list >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "openstack user list"
openstack user list >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
MQ_STATUS="rabbitmqctl status"
delimiter ${LOGFILE} "${MQ_STATUS} | grep -e '{memory' -A30"
${MQ_STATUS} 2>/dev/null | grep -e '{memory' -A30 >> ${LOGFILE}
delimiter ${LOGFILE} "RabbitMQ Queue Info"
num_queues=$(rabbitmqctl list_queues | wc -l); ((num_queues-=2))
num_bindings=$(rabbitmqctl list_bindings | wc -l); ((num_bindings-=2))
num_exchanges=$(rabbitmqctl list_exchanges | wc -l); ((num_exchanges-=2))
num_connections=$(rabbitmqctl list_connections | wc -l); ((num_connections-=2))
num_channels=$(rabbitmqctl list_channels | wc -l); ((num_channels-=2))
arr=($(rabbitmqctl list_queues messages consumers memory | \
awk '/^[0-9]/ {a+=$1; b+=$2; c+=$3} END {print a, b, c}'))
messages=${arr[0]}; consumers=${arr[1]}; memory=${arr[2]}
printf "%6s %8s %9s %11s %8s %8s %9s %10s\n" "queues" "bindings" "exchanges" "connections" "channels" "messages" "consumers" "memory" >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
printf "%6d %8d %9d %11d %8d %8d %9d %10d\n" $num_queues $num_bindings $num_exchanges $num_connections $num_channels $messages $consumers $memory >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
fi
###############################################################################
# collect does not retrieve /etc/keystone dir
# Additional logic included to copy /etc/keystone directory

2
utilities/stx-extensions/centos/build_srpm.data

@ -1,2 +1,2 @@
SRC_DIR="files"
TIS_PATCH_VER=2
TIS_PATCH_VER=3

9
utilities/stx-extensions/centos/tis-extensions.spec

@ -41,11 +41,6 @@ TIS Extensions to thirdparty pkgs on controller
%build
%install
install -d -m 755 %{buildroot}%{local_etc_initd}
install -p -D -m 555 target %{buildroot}%{local_etc_initd}/target
install -d -m 755 %{buildroot}%{local_etc_systemd}
install -p -D -m 444 target.service %{buildroot}%{local_etc_systemd}/target.service
install -d -m 755 %{buildroot}%{local_etc_sysctl}
install -p -D -m 644 coredump-sysctl.conf %{buildroot}%{local_etc_sysctl}/50-coredump.conf
@ -63,7 +58,3 @@ install -p -D -m 644 modules-load-vfio.conf %{buildroot}%{local_etc_modload}/vfi
%{local_etc_modload}/vfio.conf
%doc LICENSE
%files -n %{name}-controller
%defattr(-,root,root,-)
%{local_etc_initd}/target
%{local_etc_systemd}/target.service

290
utilities/stx-extensions/files/target

@ -1,290 +0,0 @@
#!/bin/bash
#
# Filename: /etc/init.d/target
#
# Bring up/down iscsi LIO target
#
#########################################################################
#
#
# Copyright (c) 2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
DESC="target"
STATUS_FILE="/var/run/lio-target.running"
CINDER_CONF_DIR="/opt/cgcs/cinder"
LIO_CONF_DIR="${CINDER_CONF_DIR}/iscsi-target"
LIO_CONF_FILE="${LIO_CONF_DIR}/saveconfig.json"
TGT_CONF_FILE="${CINDER_CONF_DIR}/data/tgt-initiators-15.12-upgrade.conf"
BASE_TARGET_DIR="/etc/target"
# Tools
TARGETCLI="/usr/bin/targetcli"
RTSTOOL="/usr/bin/cinder-rtstool"
SM_QUERY="/usr/bin/sm-query"
# This will log to /var/log/platform.log
NAME=$(basename $0)
function log () {
logger -p local1.info "${NAME}: $1"
}
# Determine whether we are running on the active controller.
# Return value: 0 - controller is active, 1 - not active.
is_active_controller () {
# service drbd-cgcs - should be active before iscsi one
local SERVICE="drbd-cgcs"
local ACTIVE=$(${SM_QUERY} service ${SERVICE} | \
grep enabled-active)
if [ -z "${ACTIVE}" ] ; then
return 1
else
return 0
fi
}
# This is a function that migrates 15.12 TGT Target configuration
# to the LIO Target configuration file. The function is called only
# once on the first "swact" to the LIO controller after
# Software Upgrade.
migrate_tgt () {
log "Migrating 15.12 TGT iSCSI Target to LIO"
# TGT configuration directory
TGT_CONF_DIR="/opt/cgcs/cinder/data/volumes"
# Start the LIO target and enable it for configuration
/usr/bin/targetctl restore
if [ $? -ne 0 ] ; then
log "ERROR: trying to start the LIO target"
return 1
fi
if [ ! -d ${TGT_CONF_DIR} ] ; then
# User does not have attached volumes
log "No volumes to migrate. Migration is done"
return 0
fi
if [ ! "$(ls -A ${TGT_CONF_DIR})" ] ; then
# Cinder volumes configuration is empty
log "No volumes to migrate. Migration is done"
return 0
fi
PORTAL_IP=""
if [ -e /etc/hosts ] ; then
PORTAL_IP=$(grep controller-cinder /etc/hosts | awk '{print $1}')
fi
# If no Portal IP is specified, use default IP address
if [ -z "${PORTAL_IP}" ] ; then
PORTAL_IP="0.0.0.0"
fi
for volume in `find ${TGT_CONF_DIR} -name "volume-*"`
do
TARGET_NAME=$(grep -n target ${volume} | awk '{ print $2}' | \
sed 's/>//')
DEVICE=$(grep -n backing-store ${volume} | awk '{print $3}')
USERID=$(grep -n incominguser ${volume} | awk '{print $3}')
PASSWORD=$(grep -n incominguser ${volume} | awk '{print $4}')
INITIATOR=$(grep -n ${TARGET_NAME} ${TGT_CONF_FILE} | \
awk '{ print $5 }')
if [ ! "${TARGET_NAME}" -a "${DEVICE}" -a "${USERID}" -a \
"${PASSWORD}" -a "${INITIATOR}" ] ; then
log "ERROR: volume ${TARGET_NAME} configuration is not complete"
continue
fi
# Add the volume to the LIO configuration
${RTSTOOL} create ${DEVICE} ${TARGET_NAME} ${USERID} ${PASSWORD} \
False -a${PORTAL_IP} -p3260 2>/dev/null
if [ $? -ne 0 ] ; then
log "ERROR: Target creation failed for volume ${TARGET_NAME}"
continue
fi
log "Created target ${TARGET_NAME}"
${RTSTOOL} add-initiator ${TARGET_NAME} ${USERID} ${PASSWORD} \
${INITIATOR} 2>/dev/null
if [ $? -ne 0 ] ; then
log "ERROR: Add Initiator ${INITIATOR} failed for ${TARGET_NAME}"
continue
fi
log "Added Initiator ${INITIATOR} for ${TARGET_NAME}"
# Create a lun mapping from 1 to 0. Why? Well 15.12 used tgt which
# uses lun 1 as the first volume, but lio uses lun 0. This mapping
# allows iscsi references created in the old tgt realm to continue
# to work.
${TARGETCLI} "/iscsi/${TARGET_NAME}/tpg1/acls/${INITIATOR} create 1 0"
if [ $? -ne 0 ] ; then
log "ERROR: lun 1 mapping failed: Initiator ${INITIATOR} Target ${TARGET_NAME}"
else
log "Added lun 1 mapping: Initiator ${INITIATOR} Target ${TARGET_NAME}"
fi
done
# Save and verify the new LIO configuration
${RTSTOOL} save 2> /dev/null
if [ $? -ne 0 ] ; then
log "ERROR: Cannot save LIO Target configuration"
return 1
fi
${RTSTOOL} verify 2> /dev/null
if [ $? -ne 0 ] ; then
log "ERROR: LIO Target verification failed"
return 1
fi
log "TGT to LIO migration is done"
return 0
}
start () {
echo -n "Starting ${DESC}..."
if ! is_active_controller ; then
echo "failed. Controller is not active."
exit 1
fi
if [ ! -L ${BASE_TARGET_DIR} ] ; then
rm -rf ${BASE_TARGET_DIR}
ln -s ${LIO_CONF_DIR} ${BASE_TARGET_DIR}
fi
if [ ! -d ${LIO_CONF_DIR} ] ; then
# Create LIO configuration directory
mkdir -p ${LIO_CONF_DIR} && log "Created ${LIO_CONF_DIR}"
# Create default LIO configuration file
${TARGETCLI} saveconfig ${LIO_CONF_FILE}
fi
if [ -e ${TGT_CONF_FILE} -a -s ${TGT_CONF_FILE} ] ; then
migrate_tgt
if [ $? -ne 0 ] ; then
echo "tgt migration failed."
exit 1
fi
mv -f ${TGT_CONF_FILE} ${TGT_CONF_FILE}.bak
else
/usr/bin/targetctl restore
if [ $? -ne 0 ] ; then
echo "failed."
exit 1
fi
fi
touch ${STATUS_FILE}
echo "done."
}
stop () {
echo -n "Stopping ${DESC}..."
if [ ! -f ${STATUS_FILE} ] ; then
echo "service has not been started"
exit 0
fi
/usr/bin/targetctl clear
RET=$?
if [ -f ${STATUS_FILE} ] ; then
rm -f ${STATUS_FILE}
fi
if [ ${RET} -ne 0 ] ; then
echo "failed."
exit 1
fi
echo -n
}
status()
{
if [ ! -f ${STATUS_FILE} ] ; then
echo "${DESC} has not been started"
exit 3
else
echo "${DESC} had been started"
fi
}
restart () {
stop
start
}
reload()
{
if [ ! -f ${STATUS_FILE} ] ; then
echo "${DESC} has not been started"
exit 1
fi
/usr/bin/targetctl restore
if [ $? -ne 0 ] ; then
echo "failed."
exit 1
fi
}
case "$1" in
start)
start
;;
status)
status
;;
stop|forcedstop)
stop
;;
reload|force-reload)
reload
;;
restart|try-restart)
restart
;;
*)
echo $"Usage: $0 {start|status|stop|forcedstop|restart|try-restart|reload|force-reload}"
exit 1
;;
esac
exit 0

14
utilities/stx-extensions/files/target.service

@ -1,14 +0,0 @@
[Unit]
Description=iscsi LIO target service
After=config.service
[Service]
Type=oneshot
ExecStart=/etc/init.d/target
ExecStop=
ExecReload=
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save