[Openstack] Qcow2 Details on base images

Gaurab Basu basugaurab88 at gmail.com
Thu Aug 2 11:47:57 UTC 2012


Hi Jay,

Thanks for your reply, it helped me get started.

I have been going through the code and some of the sparse docs that are
available.

This is the code file
https://github.com/openstack/nova/blob/master/nova/virt/libvirt/utils.py

However I am facing a new issue and require some help. I wanted to modify
how openstack handles the cow layer as such and also the qcow2 format.
It turns out that openstack issues the external command "qemu-img".

First of all, is qemu-img internal to openstack ( I mean code for how
qemu-img is implemented is in openstack or in qemu )
It is in openstack, where is the code located.

If it is outside openstack, does that mean i have to change the code in
qemu and then link those binaries with openstack.

Any help would be appreciated.

Thanks,
Gaurab



On Sun, Jul 29, 2012 at 6:35 AM, Jay Pipes <jaypipes at gmail.com> wrote:

> On 07/28/2012 11:10 AM, Gaurab Basu wrote:
> > Another thing I would like to know is whether it uses snapshot mechanism
> > over time.
>
> What is "it" you are referring to above? Are you asking whether Nova
> automatically takes snapshots of images over time? If so, no, it does
> not. If a user requests a snapshot of a launched instance, then Nova
> will issue snapshot commands -- in the case of the libvirt driver, these
> commands would be qemu-img snapshot -c <SNAPSHOT_NAME> <IMAGE_PATH>.
>
> > I mean how does the copy on write functionality works. Does it keep the
> > diff snapshots over time ( or something else ).
>
> Not sure here whether you are asking how QEMU's copy on write operations
> work or whether Nova keeps the base images separate from any VM images.
> If you are asking about the latter, the answer is that Nova will create
> the virtual machine images by creating a COW image based on the base
> image it pulls from Glance -- after making a resized copy of the base
> image if it needs to do so to meet the needs of the requested image size
> of the VM.
>
> Snapshots that are taken of virtual machine images on a host are stored
> by Nova in Glance.
>
> > And does the diff work at the level of file or block level?
>
> AFAIK, CoW and snapshot actions with QEMU are block-level.
>
> > What is the format that the image is converted to after it is fetched
> > from glance.
>
> There may be no conversion needed at all... it depends on what the
> format of the original base image that was stored in Glance. Conversion
> between raw/iso and QCOW2 and vice versa is what you see in the code,
> and is what is done during migration as Mikal mentioned below.
>
> > I am fairly new to openstack.
> > Can you point me to the specific files in the code where all these
> > things are coded. I want to know the details of the
> > present state.
>
> grep for qemu-img in the nova/ directory. You'll see all the files that
> call qemu-img commands and then you can go look in those files.
>
> Best,
> -jay
>
> > Thanks again for your help.
> >
> > Regards,
> > Gaurab
> >
> > On Sat, Jul 28, 2012 at 11:52 AM, Michael Still
> > <michael.still at canonical.com <mailto:michael.still at canonical.com>>
> wrote:
> >
> >     On 28/07/12 05:42, Gaurab Basu wrote:
> >     > Hi,
> >     >
> >     > I am trying to figure out the technology that openstack uses when
> >     > multiple VM's having the*same *base image (OS) are provisioned on a
> >     > physical server.
> >     > Does it use as many copy as the number of VM's or does it use the
> same
> >     > base image and then copy on write.
> >     >
> >     > I need to understand the complete details. Can anybody share some
> >     > details or point me to some place where I can find the details.
> >
> >     Its pretty hard to provide a complete description of what happens,
> >     because the code keeps changing. However, assuming you have copy on
> >     write turned on (which is the default IIRC), and assuming that all of
> >     the instances have the same disk size, then you end up with:
> >
> >      - the image as fetched from glance, with possible format conversion
> >      - that image resized to the size the instance requested
> >      - a cow on write layer for each instance that is using that sized
> image
> >
> >     The first should be smallish, the second can be quite large, and the
> >     third will really depend on how much writing the instances are doing.
> >
> >     Note that this all falls apart if instances are migrated, because as
> >     part of the migration the copy on write layer is transformed into a
> full
> >     disk image, which is what is shipped over to the new machine.
> >
> >     Hope this helps,
> >     Mikal
> >
> >
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~openstack
> > Post to     : openstack at lists.launchpad.net
> > Unsubscribe : https://launchpad.net/~openstack
> > More help   : https://help.launchpad.net/ListHelp
> >
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack at lists.launchpad.net
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120802/a3361477/attachment.html>


More information about the Openstack mailing list