We have a similar script at<div><br></div><div><a href="https://github.com/canarie/vm-toolkit/blob/master/bundle/vmbundle.py">https://github.com/canarie/vm-toolkit/blob/master/bundle/vmbundle.py</a></div><div><br></div><div>
that tries to take the pain out of bundling a running instance for our more "naive" users.</div><div><br></div><div>Everett <br><br><div class="gmail_quote">On Wed, Aug 31, 2011 at 8:48 AM, Darren Govoni <span dir="ltr"><<a href="mailto:darren@ontrenet.com">darren@ontrenet.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Much appreciated! I will give it a try.<div><div></div><div class="h5"><br>
<br>
On 08/31/2011 10:46 AM, Wayne A. Walls wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Just realized you asked about a running image, not a new one.  Apologies<br>
on that.  I used this script in the past to accomplish bundling a running<br>
instance.  It is likely outdated, but it will give you a good premise to<br>
start:<br>
<br>
#!/bin/sh<br>
<br>
#words words words<br>
#this is a script for easy image creation<br>
<br>
. /root/creds/novarc<br>
SYSTEM=$(uname -r)<br>
read -p "Please enter your bucket/container name:" BUCKET_NAME<br>
<br>
euca-bundle-vol --no-inherit -d /tmp/image -e /mnt, /tmp<br>
losetup /dev/loop3 /tmp/image/image.img<br>
mount /dev/loop3 /mnt<br>
sed -i<br>
's/^UUID=[a-z0-9]\{8\}-[a-z0-<u></u>9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]<u></u>\{4\}-[a-z0-9]\{<br>
12\}[\t]* \//\/dev\/vda1\t\//1' /mnt/etc/fstab<br>
sed -i<br>
's/^UUID=[a-z0-9]\{8\}-[a-z0-<u></u>9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]<u></u>\{4\}-[a-z0-9]\{<br>
12\}[\t]* none/\/mnt\/swap.file\tnone/1' /mnt/etc/fstab<br>
cp /mnt/etc/network/interfaces /mnt/root/interfaces.bak<br>
cat>  /mnt/etc/network/interfaces<<  INTERFACE_UPDATE<br>
# The loopback network interface<br>
auto lo<br>
iface lo inet loopback<br>
<br>
# The primary network interface<br>
auto eth0<br>
iface eth0 inet dhcp<br>
INTERFACE_UPDATE<br>
<br>
<br>
dd if=/dev/zero of=/mnt/swap.file bs=1024 count=512000<br>
sleep 1<br>
mkswap /mnt/swap.file<br>
sleep 1<br>
umount /mnt<br>
<br>
euca-bundle-image -i /boot/initrd.img-$SYSTEM -d /tmp/ramdisk --ramdisk<br>
true<br>
<br>
euca-bundle-image -i /boot/vmlinuz-$SYSTEM -d /tmp/kernel --kernel true<br>
euca-upload-bundle -m /tmp/kernel/vmlinuz-$SYSTEM.<u></u>manifest.xml -b<br>
$BUCKET_NAME<br>
euca-upload-bundle -m /tmp/ramdisk/initrd.img-$<u></u>SYSTEM.manifest.xml -b<br>
$BUCKET_NAME<br>
KERNEL_IMAGE=$(euca-register $BUCKET_NAME/vmlinuz-$SYSTEM.<u></u>manifest.xml |<br>
awk '{print $2}')<br>
RAMDISK_IMAGE=$(euca-register $BUCKET_NAME/initrd.img-$<u></u>SYSTEM.manifest.xml<br>
| awk '{print $2}')<br>
euca-bundle-image -i /tmp/image/image.img --kernel $KERNEL_IMAGE --ramdisk<br>
$RAMDISK_IMAGE -d /tmp/imagebuild<br>
euca-upload-bundle -m /tmp/imagebuild/image.img.<u></u>manifest.xml -b<br>
$BUCKET_NAME<br>
AMI_IMAGE=$(euca-register $BUCKET_NAME/image.img.<u></u>manifest.xml | awk<br>
'{print $2}'); echo "Image is decrypting and untarring for usage."<br>
<br>
sleep 180<br>
<br>
euca-run-instances $AMI_IMAGE<br>
<br>
<br>
<br>
On 8/31/11 8:16 AM, "Darren Govoni"<<a href="mailto:darren@ontrenet.com" target="_blank">darren@ontrenet.com</a>>  wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
   Is there a tutorial somewhere showing how to re-bundle a running<br>
instance (e.g. ubuntu)<br>
and register it as a new image in openstack?<br>
<br>
thanks,<br>
Darren<br>
<br>
______________________________<u></u>_________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~<u></u>openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net" target="_blank">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~<u></u>openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/<u></u>ListHelp</a><br>
</blockquote>
<br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~<u></u>openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net" target="_blank">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~<u></u>openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/<u></u>ListHelp</a><br>
</div></div></blockquote></div><br></div>