From 6b418fb30cbbeb434145e36249931c917e18ca09 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Wed, 18 Jun 2014 11:13:40 +0200 Subject: [PATCH] Set up keystone databases This script sets up MySQL databases for keystone, glance, neutron, nova, and cinder. The script is just a sample implementation. Depending on how the training-guides are structured, it may be better to have a function that can be called in service-specific scripts to create the database they need. Partial-Bug: 1312764 Implements: blueprint openstack-training-labs Change-Id: Iaeca8e637c53a6b91d12915c8855b5b53639afd1 --- labs/scripts/setup_keystonedb.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 labs/scripts/setup_keystonedb.sh diff --git a/labs/scripts/setup_keystonedb.sh b/labs/scripts/setup_keystonedb.sh new file mode 100644 index 00000000..61fe100e --- /dev/null +++ b/labs/scripts/setup_keystonedb.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +TOP_DIR=$(cd $(dirname "$0")/.. && pwd) +source "$TOP_DIR/config/paths" +source "$CONFIG_DIR/credentials" +source "$LIB_DIR/functions.guest" + +exec_logfile + +indicate_current_auto + +#------------------------------------------------------------------------------- +# Create database Keystone, Glance, Quantum, Nova, and Cinder +function mysql_exe { + local CMD="$1" + echo mysql -u "root" -p"$DATABASE_PASSWORD" -e "$CMD" +} + +function setup_database { + local DB=$1 + mysql_exe "CREATE DATABASE $DB" + mysql_exe "GRANT ALL ON ${DB}.* TO '${DB}User'@'%' IDENTIFIED BY '${DB}Pass';" +} + +setup_database keystone +setup_database glance +setup_database neutron +setup_database nova +setup_database cinder +