Cinder container
Cinder is going to be split up into four containers. - cinder-api - cinder-scheduler - cinder-volume - cinder-backup Co-Authored-By: Daneyon Hansen <danehans@cisco.com> Co-Authored-By: Ian Main <imain@redhat.com> Implements: blueprint cinder-container Closes-bug: #1460136 Change-Id: I688471151ffa54d547b9aa0f2f2e2ea7f68f288d
This commit is contained in:
parent
0c5d6575ed
commit
793d68a29c
6
docker/centos/binary/cinder-app/cinder-api/Dockerfile
Normal file
6
docker/centos/binary/cinder-app/cinder-api/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%%
|
||||
MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
||||
|
||||
COPY ./start.sh ./check.sh /
|
||||
|
||||
CMD ["/start.sh"]
|
1
docker/centos/binary/cinder-app/cinder-api/build
Symbolic link
1
docker/centos/binary/cinder-app/cinder-api/build
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../tools/build-docker-image
|
16
docker/centos/binary/cinder-app/cinder-api/check.sh
Executable file
16
docker/centos/binary/cinder-app/cinder-api/check.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
RES=0
|
||||
|
||||
. /openrc
|
||||
if ! keystone token-get > /dev/null; then
|
||||
echo "ERROR: keystone token-get failed" >&2
|
||||
RES=1
|
||||
else
|
||||
if ! cinder list > /dev/null; then
|
||||
echo "ERROR: cinder list failed" >&2
|
||||
RES=1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $RES
|
73
docker/centos/binary/cinder-app/cinder-api/start.sh
Executable file
73
docker/centos/binary/cinder-app/cinder-api/start.sh
Executable file
@ -0,0 +1,73 @@
|
||||
#!/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_LOG_FILE CINDER_API_SERVICE_LISTEN \
|
||||
CINDER_API_SERVICE_PORT CINDER_API_SERVICE_LISTEN
|
||||
|
||||
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}/v1/\$(tenant_id)s" \
|
||||
-A "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v1/\$(tenant_id)s" \
|
||||
-I "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v1/\$(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 \
|
||||
"true"
|
||||
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
enable_v2_api \
|
||||
"true"
|
||||
|
||||
echo "Starting cinder-api"
|
||||
exec /usr/bin/cinder-api --config-file $cfg
|
6
docker/centos/binary/cinder-app/cinder-backup/Dockerfile
Normal file
6
docker/centos/binary/cinder-app/cinder-backup/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%%
|
||||
MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
||||
|
||||
COPY ./start.sh /start.sh
|
||||
|
||||
CMD ["/start.sh"]
|
1
docker/centos/binary/cinder-app/cinder-backup/build
Symbolic link
1
docker/centos/binary/cinder-app/cinder-backup/build
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../tools/build-docker-image
|
36
docker/centos/binary/cinder-app/cinder-backup/start.sh
Executable file
36
docker/centos/binary/cinder-app/cinder-backup/start.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/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}"
|
||||
|
||||
echo "Starting cinder-backup"
|
||||
exec /usr/bin/cinder-backup --config-file $cfg
|
@ -3,6 +3,5 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
||||
|
||||
RUN yum -y install openstack-cinder && yum clean all
|
||||
|
||||
ADD ./start.sh /start.sh
|
||||
CMD ["/start.sh"]
|
||||
COPY config-cinder.sh /opt/kolla/config-cinder.sh
|
||||
|
1
docker/centos/binary/cinder-app/cinder-base/build
Symbolic link
1
docker/centos/binary/cinder-app/cinder-base/build
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../tools/build-docker-image
|
132
docker/centos/binary/cinder-app/cinder-base/config-cinder.sh
Normal file
132
docker/centos/binary/cinder-app/cinder-base/config-cinder.sh
Normal file
@ -0,0 +1,132 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. /opt/kolla/kolla-common.sh
|
||||
|
||||
check_required_vars CINDER_DB_PASSWORD CINDER_KEYSTONE_PASSWORD \
|
||||
KEYSTONE_PUBLIC_SERVICE_HOST RABBITMQ_SERVICE_HOST \
|
||||
GLANCE_API_SERVICE_HOST MARIADB_SERVICE_HOST \
|
||||
RABBITMQ_SERVICE_HOST RABBITMQ_SERVICE_PORT \
|
||||
RABBIT_USERID RABBIT_PASSWORD GLANCE_API_SERVICE_HOST \
|
||||
GLANCE_API_SERVICE_PORT ADMIN_TENANT_NAME \
|
||||
CINDER_DB_NAME CINDER_DB_USER CINDER_KEYSTONE_USER \
|
||||
PUBLIC_IP KEYSTONE_AUTH_PROTOCOL CINDER_LOG_DIR
|
||||
|
||||
dump_vars
|
||||
|
||||
cat > /openrc <<EOF
|
||||
export OS_AUTH_URL="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0"
|
||||
export OS_USERNAME="${CINDER_KEYSTONE_USER}"
|
||||
export OS_PASSWORD="${CINDER_KEYSTONE_PASSWORD}"
|
||||
export OS_TENANT_NAME="${ADMIN_TENANT_NAME}"
|
||||
EOF
|
||||
|
||||
cfg=/etc/cinder/cinder.conf
|
||||
|
||||
# Logging
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
log_dir \
|
||||
"${CINDER_LOG_DIR}"
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
verbose \
|
||||
"${VERBOSE_LOGGING}"
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
debug \
|
||||
"${DEBUG_LOGGING}"
|
||||
|
||||
# backend
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
rpc_backend \
|
||||
"cinder.openstack.common.rpc.impl_kombu"
|
||||
|
||||
# rabbit
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
rabbit_host \
|
||||
"${RABBITMQ_SERVICE_HOST}"
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
rabbit_port \
|
||||
"${RABBITMQ_SERVICE_PORT}"
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
rabbit_hosts \
|
||||
"${RABBITMQ_SERVICE_HOST}:${RABBITMQ_SERVICE_PORT}"
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
rabbit_userid \
|
||||
"${RABBIT_USERID}"
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
rabbit_password \
|
||||
"${RABBIT_PASSWORD}"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_virtual_host \
|
||||
"/"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_ha_queues \
|
||||
"False"
|
||||
|
||||
# control_exchange
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
control_exchange \
|
||||
"openstack"
|
||||
|
||||
# glance
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
glance_host \
|
||||
"${GLANCE_API_SERVICE_HOST}"
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
glance_port \
|
||||
"${GLANCE_API_SERVICE_PORT}"
|
||||
|
||||
# database
|
||||
crudini --set $cfg \
|
||||
database \
|
||||
connection \
|
||||
"mysql://${CINDER_DB_USER}:${CINDER_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${CINDER_DB_NAME}"
|
||||
|
||||
# keystone
|
||||
crudini --set $cfg \
|
||||
DEFAULT \
|
||||
auth_strategy \
|
||||
"keystone"
|
||||
crudini --del $cfg \
|
||||
keystone_authtoken \
|
||||
auth_protocol
|
||||
crudini --del $cfg \
|
||||
keystone_authtoken \
|
||||
auth_host
|
||||
crudini --del $cfg \
|
||||
keystone_authtoken \
|
||||
auth_port
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
auth_uri \
|
||||
"${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0"
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
identity_uri \
|
||||
"${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}"
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
admin_tenant_name \
|
||||
"${ADMIN_TENANT_NAME}"
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
admin_user \
|
||||
"${CINDER_KEYSTONE_USER}"
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
admin_password \
|
||||
"${CINDER_KEYSTONE_PASSWORD}"
|
@ -0,0 +1,6 @@
|
||||
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%%
|
||||
MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
||||
|
||||
ADD ./start.sh /start.sh
|
||||
|
||||
CMD ["/start.sh"]
|
1
docker/centos/binary/cinder-app/cinder-scheduler/build
Symbolic link
1
docker/centos/binary/cinder-app/cinder-scheduler/build
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../tools/build-docker-image
|
32
docker/centos/binary/cinder-app/cinder-scheduler/start.sh
Executable file
32
docker/centos/binary/cinder-app/cinder-scheduler/start.sh
Executable 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 \
|
||||
CINDER_SCHEDULER_LOG_FILE 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
|
17
docker/centos/binary/cinder-app/cinder-volume/Dockerfile
Normal file
17
docker/centos/binary/cinder-app/cinder-volume/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%%
|
||||
MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
||||
|
||||
# Install required packages
|
||||
# https://bugs.launchpad.net/kolla/+bug/1460129
|
||||
# Iscsi will be removed from cinder-volume in a later patch
|
||||
# so that we continue to follow the container best practices.
|
||||
# There will also be other backends for cinder and iscsi should
|
||||
# not be hardcoded here.
|
||||
RUN yum install -y lvm2 scsi-target-utils && yum clean all
|
||||
|
||||
# Add start scripts
|
||||
COPY start.sh /start.sh
|
||||
COPY volume-group-create.sh /opt/kolla/volume-group-create.sh
|
||||
|
||||
# Start supervisor
|
||||
CMD ["/start.sh"]
|
1
docker/centos/binary/cinder-app/cinder-volume/build
Symbolic link
1
docker/centos/binary/cinder-app/cinder-volume/build
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../tools/build-docker-image
|
75
docker/centos/binary/cinder-app/cinder-volume/start.sh
Executable file
75
docker/centos/binary/cinder-app/cinder-volume/start.sh
Executable file
@ -0,0 +1,75 @@
|
||||
#!/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 CINDER_VOLUME_LOG_FILE
|
||||
|
||||
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
|
||||
|
||||
echo "Starting cinder-volume"
|
||||
exec /usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf
|
22
docker/centos/binary/cinder-app/cinder-volume/volume-group-create.sh
Executable file
22
docker/centos/binary/cinder-app/cinder-volume/volume-group-create.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The script will create the cinder-volume volume group that will
|
||||
# allow cinder to create volumes from a backing file.
|
||||
# This is based off devstack.
|
||||
set -e
|
||||
|
||||
backing_file=/opt/data/cinder_volume
|
||||
|
||||
check_required_vars CINDER_LVM_LO_VOLUME_SIZE CINDER_VOLUME_GROUP
|
||||
|
||||
if ! vgs ${CINDER_VOLUME_GROUP}; then
|
||||
[[ ! -f $backing_file ]] && truncate -s ${CINDER_LVM_LO_VOLUMES_SIZE} $backing_file
|
||||
vg_dev=`losetup -f --show $backing_file`
|
||||
if ! vgs ${CINDER_VOLUME_GROUP}; then
|
||||
vgcreate ${CINDER_VOLUME_GROUP} $vg_dev
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove iscsi targets
|
||||
cinder-rtstool get-targets | xargs -rn 1 cinder-rtstool delete
|
||||
|
9
docker/centos/binary/cinder-data/Dockerfile
Normal file
9
docker/centos/binary/cinder-data/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%%
|
||||
MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
||||
|
||||
RUN mkdir -p /opt/data
|
||||
VOLUME [ "/opt/data" ]
|
||||
|
||||
# Command needed to start the data container.
|
||||
# Note: data containers do not need to be persistent.
|
||||
CMD ["/bin/true"]
|
@ -1,145 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
: ${CINDER_DB_USER:=cinder}
|
||||
: ${CINDER_DB_NAME:=cinder}
|
||||
: ${KEYSTONE_AUTH_PROTOCOL:=http}
|
||||
: ${CINDER_KEYSTONE_USER:=cinder}
|
||||
: ${ADMIN_TENANT_NAME:=admin}
|
||||
|
||||
if ! [ "$CINDER_DB_PASSWORD" ]; then
|
||||
CINDER_DB_PASSWORD=$(openssl rand -hex 15)
|
||||
export CINDER_DB_PASSWORD
|
||||
fi
|
||||
|
||||
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
|
||||
CINDER_ADMIN_PASSWORD
|
||||
fail_unless_db
|
||||
|
||||
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 glance* TO
|
||||
'${CINDER_DB_USER}'@'%' IDENTIFIED BY '${CINDER_DB_PASSWORD}'
|
||||
EOF
|
||||
|
||||
#-----Cinder.conf setup-----
|
||||
|
||||
# Cinder database
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
db_driver \
|
||||
"cinder.db"
|
||||
|
||||
# Rabbit
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_host \
|
||||
"127.0.0.1"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_port \
|
||||
"5672"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_hosts \
|
||||
"127.0.0.1:5672"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_userid \
|
||||
"guest"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_password \
|
||||
"guest"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_virtual_host \
|
||||
"/"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rabbit_ha_queues \
|
||||
"False"
|
||||
|
||||
# backend
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
rpc_backend \
|
||||
"cinder.openstack.common.rpc.impl_kombu"
|
||||
|
||||
# control_exchange
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
control_exchange \
|
||||
"openstack"
|
||||
|
||||
# osapi
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
osapi_volume_listen \
|
||||
"0.0.0.0"
|
||||
|
||||
# api_paste_config
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFUALT \
|
||||
api_paste_config \
|
||||
"/etc/cinder/api-paste.ini"
|
||||
|
||||
# auth_strategy
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFUALT \
|
||||
auth_strategy \
|
||||
"keystone"
|
||||
|
||||
# debug
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
debug \
|
||||
"False"
|
||||
|
||||
# verbose
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
verbose \
|
||||
"True"
|
||||
|
||||
# logs
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
log_dir \
|
||||
"/var/log/cinder/"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
log_file \
|
||||
"/var/log/cinder/cinder.log"
|
||||
|
||||
# use_sysloge
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
use_syslog \
|
||||
"False"
|
||||
|
||||
# iscsi
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
iscsi_ip_address \
|
||||
"127.0.0.1"
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
iscsi_helper \
|
||||
"tgtadm"
|
||||
|
||||
# volume_group
|
||||
crudini --set /etc/cinder/cinder.conf \
|
||||
DEFAULT \
|
||||
volume_group \
|
||||
"cinder-volumes"
|
||||
|
||||
|
||||
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
|
||||
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0"
|
||||
|
||||
/bin/keystone user-create --name ${CINDER_KEYSTONE_USER} --pass ${CINDER_ADMIN_PASSWORD}
|
||||
/bin/keystone role-create --name ${CINDER_KEYSTONE_USER}
|
||||
/bin/keystone user-role-add --user ${CINDER_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME}
|
||||
|
||||
exec /usr/bin/cinder-all
|
||||
|
Loading…
Reference in New Issue
Block a user