-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_computenode.sh
More file actions
executable file
·62 lines (52 loc) · 1.19 KB
/
Copy pathadd_computenode.sh
File metadata and controls
executable file
·62 lines (52 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
#
# This script adds required permissions needed by the contoller, for the
# compute nodes to access the databases remotely.
#
# Chathura S. Magurawalage
# email: csarata@essex.ac.uk
# 77.chathura@gmail.com
((
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root"
exit 1
fi
while getopts K:hv option
do
case "${option}"
in
K) COMPUTE_IP=${OPTARG};;
v) set -x;;
h) cat <<EOF
Usage: $0 [-K computenode_management_ip]
Add -v for verbose mode, -h to display this message.
EOF
exit 0
;;
\?) echo "Use -h for help"
exit 1;;
esac
done
# while getopts "K:vh" opt;
# do
# case $opt in
# K) COMPUTE_IP=${OPTARG};;
# h) cat <<EOF
# Usage: $0 [-K computenode_ip]
# Add -v for verbose mode, -h to display this message.
# EOF
# exit 0;;
# v) set -x
# ;;
# esac
# done
mysql -u root -ppassword <<EOF
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@$COMPUTE_IP \
IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON quantum.* TO 'quantum'@$COMPUTE_IP \
IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EOF
echo "Database permissions for compute node $COMPUTE_IP has been submited!"
)) 2>&1 | tee $0.log