Merge "Add config-internal/config-external for cinder"

This commit is contained in:
Jenkins 2015-07-08 14:22:33 +00:00 committed by Gerrit Code Review
commit fb7ced9cea
24 changed files with 321 additions and 208 deletions

View File

@ -2,6 +2,7 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y python-keystone && yum clean all
COPY config-internal.sh config-external.sh /opt/kolla/
COPY ./start.sh ./check.sh /
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-api/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-api/config-internal.sh

View File

@ -2,5 +2,6 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
COPY ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-backup/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-backup/config-internal.sh

View File

@ -2,5 +2,6 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
ADD ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-scheduler/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-scheduler/config-internal.sh

View File

@ -11,6 +11,7 @@ RUN yum install -y lvm2 scsi-target-utils && yum clean all
# Add start scripts
COPY start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
COPY volume-group-create.sh /opt/kolla/volume-group-create.sh
# Start supervisor

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-volume/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-volume/config-internal.sh

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/cinder/cinder.conf"
TARGET="/etc/cinder/cinder.conf"
OWNER="cinder"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,71 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-cinder.sh
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
ADMIN_TENANT_NAME PUBLIC_IP CINDER_API_SERVICE_HOST \
KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_PORT \
CINDER_KEYSTONE_USER CINDER_KEYSTONE_PASSWORD \
CINDER_API_SERVICE_LISTEN CINDER_API_SERVICE_PORT
fail_unless_os_service_running keystone
cfg=/etc/cinder/cinder.conf
# Set the auth credentials
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0"
# Create Keystone User
crux user-create --update \
-n "${CINDER_KEYSTONE_USER}" \
-p "${CINDER_KEYSTONE_PASSWORD}" \
-t "${ADMIN_TENANT_NAME}" \
-r admin
# Configure Keystone
crux endpoint-create --remove-all \
-n cinder \
-t volume \
-P "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \
-A "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \
-I "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s"
crux endpoint-create --remove-all \
-n cinderv2 \
-t volumev2 \
-P "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \
-A "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \
-I "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s"
# Logging
crudini --set $cfg \
DEFAULT \
log_file \
"${CINDER_API_LOG_FILE}"
# API Configuration
crudini --set $cfg \
DEFAULT \
osapi_volume_listen \
"${CINDER_API_SERVICE_LISTEN}"
crudini --set $cfg \
DEFAULT \
osapi_volume_listen_port \
"${CINDER_API_SERVICE_PORT}"
crudini --set $cfg \
DEFAULT \
enable_v1_api \
"false"
crudini --set $cfg \
DEFAULT \
enable_v2_api \
"true"
echo "Starting cinder-api"
exec /usr/bin/cinder-api --config-file $cfg

View File

@ -1,72 +1,21 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-cinder.sh
CMD="/usr/bin/cinder-api"
ARGS=""
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
ADMIN_TENANT_NAME PUBLIC_IP CINDER_API_SERVICE_HOST \
KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_PORT \
CINDER_KEYSTONE_USER CINDER_KEYSTONE_PASSWORD \
CINDER_API_SERVICE_LISTEN CINDER_API_SERVICE_PORT
# Loading common functions.
source /opt/kolla/kolla-common.sh
fail_unless_os_service_running keystone
# Config-internal script exec out of this function, it does not return here.
set_configs
cfg=/etc/cinder/cinder.conf
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
su -s /bin/sh -c "cinder-manage db_sync" cinder
exit 0
fi
# Set the auth credentials
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0"
# Create Keystone User
crux user-create --update \
-n "${CINDER_KEYSTONE_USER}" \
-p "${CINDER_KEYSTONE_PASSWORD}" \
-t "${ADMIN_TENANT_NAME}" \
-r admin
# Configure Keystone
crux endpoint-create --remove-all \
-n cinder \
-t volume \
-P "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \
-A "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \
-I "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s"
crux endpoint-create --remove-all \
-n cinderv2 \
-t volumev2 \
-P "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \
-A "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \
-I "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s"
# Logging
crudini --set $cfg \
DEFAULT \
log_file \
"${CINDER_API_LOG_FILE}"
# API Configuration
crudini --set $cfg \
DEFAULT \
osapi_volume_listen \
"${CINDER_API_SERVICE_LISTEN}"
crudini --set $cfg \
DEFAULT \
osapi_volume_listen_port \
"${CINDER_API_SERVICE_PORT}"
crudini --set $cfg \
DEFAULT \
enable_v1_api \
"false"
crudini --set $cfg \
DEFAULT \
enable_v2_api \
"true"
echo "Starting cinder-api"
exec /usr/bin/cinder-api --config-file $cfg
exec $CMD $ARGS

