Storing command line options in qcow2 images

Jorge Lucángeli Obes
2007-07-30T03:40:24Z

Hi Avi, hi all,

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 am planning on using a snapshot with a distinct name to
store command line options. This approach seems simple yet it is
powerful enough for what we need to do.

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.

I have a working patch to qemu-img that allows storing arbitrary
annotations into qcow2 images. I developed it as a testing utility.
Right now annotations are implemented as another string alongside the
snapshot's 'name' and 'id'. I thought about storing annotations as
key/value pairs but again, it seemed overkill.

>From here, the plan would be to add a command to qemu-img that allows
embedding of command line options into qcow2 images. These options
would be stored in a snapshot with a special name, and qemu would
check for the presence of this snapshot in order to read command line
options from the qcow2 image.

Ideas? Suggestions? I can send the patches for the functionality
that's implemented right now.

Cheers,
Jorge