Figured out how to create/add qcow ubuntu images

* new bootstrap/bootstrap.sh shows the proper way to create a image
* modified the funkybugs cuz i squashed one in nova proper
* added apt-cacher-ng and such to the old bootstrap (dont use it yet)
This commit is contained in:
mbasnight 2012-02-26 21:30:16 -06:00 committed by mbasnight
parent f9f10e84a7
commit 0de93f0ea2
3 changed files with 37 additions and 19 deletions

View File

@ -35,21 +35,5 @@ Until this is fixed you need to mod python-novaclient after it gets downloaded v
TWO:
Looks like there is a missing import in nova/api/openstack/auth.py
from nova.auth import manager
Until this is fixed you need to mod nova after its gets downloaded via devstack
###### BEGIN PATCH
@@ -80,6 +80,7 @@ class AuthMiddleware(base_wsgi.Middleware):
if not db_driver:
db_driver = FLAGS.db_driver
self.db = utils.import_object(db_driver)
+ from nova.auth import manager
self.auth = auth.manager.AuthManager()
super(AuthMiddleware, self).__init__(application)
###### END PATCH
THREE:
funkyness w/ the extensions. the extensions url itself wont load. Seems to have to do with authorization & tenants.
* mitigated in reddwarf/common/extensions.py, see for more information

View File

@ -1,11 +1,18 @@
# At this point this script is manual. We will need to work this in to a more automated script.
# NOTE: Im not sure if we need any of this at this point. i will be checking/deleting it shortly.
# see bootstrap/bootstrap.sh
pkg_install () {
echo Installing $@...
sudo -E DEBIAN_FRONTEND=noninteractive $HTTP_PROXY apt-get -y --allow-unauthenticated --force-yes install $@
}
pkg_install debootstrap schroot
pkg_install debootstrap schroot apt-cacher-ng
# Make sure we sling up apt-cacher ng so each build is faster
echo 'Acquire::http { Proxy "http://127.0.0.1:3142"; };' | sudo tee /etc/apt/apt.conf.d/01proxy
sudo /etc/init.d/apt-cacher-ng restart
# This will wipe an existing schroot conf!
echo '
[oneiric]
description=Ubuntu oneiric
@ -13,16 +20,25 @@ location=/var/chroot/oneiric
priority=3
users=<your user>
groups=sbuild
root-groups=root' | sudo tee -a /etc/schroot/schroot.conf
root-groups=root' | sudo tee /etc/schroot/schroot.conf
sudo rm -fr /var/chroot/oneiric
sudo debootstrap --variant=buildd oneiric /var/chroot/oneiric http://us.archive.ubuntu.com/ubuntu/
sudo mkdir /var/chroot/oneiric/root/.ssh
sudo cp ~/.ssh/id_rsa.pub /var/chroot/oneiric/root/.ssh/authorized_keys
sudo chroot /var/chroot/oneiric
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated --force-yes apt-get install openssh-server
DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated --force-yes install mysql-server
exit
#now that u are out of the vm, lets tar it up
cd /var/chroot/oneiric/
sudo tar czvf ../onieric_mysql.tar.gz .
cd ..
glance add -A $REDDWARF_TOKEN name="ubuntu-mysql.img" is_public=true type=raw < onieric_mysql.tar.gz
curl -H"Content-type:application/json" -H'X-Auth-Token:$REDDWARF_TOKEN' \
http://0.0.0.0:8779/v0.1/$REDDWARF_TOKEN/instances \
-d '{"name":"my_test","image":"$IMAGE_ID","flavor":"1"}'

View File

@ -0,0 +1,18 @@
# Be sure to pass in the token for glance auth
REDDWARF_TOKEN=$1
# This takes about ~12 minutes to finish
sudo apt-get install kvm-pxe
VM_PATH=oneiric_mysql_image
UBUNTU_DISTRO="ubuntu 11.10"
UBUNTU_DISTRO_NAME=oneiric
rm -fr $VM_PATH
#build a qemu image
sudo ubuntu-vm-builder qemu $UBUNTU_DISTRO_NAME --addpkg vim \
--addpkg mysql-server --addpkg openssh-server --addpkg kvm-pxe \
--user reddwarf --pass reddwarf -d $VM_PATH
QCOW_IMAGE=`find $VM_PATH -name '*.qcow2'`
glance add name="lucid_mysql_image" is_public=true \
container_format=ovf disk_format=qcow2 \
distro="$UBUNTU_DISTRO" -A $REDDWARF_TOKEN < $QCOW_IMAGE