From 1c1d1505c7b5527e550a91146855336e5bb2d064 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Mon, 12 Sep 2011 19:29:56 -0700 Subject: [PATCH] mysql-izing for nova --- README | 16 ++++++++++------ apts/nova | 2 ++ build.sh | 2 +- stack.sh | 32 ++++++++++++++++++++------------ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/README b/README index 2db4373..b93c615 100644 --- a/README +++ b/README @@ -2,15 +2,19 @@ Tool to build (nfs export) openstack dev environments # Todo -* change method of invoking stack.sh to ./stack.sh all _or_ ./stack.sh nova-compute,nova-network,nova-api,nova-volume * move back to using sudo -* move to mysql -* extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?) -* Add volume support -* Add quantum support * Add python-novaclient cli support +* move to mysql +* Add volume support +* extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?) * allow changing of git locations (specify different tag/branch or repos) -* allow sql/rabbit connection to be specified via environment variables with sensible defaults +* change method of invoking stack.sh to ./stack.sh all _or_ ./stack.sh nova-compute,nova-network,nova-api,nova-volume +* Add quantum support +* allow rabbit connection to be specified via environment variables with sensible defaults + +# Done + +* sqlconn can be set via env # Future diff --git a/apts/nova b/apts/nova index c23a609..6b867b2 100644 --- a/apts/nova +++ b/apts/nova @@ -1,5 +1,7 @@ dnsmasq-base kpartx +mysql-server +python-mysqldb kvm gawk iptables diff --git a/build.sh b/build.sh index 1523ece..89d8141 100755 --- a/build.sh +++ b/build.sh @@ -13,7 +13,7 @@ if [ ! -d proto ]; then debootstrap natty proto cp files/sources.list proto/etc/apt/sources.list chroot proto apt-get update - chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin)"` + chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` chroot proto pip install `cat pips/*` git clone https://github.com/cloudbuilders/nova.git proto/opt/nova git clone https://github.com/cloudbuilders/openstackx.git proto/opt/openstackx diff --git a/stack.sh b/stack.sh index 478592f..0faa09b 100755 --- a/stack.sh +++ b/stack.sh @@ -38,10 +38,17 @@ NET_MAN=${NET_MAN:-VlanManager} # ip or you risk breaking things. # FLAT_INTERFACE=eth0 -# TODO: set rabbitmq conn string explicitly as well # TODO: switch to mysql for all services -SQL_CONN=${SQL_CONN:-sqlite:///$NOVA_DIR/nova.sqlite} +MYSQL_PASS=${MYSQL_PASS:-nova} +SQL_CONN=${SQL_CONN:-mysql://root:$MYSQL_PASS@localhost/nova} +# TODO: set rabbitmq conn string explicitly as well +# seed configuration with mysql password +cat < /etc/apache2/sites-enabled/000-default - chown -R www-data:www-data $DASH_DIR mkdir -p /var/log/glance @@ -129,12 +136,6 @@ cp $DIR/files/screenrc ~/.screenrc NL=`echo -ne '\015'` -function screen_it { - # nova api crashes if we start it with a regular screen command, - # so send the start command by forcing text into the window. - screen -S nova -X screen -t $1 - screen -S nova -p $1 -X stuff "$2$NL" -} function add_nova_flag { echo "$1" >> $NOVA_DIR/bin/nova.conf @@ -173,7 +174,8 @@ rm -rf $NOVA_DIR/networks mkdir -p $NOVA_DIR/networks # (re)create nova database -rm -f $NOVA_DIR/nova.sqlite +mysql -p$MYSQL_PASS -e 'DROP DATABASE nova;' +mysql -p$MYSQL_PASS -e 'CREATE DATABASE nova;' $NOVA_DIR/bin/nova-manage db sync # initialize keystone with default users/endpoints @@ -191,6 +193,13 @@ $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE rm -rf /var/lib/glance/images/* rm -f $GLANCE_DIR/glance.sqlite +# nova api crashes if we start it with a regular screen command, +# so send the start command by forcing text into the window. +function screen_it { + screen -S nova -X screen -t $1 + screen -S nova -p $1 -X stuff "$2$NL" +} + screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf" screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=etc/glance-registry.conf" 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" screen_it dash "/etc/init.d/apache2 restart; tail -f /var/log/apache2/error.log" - # ---- download an install images ---- mkdir -p $DEST/images