From 4a9d07458c7acbd1f60ec997de62524b67f519be Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 5 Dec 2011 16:29:04 -0500 Subject: [PATCH 1/4] use cgroup-lite package Instead of managing cgroup via /etc/fstab ourselves, let the cgroup-lite package do it. --- stack.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/stack.sh b/stack.sh index 7d66e319..d362e661 100755 --- a/stack.sh +++ b/stack.sh @@ -719,16 +719,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then # splitting a system into many smaller parts. LXC uses cgroups and chroot # to simulate multiple systems. if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then - apt_get install lxc - # lxc uses cgroups (a kernel interface via virtual filesystem) configured - # and mounted to ``/cgroup`` - sudo mkdir -p /cgroup - if ! grep -q cgroup /etc/fstab; then - echo none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0 | sudo tee -a /etc/fstab - fi - if ! mount -n | grep -q cgroup; then - sudo mount /cgroup - fi + apt_get install cgroup-lite fi # The user that nova runs as needs to be member of libvirtd group otherwise From 86b03b9e5061c1f157144480802922346570b7aa Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 5 Dec 2011 19:20:30 -0500 Subject: [PATCH 2/4] install libvirt as a dependency of nova nova compute depends on libvirt, but it was not being installed in the case of LIBVIRT_TYPE=lxc. --- stack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index d362e661..49ffa298 100755 --- a/stack.sh +++ b/stack.sh @@ -699,6 +699,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then # Virtualization Configuration # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + apt_get install libvirt-bin # attempt to load modules: network block device - used to manage qcow images sudo modprobe nbd || true @@ -707,7 +708,6 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then # kvm, we drop back to the slower emulation mode (qemu). Note: many systems # come with hardware virtualization disabled in BIOS. if [[ "$LIBVIRT_TYPE" == "kvm" ]]; then - apt_get install libvirt-bin sudo modprobe kvm || true if [ ! -e /dev/kvm ]; then echo "WARNING: Switching to QEMU" From 9378e577fd6b09ad45223c853f82dda1006f46dd Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 7 Dec 2011 15:50:53 -0500 Subject: [PATCH 3/4] support non "uec style" IMAGE_URLS This adds support for image urls that end in .img.gz or .img. The assumption is that they're a full disk image or a compressed disk image. Some examples: https://cloud-images.ubuntu.com/server/releases/11.10/release/ubuntu-11.10-server-cloudimg-i386-disk1.img http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img --- stack.sh | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/stack.sh b/stack.sh index 49ffa298..8ba18907 100755 --- a/stack.sh +++ b/stack.sh @@ -1204,20 +1204,55 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then for image_url in ${IMAGE_URLS//,/ }; do # Downloads the image (uec ami+aki style), then extracts it. IMAGE_FNAME=`basename "$image_url"` - IMAGE_NAME=`basename "$IMAGE_FNAME" .tar.gz` if [ ! -f $FILES/$IMAGE_FNAME ]; then wget -c $image_url -O $FILES/$IMAGE_FNAME fi - # Extract ami and aki files - tar -zxf $FILES/$IMAGE_FNAME -C $FILES/images + KERNEL="" + RAMDISK="" + case "$IMAGE_FNAME" in + *.tar.gz|*.tgz) + # Extract ami and aki files + [ "${IMAGE_FNAME%.tar.gz}" != "$IMAGE_FNAME" ] && + IMAGE_NAME="${IMAGE_FNAME%.tar.gz}" || + IMAGE_NAME="${IMAGE_FNAME%.tgz}" + xdir="$FILES/images/$IMAGE_NAME" + rm -Rf "$xdir"; + mkdir "$xdir" + tar -zxf $FILES/$IMAGE_FNAME -C "$xdir" + KERNEL=$(for f in "$xdir/"*-vmlinuz*; do + [ -f "$f" ] && echo "$f" && break; done; true) + RAMDISK=$(for f in "$xdir/"*-initrd*; do + [ -f "$f" ] && echo "$f" && break; done; true) + IMAGE=$(for f in "$xdir/"*.img; do + [ -f "$f" ] && echo "$f" && break; done; true) + [ -n "$IMAGE_NAME" ] + IMAGE_NAME=$(basename "$IMAGE" ".img") + ;; + *.img) + IMAGE="$FILES/$IMAGE_FNAME"; + IMAGE_NAME=$(basename "$IMAGE" ".img") + ;; + *.img.gz) + IMAGE="$FILES/${IMAGE_FNAME}" + IMAGE_NAME=$(basename "$IMAGE" ".img.gz") + ;; + *) echo "Do not know what to do with $IMAGE_FNAME"; false;; + esac # Use glance client to add the kernel the root filesystem. # We parse the results of the first upload to get the glance ID of the # kernel for use when uploading the root filesystem. - RVAL=`glance add -A $SERVICE_TOKEN name="$IMAGE_NAME-kernel" is_public=true container_format=aki disk_format=aki < $FILES/images/$IMAGE_NAME-vmlinuz*` - KERNEL_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "` - glance add -A $SERVICE_TOKEN name="$IMAGE_NAME" is_public=true container_format=ami disk_format=ami kernel_id=$KERNEL_ID < $FILES/images/$IMAGE_NAME.img + KERNEL_ID=""; RAMDISK_ID=""; + if [ -n "$KERNEL" ]; then + RVAL=`glance add -A $SERVICE_TOKEN name="$IMAGE_NAME-kernel" is_public=true container_format=aki disk_format=aki < "$KERNEL"` + KERNEL_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "` + fi + if [ -n "$RAMDISK" ]; then + RVAL=`glance add -A $SERVICE_TOKEN name="$IMAGE_NAME-ramdisk" is_public=true container_format=ari disk_format=ari < "$RAMDISK"` + RAMDISK_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "` + fi + glance add -A $SERVICE_TOKEN name="${IMAGE_NAME%.img}" is_public=true container_format=ami disk_format=ami ${KERNEL_ID:+kernel_id=$KERNEL_ID} ${RAMDISK_ID:+ramdisk_id=$RAMDISK_ID} < <(zcat --force "${IMAGE}") done fi From 4651dd9b59b36763d3eef0455cb55ec246759262 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 7 Dec 2011 16:09:06 -0500 Subject: [PATCH 4/4] stackrc: replace ttylinux-uec images with cirros http://launchpad.net/cirros is basically "ttylinux-uec 2.0". These images should function wherever ttylinux-uec did, and work well better under lxc. --- stackrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stackrc b/stackrc index 524cc992..b28bdd8c 100644 --- a/stackrc +++ b/stackrc @@ -44,7 +44,9 @@ CITEST_REPO=https://github.com/openstack/tempest.git CITEST_BRANCH=master # Specify a comma-separated list of uec images to download and install into glance. -IMAGE_URLS=http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz +#IMAGE_URLS="http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz" # old ttylinux-uec image +#IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img" # cirros full disk image +IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-uec.tar.gz" # uec style cirros image # allow local overrides of env variables if [ -f ./localrc ]; then