View File

@ -0,0 +1,9 @@
OURCE="/opt/kolla/cinder/cinder.conf"
TARGET="/etc/cinder/cinder.conf"
OWNER="cinder"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,45 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-cinder.sh
check_required_vars CINDER_BACKUP_DRIVER CINDER_BACKUP_MANAGER \
CINDER_BACKUP_API_CLASS CINDER_BACKUP_NAME_TEMPLATE
cfg=/etc/cinder/cinder.conf
# volume backup configuration
crudini --set $cfg \
DEFAULT \
backup_driver \
"${CINDER_BACKUP_DRIVER}"
crudini --set $cfg \
DEFAULT \
backup_topic \
"cinder-backup"
crudini --set $cfg \
DEFAULT \
backup_manager \
"${CINDER_BACKUP_MANAGER}"
crudini --set $cfg \
DEFAULT \
backup_api_class \
"${CINDER_BACKUP_API_CLASS}"
crudini --set $cfg \
DEFAULT \
backup_name_template \
"${CINDER_BACKUP_NAME_TEMPLATE}"
# https://bugs.launchpad.net/kolla/+bug/1461635
# Cinder requires mounting /dev in the cinder-volume, nova-compute,
# and libvirt containers. If /dev/pts/ptmx does not have proper permissions
# on the host, then libvirt will fail to boot an instance.
# This is a bug in Docker where it is not correctly mounting /dev/pts
# Tech Debt tracker: https://bugs.launchpad.net/kolla/+bug/1468962
# **Temporary fix**
chmod 666 /dev/pts/ptmx
echo "Starting cinder-backup"
exec /usr/bin/cinder-backup --config-file $cfg

View File

@ -1,45 +1,14 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-cinder.sh
CMD="/usr/bin/cinder-backup"
ARGS=""
check_required_vars CINDER_BACKUP_DRIVER CINDER_BACKUP_MANAGER \
CINDER_BACKUP_API_CLASS CINDER_BACKUP_NAME_TEMPLATE
# Loading common functions.
source /opt/kolla/kolla-common.sh
cfg=/etc/cinder/cinder.conf
# Config-internal script exec out of this function, it does not return here.
set_configs
# volume backup configuration
crudini --set $cfg \
DEFAULT \
backup_driver \
"${CINDER_BACKUP_DRIVER}"
crudini --set $cfg \
DEFAULT \
backup_topic \
"cinder-backup"
crudini --set $cfg \
DEFAULT \
backup_manager \
"${CINDER_BACKUP_MANAGER}"
crudini --set $cfg \
DEFAULT \
backup_api_class \
"${CINDER_BACKUP_API_CLASS}"
crudini --set $cfg \
DEFAULT \
backup_name_template \
"${CINDER_BACKUP_NAME_TEMPLATE}"
# https://bugs.launchpad.net/kolla/+bug/1461635
# Cinder requires mounting /dev in the cinder-volume, nova-compute,
# and libvirt containers. If /dev/pts/ptmx does not have proper permissions
# on the host, then libvirt will fail to boot an instance.
# This is a bug in Docker where it is not correctly mounting /dev/pts
# Tech Debt tracker: https://bugs.launchpad.net/kolla/+bug/1468962
# **Temporary fix**
chmod 666 /dev/pts/ptmx
echo "Starting cinder-backup"
exec /usr/bin/cinder-backup --config-file $cfg
exec $CMD $ARGS

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/cinder/cinder.conf"
TARGET="/etc/cinder/cinder.conf"
OWNER="cinder"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,32 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-cinder.sh
fail_unless_db
check_required_vars MARIADB_SERVICE_HOST DB_ROOT_PASSWORD \
CINDER_DB_NAME CINDER_DB_USER CINDER_DB_PASSWORD \
INIT_CINDER_DB
cfg=/etc/cinder/cinder.conf
if [ "${INIT_CINDER_DB}" == "true" ]; then
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${CINDER_DB_NAME};
GRANT ALL PRIVILEGES ON ${CINDER_DB_NAME}.* TO
'${CINDER_DB_USER}'@'%' IDENTIFIED BY '${CINDER_DB_PASSWORD}'
EOF
su -s /bin/sh -c "cinder-manage db sync" cinder
fi
crudini --set $cfg \
DEFAULT \
log_file \
"${CINDER_SCHEDULER_LOG_FILE}"
echo "Starting cinder-scheduler"
exec /usr/bin/cinder-scheduler --config-file $cfg

