Browse code

mysql-izing for nova

Jesse Andrews authored on 2011/09/13 11:29:56
Showing 4 changed files
... ...
@@ -2,15 +2,19 @@ Tool to build (nfs export) openstack dev environments
2 2
 
3 3
 # Todo
4 4
 
5
-* change method of invoking stack.sh to ./stack.sh all _or_ ./stack.sh nova-compute,nova-network,nova-api,nova-volume
6 5
 * move back to using sudo
6
+* Add python-novaclient cli support
7 7
 * move to mysql
8
-* extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?)
9 8
 * Add volume support
10
-* Add quantum support
11
-* Add python-novaclient cli support
9
+* extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?)
12 10
 * allow changing of git locations (specify different tag/branch or repos)
13
-* allow sql/rabbit connection to be specified via environment variables with sensible defaults
11
+* change method of invoking stack.sh to ./stack.sh all _or_ ./stack.sh nova-compute,nova-network,nova-api,nova-volume
12
+* Add quantum support
13
+* allow rabbit connection to be specified via environment variables with sensible defaults
14
+
15
+# Done
16
+
17
+* sqlconn can be set via env
14 18
 
15 19
 # Future
16 20
 
... ...
@@ -1,5 +1,7 @@
1 1
 dnsmasq-base
2 2
 kpartx
3
+mysql-server
4
+python-mysqldb
3 5
 kvm
4 6
 gawk
5 7
 iptables
... ...
@@ -13,7 +13,7 @@ if [ ! -d proto ]; then
13 13
     debootstrap natty proto
14 14
     cp files/sources.list proto/etc/apt/sources.list
15 15
     chroot proto apt-get update
16
-    chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin)"`
16
+    chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
17 17
     chroot proto pip install `cat pips/*`
18 18
     git clone https://github.com/cloudbuilders/nova.git proto/opt/nova
19 19
     git clone https://github.com/cloudbuilders/openstackx.git proto/opt/openstackx
... ...
@@ -38,10 +38,17 @@ NET_MAN=${NET_MAN:-VlanManager}
38 38
 #             ip or you risk breaking things.
39 39
 # FLAT_INTERFACE=eth0
40 40
 
41
-# TODO: set rabbitmq conn string explicitly as well
42 41
 # TODO: switch to mysql for all services
43
-SQL_CONN=${SQL_CONN:-sqlite:///$NOVA_DIR/nova.sqlite}
42
+MYSQL_PASS=${MYSQL_PASS:-nova}
43
+SQL_CONN=${SQL_CONN:-mysql://root:$MYSQL_PASS@localhost/nova}
44
+# TODO: set rabbitmq conn string explicitly as well
44 45
 
46
+# seed configuration with mysql password
47
+cat <<MYSQL_PRESEED | debconf-set-selections
48
+mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
49
+mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
50
+mysql-server-5.1 mysql-server/start_on_boot boolean true
51
+MYSQL_PRESEED
45 52
 
46 53
 # install apt requirements
47 54
 apt-get install -y -q `cat $DIR/apts/* | cut -d\# -f1`
... ...
@@ -107,7 +114,7 @@ fi
107 107
 mkdir $DASH_DIR/openstack-dashboard/quantum
108 108
 touch $DASH_DIR/openstack-dashboard/quantum/__init__.py
109 109
 touch $DASH_DIR/openstack-dashboard/quantum/client.py
110
-# local_settings has 
110
+
111 111
 cd $DASH_DIR/openstack-dashboard
112 112
 cp local/local_settings.py.example local/local_settings.py
113 113
 dashboard/manage.py syncdb
... ...
@@ -115,9 +122,9 @@ dashboard/manage.py syncdb
115 115
 # ## Setup Apache
116 116
 # create an empty directory to use as our 
117 117
 mkdir $DASH_DIR/.blackhole
118
+
118 119
 # FIXME(ja): can't figure out how to make $DASH_DIR work in sed, also install to available/a2e it 
119 120
 cat $DIR/files/000-default.template | sed 's/%DASH_DIR%/\/opt\/dash/g' > /etc/apache2/sites-enabled/000-default
120
-
121 121
 chown -R www-data:www-data $DASH_DIR
122 122
 
123 123
 mkdir -p /var/log/glance
... ...
@@ -129,12 +136,6 @@ cp $DIR/files/screenrc ~/.screenrc
129 129
 
130 130
 NL=`echo -ne '\015'`
131 131
 
132
-function screen_it {
133
-    # nova api crashes if we start it with a regular screen command,
134
-    # so send the start command by forcing text into the window.
135
-    screen -S nova -X screen -t $1
136
-    screen -S nova -p $1 -X stuff "$2$NL"
137
-}
138 132
 
139 133
 function add_nova_flag {
140 134
     echo "$1" >> $NOVA_DIR/bin/nova.conf
... ...
@@ -173,7 +174,8 @@ rm -rf $NOVA_DIR/networks
173 173
 mkdir -p $NOVA_DIR/networks
174 174
 
175 175
 # (re)create nova database
176
-rm -f $NOVA_DIR/nova.sqlite
176
+mysql -p$MYSQL_PASS -e 'DROP DATABASE nova;'
177
+mysql -p$MYSQL_PASS -e 'CREATE DATABASE nova;'
177 178
 $NOVA_DIR/bin/nova-manage db sync
178 179
 
179 180
 # initialize keystone with default users/endpoints
... ...
@@ -191,6 +193,13 @@ $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
191 191
 rm -rf /var/lib/glance/images/*
192 192
 rm -f $GLANCE_DIR/glance.sqlite
193 193
 
194
+# nova api crashes if we start it with a regular screen command,
195
+# so send the start command by forcing text into the window.
196
+function screen_it {
197
+    screen -S nova -X screen -t $1
198
+    screen -S nova -p $1 -X stuff "$2$NL"
199
+}
200
+
194 201
 screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf"
195 202
 screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=etc/glance-registry.conf"
196 203
 screen_it key "$KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_DIR/etc/keystone.conf"
... ...
@@ -202,7 +211,6 @@ screen_it n-vnc "$NOVA_DIR/bin/nova-vncproxy"
202 202
 screen_it dash "/etc/init.d/apache2 restart; tail -f /var/log/apache2/error.log"
203 203
 
204 204
 
205
-
206 205
 # ---- download an install images ----
207 206
 
208 207
 mkdir -p $DEST/images