All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Any tutorial to read/write in qcow2 format by programming way?
@ 2018-07-31  9:44 lampahome
  2018-07-31 12:16 ` Eric Blake
  0 siblings, 1 reply; 4+ messages in thread
From: lampahome @ 2018-07-31  9:44 UTC (permalink / raw)
  To: QEMU Developers

As titled

I learn some info about qcow2 and tried to write some data and make it
qualified for qcow2 format.

I do it and mount through qemu-nbd successfully.

But I don't know how taking snapshot and backing file works in programming
way.

Can someone tell me some tutorial to know or code snippets to learn?

thx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Any tutorial to read/write in qcow2 format by programming way?
  2018-07-31  9:44 [Qemu-devel] Any tutorial to read/write in qcow2 format by programming way? lampahome
@ 2018-07-31 12:16 ` Eric Blake
  2018-08-02  6:57   ` lampahome
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Blake @ 2018-07-31 12:16 UTC (permalink / raw)
  To: lampahome, QEMU Developers

On 07/31/2018 04:44 AM, lampahome wrote:
> As titled
> 
> I learn some info about qcow2 and tried to write some data and make it
> qualified for qcow2 format.
> 
> I do it and mount through qemu-nbd successfully.
> 
> But I don't know how taking snapshot and backing file works in programming
> way.
> 
> Can someone tell me some tutorial to know or code snippets to learn?

No real tutorial other than reading the code and the file format 
specification (it's open source, after all).  See:
block/qcow2*
docs/interop/qcow2.txt

Other potential resources to study:

https://github.com/jnsnow/qcheck.git

implements a rudimentary qcow2 image checker, although it still does not 
handle incremental snapshots. Then again, if you want to learn the qcow2 
image format, enhancing that tool would be a great asset in your quest.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Any tutorial to read/write in qcow2 format by programming way?
  2018-07-31 12:16 ` Eric Blake
@ 2018-08-02  6:57   ` lampahome
  2018-08-02 12:58     ` Eric Blake
  0 siblings, 1 reply; 4+ messages in thread
From: lampahome @ 2018-08-02  6:57 UTC (permalink / raw)
  To: Eric Blake; +Cc: QEMU Developers

I have some questions about qcow2
If I have 2 img A & B, and A is backing file of B.
Is the format(such as L1, L2, ref block...etc) different from A and B?



> No real tutorial other than reading the code and the file format
> specification (it's open source, after all).  See:
> block/qcow2*
> docs/interop/qcow2.txt
>
> Other potential resources to study:
>
> https://github.com/jnsnow/qcheck.git
>
> implements a rudimentary qcow2 image checker, although it still does not
> handle incremental snapshots. Then again, if you want to learn the qcow2
> image format, enhancing that tool would be a great asset in your quest.
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Any tutorial to read/write in qcow2 format by programming way?
  2018-08-02  6:57   ` lampahome
@ 2018-08-02 12:58     ` Eric Blake
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2018-08-02 12:58 UTC (permalink / raw)
  To: lampahome; +Cc: QEMU Developers

On 08/02/2018 01:57 AM, lampahome wrote:

[Top-posting is difficult to read on technical lists; it's better to 
reply inline]

> I have some questions about qcow2
> If I have 2 img A & B, and A is backing file of B.
> Is the format(such as L1, L2, ref block...etc) different from A and B?

image A can be a completely different format from B (different cluster 
sizing, different refcount sizing, for that matter, image A doesn't even 
have to be qcow2).  All that matters from B's perspective is that a read 
of any cluster not present in B is satisfied by reading the same range 
of guest-visible bytes from image A in whatever manner A serves up those 
bytes; and a write to a cluster not present in B causes a COW 
(copy-on-write) operation to pull in remaining data from A for any 
portion of the cluster not covered by the write itself.  The entire 
block layer in qemu is a well-defined recursive interface of driver 
callbacks, where any particular operation calls through as few or as 
many block drivers as needed to either reach the data in question or 
determine that the data is not available.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-02 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31  9:44 [Qemu-devel] Any tutorial to read/write in qcow2 format by programming way? lampahome
2018-07-31 12:16 ` Eric Blake
2018-08-02  6:57   ` lampahome
2018-08-02 12:58     ` Eric Blake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.