Re: Storing command line options in qcow2 images

Jorge Lucángeli Obes
2007-07-31T02:35:35Z

On 7/30/07, Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
> Jorge Lucángeli Obes wrote:
> > Hi Avi, hi all,
>
> I believe that Laurent (copied) is also interested in this area.

Copied him.

> > I've started some (very minor) groundwork for this task. My idea was
> > to add an extra "annotation" field in qcow2 snapshots. In this way, a
> > snapshot can hold abitrary information; for example, command line
> > arguments.
> >
> > Before going any further, I wanted to validate the general idea with
> > the list.

> I've copied qemu-devel as well. This can benefit qemu as much as kvm
> and I see no reasons that this shouldn't be merged into kvm through qemu
> upstream. Furthermore, I'd very much hate to see qemu and kvm image
> formats diverge, so I'd like to get the qemu maintainer's approval for
> any format changes or extensions.

Agreed.

> > There's a slight overhead as now all qcow2 snapshots have to store a
> > extra (probably) empty pointer. An alternative approach would be to
> > somehow indicate that some snapshots are "descriptive" snapshots and
> > others are "useful" snapshots; however, I felt that this would be more
> > complicated.
> >
>
> Will storing an extra pointer break existing qcow2 images? If so, we'd
> better avoid it.

It could be a problem, I agree. Maybe it's a better idea not to touch
the on-disk format. That would mean leaving 'struct
QCowSnapshotHeader' intact, and using existing fields to store our
information. The header includes an "extra_data_size" field that can
do the trick. This would of course need approval from qemu developers.

Laurent, do you want the patches for the functionality that's working
right now? We can divide the (not very big amount of) work that's
left. It consists basically on teaching qemu how to look for command
line options, if none are present on the current invocation. I don't
mind doing it by myself if you want to keep working on the other stuff
you've been posting patches about.

Just to be clear, the actual "embedding" of command line options into
the image would be done with qemu-img. It would be qemu's job to
validate this when the image is loaded.

Another way to do this could be to add an option to qemu that does the
embedding. This would have the benefit of free option validation, but
I felt that image-related operations should be used from qemu-img.

Cheers,
Jorge