View File

@ -1,32 +1,14 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-cinder.sh
CMD="/usr/bin/cinder-scheduler"
ARGS=""
fail_unless_db
# Loading common functions.
source /opt/kolla/kolla-common.sh
check_required_vars MARIADB_SERVICE_HOST DB_ROOT_PASSWORD \
CINDER_DB_NAME CINDER_DB_USER CINDER_DB_PASSWORD \
INIT_CINDER_DB
# Config-internal script exec out of this function, it does not return here.
set_configs
cfg=/etc/cinder/cinder.conf
if [ "${INIT_CINDER_DB}" == "true" ]; then
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${CINDER_DB_NAME};
GRANT ALL PRIVILEGES ON ${CINDER_DB_NAME}.* TO
'${CINDER_DB_USER}'@'%' IDENTIFIED BY '${CINDER_DB_PASSWORD}'
EOF
su -s /bin/sh -c "cinder-manage db sync" cinder
fi
crudini --set $cfg \
DEFAULT \
log_file \
"${CINDER_SCHEDULER_LOG_FILE}"
echo "Starting cinder-scheduler"
exec /usr/bin/cinder-scheduler --config-file $cfg
exec $CMD $ARGS

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/cinder/cinder.conf"
TARGET="/etc/cinder/cinder.conf"
OWNER="cinder"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,84 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-cinder.sh
. /opt/kolla/volume-group-create.sh
check_required_vars CINDER_VOLUME_API_LISTEN ISCSI_HELPER ISCSI_IP_ADDRESS \
CINDER_VOLUME_GROUP CINDER_LVM_LO_VOLUME_SIZE \
CINDER_VOLUME_BACKEND_NAME CINDER_VOLUME_DRIVER \
CINDER_ENABLED_BACKEND
cfg=/etc/cinder/cinder.conf
# Logging
crudini --set $cfg \
DEFAULT \
log_file \
"${CINDER_VOLUME_LOG_FILE}"
# IP address on which OpenStack Volume API listens
crudini --set $cfg \
DEFAULT \
osapi_volume_listen \
"${CINDER_VOLUME_API_LISTEN}"
# The IP address that the iSCSI daemon is listening on
crudini --set $cfg \
DEFAULT \
iscsi_ip_address \
"${ISCSI_IP_ADDRESS}"
# Set to false when using loopback devices (testing)
crudini --set $cfg \
DEFAULT \
secure_delete \
"false"
crudini --set $cfg \
DEFAULT \
enabled_backends \
"${CINDER_ENABLED_BACKEND}"
crudini --set $cfg \
lvm57 \
iscsi_helper \
"${ISCSI_HELPER}"
crudini --set $cfg \
lvm57 \
volume_group \
"${CINDER_VOLUME_GROUP}"
crudini --set $cfg \
lvm57 \
volume_driver \
"${CINDER_VOLUME_DRIVER}"
crudini --set $cfg \
lvm57 \
iscsi_ip_address \
"${ISCSI_IP_ADDRESS}"
crudini --set $cfg \
lvm57 \
volume_backend_name \
"${CINDER_VOLUME_BACKEND_NAME}"
sed -i 's/udev_sync = 1/udev_sync = 0/' /etc/lvm/lvm.conf
sed -i 's/udev_rules = 1/udev_rules = 0/' /etc/lvm/lvm.conf
sed -i 's/use_lvmetad = 1/use_lvmetad = 0/' /etc/lvm/lvm.conf
# https://bugs.launchpad.net/kolla/+bug/1461635
# Cinder requires mounting /dev in the cinder-volume, nova-compute,
# and libvirt containers. If /dev/pts/ptmx does not have proper permissions
# on the host, then libvirt will fail to boot an instance.
# This is a bug in Docker where it is not correctly mounting /dev/pts
# Tech Debt tracker: https://bugs.launchpad.net/kolla/+bug/1468962
# **Temporary fix**
chmod 666 /dev/pts/ptmx
echo "Starting cinder-volume"
exec /usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf

