← Back to team overview

openstack team mailing list archive

Re: Copy glance image to cinder bootable volumes - "copy_image_to_volume"

 

What I just did to successfully "boot from a volume":

1- Create a KVM Virtual Machine on top of a LVM Logical Volume of 2.5G as
its HD (disk type block - /dev/volgrp0/vmname-disk0);

2- Install your favorite OS;

3- shutdown it;

4- make a image of it: dd if=/dev/volgrp0/vmname-disk0 of=myfavorite-os.img;

5- copy it to your Cinder server: scp myfavorite-os.img to the server where
your "cinder-volumes LVM VG" resides;

6- make a volume of ~5G via Openstack Dashboard or CLI;

7- find your "cloud cinder volume" on the Cinder server: lvdisplay

8- import your 2.5G image (myfavorite-os.img) into your Cinder volume: dd
if=/path/of/myfavorite-os.img
of=/dev/cinder-volumes/volume-a2fb85b1-512e-402b-9aaf-6ce1914295a4;

9- start a instance using any image as source (cirros) and choose to boot
from this volume (a2fb85b1-512e-402b-9aaf-6ce1914295a4). The image source
(cirros) will be ignored, I think...

That's it!

NOTE: If you can run a KVM VM on the same server of your Cinder, you can
shrink part of this procedure, by doing it more directly: "dd
if=/dev/volgrp0/vmname-disk0
of=/dev/cinder-volumes/volume-a2fb85b1-512e-402b-9aaf-6ce1914295a4" on step
4 (your cinder volume must be ready on that point).

I prefer to make specific flavors to use with my "boot-from-volume"
Instances.

Best!
Thiago

On 30 January 2013 13:06, Avishay Traeger <AVISHAY@xxxxxxxxxx> wrote:

> Lei Zhang <zhang.lei.fly@xxxxxxxxx> wrote on 01/30/2013 04:39:22 PM:
> > I also have a question. What's the requirement for the image? I
> > found nothing int the doc.
>
> Hi,
> The requirements that I can think of off the top of my head are:
> 1. The image should be bootable
> 2. The image is converted to raw before being written to the volume, so it
> should be a format the 'qemu-img' understands (raw, qcow2, vmdk, vdi)
> 3. There must be sufficient space to write the raw version of the image
>
> Thanks,
> Avishay
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References