do not perform database or keystone setup in nova-compute
- do not perform database or keystone initialization in nova-compute image (these should happen in the controller images). - fix incorrect nova.conf path - configure keystone_authtoken correct NB: This still won't result in a working image, because it does not configure the RPC settings yet. That will be for a subsequent patch. Change-Id: Icbd66104ef817d360c46003b29fff63f66ace8d2
This commit is contained in:
parent
4ab92d26e6
commit
20e88776bc
@ -1,48 +1,44 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
: ${NOVA_DB_USER:=nova}
|
. /opt/kolla/kolla-common.sh
|
||||||
: ${NOVA_DB_NAME:=nova}
|
|
||||||
: ${KEYSTONE_AUTH_PROTOCOL:=http}
|
|
||||||
: ${NOVA_KEYSTONE_USER:=nova}
|
: ${NOVA_KEYSTONE_USER:=nova}
|
||||||
: ${ADMIN_TENANT_NAME:=admin}
|
: ${ADMIN_TENANT_NAME:=admin}
|
||||||
|
|
||||||
if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then
|
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_SERVICE_HOST
|
||||||
echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ "$DB_ROOT_PASSWORD" ]; then
|
cfg=/etc/nova/nova.conf
|
||||||
echo "*** Missing DB_ROOT_PASSWORD" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ "$NOVA_DB_PASSWORD" ]; then
|
crudini --set $cfg DEFAULT admin_token "${KEYSTONE_ADMIN_TOKEN}"
|
||||||
NOVA_DB_PASSWORD=$(openssl rand -hex 15)
|
crudini --sel $cfg DEFAULT log_file ""
|
||||||
export NOVA_DB_PASSWORD
|
crudini --del $cfg DEFAULT log_dir
|
||||||
fi
|
crudini --set $cfg DEFAULT use_stderr True
|
||||||
|
crudini --set $cfg \
|
||||||
|
libvirt \
|
||||||
|
connection_uri \
|
||||||
|
"qemu+tcp://${NOVA_PORT_16509_TCP_PORT}/system"
|
||||||
|
|
||||||
mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \
|
for option in auth_protocol auth_host auth_port; do
|
||||||
-p${DB_ROOT_PASSWORD} mysql <<EOF
|
crudini --del $cfg \
|
||||||
CREATE DATABASE IF NOT EXISTS ${NOVA_DB_NAME};
|
keystone_authtoken \
|
||||||
GRANT ALL PRIVILEGES ON nova* TO
|
$option
|
||||||
'${NOVA_DB_USER}'@'%' IDENTIFIED BY '${NOVA_DB_PASSWORD}'
|
done
|
||||||
EOF
|
|
||||||
|
|
||||||
crudini --set /etc/nova/nova database connection \
|
crudini --set $cfg \
|
||||||
"mysql://nova:${NOVA_DB_PASSWORD}@${MARIADB_PORT_3306_TCP_ADDR}:${MARIADB_PORT_3306_TCP_PORT}/nova"
|
keystone_authtoken \
|
||||||
crudini --set /etc/nova/nova DEFAULT admin_token "${KEYSTONE_ADMIN_TOKEN}"
|
auth_uri \
|
||||||
crudini --del /etc/nova/nova DEFAULT log_file
|
"http://${KEYSTONE_SERVICE_HOST}:5000/"
|
||||||
crudini --del /etc/nova/nova DEFAULT log_dir
|
crudini --set $cfg \
|
||||||
crudini --set /etc/nova/nova DEFAULT use_stderr True
|
keystone_authtoken \
|
||||||
crudini --set /etc/keystone/keystone.conf libvirt connection_uri qemu+tcp://${NOVA_PORT_16509_TCP_PORT}/system
|
admin_tenant_name \
|
||||||
|
"${ADMIN_TENANT_NAME}"
|
||||||
/usr/bin/nova-manage db_sync
|
crudini --set $cfg \
|
||||||
|
keystone_authtoken \
|
||||||
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
|
admin_user \
|
||||||
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_PORT_35357_TCP_ADDR}:35357/v2.0"
|
"${NOVA_KEYSTONE_USER}"
|
||||||
|
crudini --set $cfg \
|
||||||
/usr/bin/keystone user-create --name ${NOVA_KEYSTONE_USER} --pass ${NOVA_ADMIN_PASSWORD}
|
keystone_authtoken \
|
||||||
/usr/bin/keystone role-create --name ${NOVA_KEYSTONE_USER}
|
admin_password \
|
||||||
/usr/bin/keystone user-role-add --user ${NOVA_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME}
|
"${NOVA_KEYSTONE_PASSWORD}"
|
||||||
|
|
||||||
exec /usr/bin/nova-compute
|
exec /usr/bin/nova-compute
|
||||||
|
Loading…
Reference in New Issue
Block a user