[Openstack] Bundle running instance?

Everett Toews everett.toews at cybera.ca
Wed Aug 31 15:30:18 UTC 2011


We have a similar script at

https://github.com/canarie/vm-toolkit/blob/master/bundle/vmbundle.py

that tries to take the pain out of bundling a running instance for our more
"naive" users.

Everett

On Wed, Aug 31, 2011 at 8:48 AM, Darren Govoni <darren at ontrenet.com> wrote:

> Much appreciated! I will give it a try.
>
>
> On 08/31/2011 10:46 AM, Wayne A. Walls wrote:
>
>> Just realized you asked about a running image, not a new one.  Apologies
>> on that.  I used this script in the past to accomplish bundling a running
>> instance.  It is likely outdated, but it will give you a good premise to
>> start:
>>
>> #!/bin/sh
>>
>> #words words words
>> #this is a script for easy image creation
>>
>> . /root/creds/novarc
>> SYSTEM=$(uname -r)
>> read -p "Please enter your bucket/container name:" BUCKET_NAME
>>
>> euca-bundle-vol --no-inherit -d /tmp/image -e /mnt, /tmp
>> losetup /dev/loop3 /tmp/image/image.img
>> mount /dev/loop3 /mnt
>> sed -i
>> 's/^UUID=[a-z0-9]\{8\}-[a-z0-**9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]**
>> \{4\}-[a-z0-9]\{
>> 12\}[\t]* \//\/dev\/vda1\t\//1' /mnt/etc/fstab
>> sed -i
>> 's/^UUID=[a-z0-9]\{8\}-[a-z0-**9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]**
>> \{4\}-[a-z0-9]\{
>> 12\}[\t]* none/\/mnt\/swap.file\tnone/1' /mnt/etc/fstab
>> cp /mnt/etc/network/interfaces /mnt/root/interfaces.bak
>> cat>  /mnt/etc/network/interfaces<<  INTERFACE_UPDATE
>> # The loopback network interface
>> auto lo
>> iface lo inet loopback
>>
>> # The primary network interface
>> auto eth0
>> iface eth0 inet dhcp
>> INTERFACE_UPDATE
>>
>>
>> dd if=/dev/zero of=/mnt/swap.file bs=1024 count=512000
>> sleep 1
>> mkswap /mnt/swap.file
>> sleep 1
>> umount /mnt
>>
>> euca-bundle-image -i /boot/initrd.img-$SYSTEM -d /tmp/ramdisk --ramdisk
>> true
>>
>> euca-bundle-image -i /boot/vmlinuz-$SYSTEM -d /tmp/kernel --kernel true
>> euca-upload-bundle -m /tmp/kernel/vmlinuz-$SYSTEM.**manifest.xml -b
>> $BUCKET_NAME
>> euca-upload-bundle -m /tmp/ramdisk/initrd.img-$**SYSTEM.manifest.xml -b
>> $BUCKET_NAME
>> KERNEL_IMAGE=$(euca-register $BUCKET_NAME/vmlinuz-$SYSTEM.**manifest.xml
>> |
>> awk '{print $2}')
>> RAMDISK_IMAGE=$(euca-register $BUCKET_NAME/initrd.img-$**
>> SYSTEM.manifest.xml
>> | awk '{print $2}')
>> euca-bundle-image -i /tmp/image/image.img --kernel $KERNEL_IMAGE --ramdisk
>> $RAMDISK_IMAGE -d /tmp/imagebuild
>> euca-upload-bundle -m /tmp/imagebuild/image.img.**manifest.xml -b
>> $BUCKET_NAME
>> AMI_IMAGE=$(euca-register $BUCKET_NAME/image.img.**manifest.xml | awk
>> '{print $2}'); echo "Image is decrypting and untarring for usage."
>>
>> sleep 180
>>
>> euca-run-instances $AMI_IMAGE
>>
>>
>>
>> On 8/31/11 8:16 AM, "Darren Govoni"<darren at ontrenet.com>  wrote:
>>
>>  Hi,
>>>   Is there a tutorial somewhere showing how to re-bundle a running
>>> instance (e.g. ubuntu)
>>> and register it as a new image in openstack?
>>>
>>> thanks,
>>> Darren
>>>
>>> ______________________________**_________________
>>> Mailing list: https://launchpad.net/~**openstack<https://launchpad.net/~openstack>
>>> Post to     : openstack at lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~**openstack<https://launchpad.net/~openstack>
>>> More help   : https://help.launchpad.net/**ListHelp<https://help.launchpad.net/ListHelp>
>>>
>>
>>
>
> ______________________________**_________________
> Mailing list: https://launchpad.net/~**openstack<https://launchpad.net/~openstack>
> Post to     : openstack at lists.launchpad.net
> Unsubscribe : https://launchpad.net/~**openstack<https://launchpad.net/~openstack>
> More help   : https://help.launchpad.net/**ListHelp<https://help.launchpad.net/ListHelp>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20110831/ffc10601/attachment.html>


More information about the Openstack mailing list