View File

@ -1,84 +1,14 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-cinder.sh
. /opt/kolla/volume-group-create.sh
CMD="/usr/bin/cinder-volume"
ARGS=""
check_required_vars CINDER_VOLUME_API_LISTEN ISCSI_HELPER ISCSI_IP_ADDRESS \
CINDER_VOLUME_GROUP CINDER_LVM_LO_VOLUME_SIZE \
CINDER_VOLUME_BACKEND_NAME CINDER_VOLUME_DRIVER \
CINDER_ENABLED_BACKEND
# Loading common functions.
source /opt/kolla/kolla-common.sh
cfg=/etc/cinder/cinder.conf
# Config-internal script exec out of this function, it does not return here.
set_configs
# Logging
crudini --set $cfg \
DEFAULT \
log_file \
"${CINDER_VOLUME_LOG_FILE}"
# IP address on which OpenStack Volume API listens
crudini --set $cfg \
DEFAULT \
osapi_volume_listen \
"${CINDER_VOLUME_API_LISTEN}"
# The IP address that the iSCSI daemon is listening on
crudini --set $cfg \
DEFAULT \
iscsi_ip_address \
"${ISCSI_IP_ADDRESS}"
# Set to false when using loopback devices (testing)
crudini --set $cfg \
DEFAULT \
secure_delete \
"false"
crudini --set $cfg \
DEFAULT \
enabled_backends \
"${CINDER_ENABLED_BACKEND}"
crudini --set $cfg \
lvm57 \
iscsi_helper \
"${ISCSI_HELPER}"
crudini --set $cfg \
lvm57 \
volume_group \
"${CINDER_VOLUME_GROUP}"
crudini --set $cfg \
lvm57 \
volume_driver \
"${CINDER_VOLUME_DRIVER}"
crudini --set $cfg \
lvm57 \
iscsi_ip_address \
"${ISCSI_IP_ADDRESS}"
crudini --set $cfg \
lvm57 \
volume_backend_name \
"${CINDER_VOLUME_BACKEND_NAME}"
sed -i 's/udev_sync = 1/udev_sync = 0/' /etc/lvm/lvm.conf
sed -i 's/udev_rules = 1/udev_rules = 0/' /etc/lvm/lvm.conf
sed -i 's/use_lvmetad = 1/use_lvmetad = 0/' /etc/lvm/lvm.conf
# https://bugs.launchpad.net/kolla/+bug/1461635
# Cinder requires mounting /dev in the cinder-volume, nova-compute,
# and libvirt containers. If /dev/pts/ptmx does not have proper permissions
# on the host, then libvirt will fail to boot an instance.
# This is a bug in Docker where it is not correctly mounting /dev/pts
# Tech Debt tracker: https://bugs.launchpad.net/kolla/+bug/1468962
# **Temporary fix**
chmod 666 /dev/pts/ptmx
echo "Starting cinder-volume"
exec /usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf
exec $CMD $ARGS