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
|
||||
|
||||
: ${NOVA_DB_USER:=nova}
|
||||
: ${NOVA_DB_NAME:=nova}
|
||||
: ${KEYSTONE_AUTH_PROTOCOL:=http}
|
||||
. /opt/kolla/kolla-common.sh
|
||||
|
||||
: ${NOVA_KEYSTONE_USER:=nova}
|
||||
: ${ADMIN_TENANT_NAME:=admin}
|
||||
|
||||
if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then
|
||||
echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2
|
||||
exit 1
|
||||
fi
|
||||
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_SERVICE_HOST
|
||||
|
||||
if ! [ "$DB_ROOT_PASSWORD" ]; then
|
||||
echo "*** Missing DB_ROOT_PASSWORD" >&2
|
||||
exit 1
|
||||
fi
|
||||
cfg=/etc/nova/nova.conf
|
||||
|
||||
if ! [ "$NOVA_DB_PASSWORD" ]; then
|
||||
NOVA_DB_PASSWORD=$(openssl rand -hex 15)
|
||||
export NOVA_DB_PASSWORD
|
||||
fi
|
||||
crudini --set $cfg DEFAULT admin_token "${KEYSTONE_ADMIN_TOKEN}"
|
||||
crudini --sel $cfg DEFAULT log_file ""
|
||||
crudini --del $cfg DEFAULT log_dir
|
||||
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 \
|
||||
-p${DB_ROOT_PASSWORD} mysql <<EOF
|
||||
CREATE DATABASE IF NOT EXISTS ${NOVA_DB_NAME};
|
||||
GRANT ALL PRIVILEGES ON nova* TO
|
||||
'${NOVA_DB_USER}'@'%' IDENTIFIED BY '${NOVA_DB_PASSWORD}'
|
||||
EOF
|
||||
for option in auth_protocol auth_host auth_port; do
|
||||
crudini --del $cfg \
|
||||
keystone_authtoken \
|
||||
$option
|
||||
done
|
||||
|
||||
crudini --set /etc/nova/nova database connection \
|
||||
"mysql://nova:${NOVA_DB_PASSWORD}@${MARIADB_PORT_3306_TCP_ADDR}:${MARIADB_PORT_3306_TCP_PORT}/nova"
|
||||
crudini --set /etc/nova/nova DEFAULT admin_token "${KEYSTONE_ADMIN_TOKEN}"
|
||||
crudini --del /etc/nova/nova DEFAULT log_file
|
||||
crudini --del /etc/nova/nova DEFAULT log_dir
|
||||
crudini --set /etc/nova/nova DEFAULT use_stderr True
|
||||
crudini --set /etc/keystone/keystone.conf libvirt connection_uri qemu+tcp://${NOVA_PORT_16509_TCP_PORT}/system
|
||||
|
||||
/usr/bin/nova-manage db_sync
|
||||
|
||||
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
|
||||
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_PORT_35357_TCP_ADDR}:35357/v2.0"
|
||||
|
||||
/usr/bin/keystone user-create --name ${NOVA_KEYSTONE_USER} --pass ${NOVA_ADMIN_PASSWORD}
|
||||
/usr/bin/keystone role-create --name ${NOVA_KEYSTONE_USER}
|
||||
/usr/bin/keystone user-role-add --user ${NOVA_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME}
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
auth_uri \
|
||||
"http://${KEYSTONE_SERVICE_HOST}:5000/"
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
admin_tenant_name \
|
||||
"${ADMIN_TENANT_NAME}"
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
admin_user \
|
||||
"${NOVA_KEYSTONE_USER}"
|
||||
crudini --set $cfg \
|
||||
keystone_authtoken \
|
||||
admin_password \
|
||||
"${NOVA_KEYSTONE_PASSWORD}"
|
||||
|
||||
exec /usr/bin/nova-compute
|
||||
|
Loading…
Reference in New Issue
Block a user