qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Citrix VHD implementation
@ 2009-02-28 18:56 Philipp Schmid
  2009-03-02 11:41 ` Stefano Stabellini
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philipp Schmid @ 2009-02-28 18:56 UTC (permalink / raw)
  To: qemu-devel

Hi,

as some of you might know, citrix has open sourced the library they  
use to read and write to VHD disk images.

I'm trying to implementing a block-vhd driver on top of libvhd, but my  
C knowledge is very limited as I haven't written any code in C for a  
long time.

What I already have is a git repo with the libvhd code extracted from  
the xen-unstable tree with the blocktap2 patches applied.
libvhd also comes with vhd-util, a utility to create and modify vhd  
images.
I have only tried to compile it on ubuntu 8.10, so it might not work  
on your system.

The git repo is hosted on github: http://github.com/schmidp/libvhd/tree/master

Are there any docs about how to implement a block driver for qemu?
As far as I have seen from the qemu code, block_int.h defines the  
interface and you register your driver in block.c, but that is all  
I've found out so far.

I will try to implement a synchrones driver first as it seems more  
simple...


greets Philipp

ps: I'm not affiliated with citrix in any way

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

* Re: [Qemu-devel] Citrix VHD implementation
  2009-02-28 18:56 [Qemu-devel] Citrix VHD implementation Philipp Schmid
@ 2009-03-02 11:41 ` Stefano Stabellini
  2009-03-02 11:55   ` Daniel P. Berrange
  2009-03-02 14:18 ` Anthony Liguori
  2009-03-02 17:41 ` Kevin Wolf
  2 siblings, 1 reply; 5+ messages in thread
From: Stefano Stabellini @ 2009-03-02 11:41 UTC (permalink / raw)
  To: qemu-devel@nongnu.org

Philipp Schmid wrote:

> Hi,
> 
> as some of you might know, citrix has open sourced the library they  
> use to read and write to VHD disk images.
> 
> I'm trying to implementing a block-vhd driver on top of libvhd, but my  
> C knowledge is very limited as I haven't written any code in C for a  
> long time.
> 
> What I already have is a git repo with the libvhd code extracted from  
> the xen-unstable tree with the blocktap2 patches applied.
> libvhd also comes with vhd-util, a utility to create and modify vhd  
> images.
> I have only tried to compile it on ubuntu 8.10, so it might not work  
> on your system.
> 
> The git repo is hosted on github: http://github.com/schmidp/libvhd/tree/master
> 
> Are there any docs about how to implement a block driver for qemu?
> As far as I have seen from the qemu code, block_int.h defines the  
> interface and you register your driver in block.c, but that is all  
> I've found out so far.
> 
> I will try to implement a synchrones driver first as it seems more  
> simple...

Why don't you just use blktap2 to create a raw device from the vhd file
and then open the raw device in qemu?

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

* Re: [Qemu-devel] Citrix VHD implementation
  2009-03-02 11:41 ` Stefano Stabellini
@ 2009-03-02 11:55   ` Daniel P. Berrange
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrange @ 2009-03-02 11:55 UTC (permalink / raw)
  To: qemu-devel

On Mon, Mar 02, 2009 at 11:41:25AM +0000, Stefano Stabellini wrote:
> Philipp Schmid wrote:
> 
> > Hi,
> > 
> > as some of you might know, citrix has open sourced the library they  
> > use to read and write to VHD disk images.
> > 
> > I'm trying to implementing a block-vhd driver on top of libvhd, but my  
> > C knowledge is very limited as I haven't written any code in C for a  
> > long time.
> > 
> > What I already have is a git repo with the libvhd code extracted from  
> > the xen-unstable tree with the blocktap2 patches applied.
> > libvhd also comes with vhd-util, a utility to create and modify vhd  
> > images.
> > I have only tried to compile it on ubuntu 8.10, so it might not work  
> > on your system.
> > 
> > The git repo is hosted on github: http://github.com/schmidp/libvhd/tree/master
> > 
> > Are there any docs about how to implement a block driver for qemu?
> > As far as I have seen from the qemu code, block_int.h defines the  
> > interface and you register your driver in block.c, but that is all  
> > I've found out so far.
> > 
> > I will try to implement a synchrones driver first as it seems more  
> > simple...
> 
> Why don't you just use blktap2 to create a raw device from the vhd file
> and then open the raw device in qemu?

There is no blktap unless you have Xen userspace and the Xen kernel
installed. Having a native vhd QEMU driver would avoid the need to
install Xen just to use VHD format images under non-Xen QEMU/KVM.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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

* Re: [Qemu-devel] Citrix VHD implementation
  2009-02-28 18:56 [Qemu-devel] Citrix VHD implementation Philipp Schmid
  2009-03-02 11:41 ` Stefano Stabellini
@ 2009-03-02 14:18 ` Anthony Liguori
  2009-03-02 17:41 ` Kevin Wolf
  2 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2009-03-02 14:18 UTC (permalink / raw)
  To: qemu-devel

Philipp Schmid wrote:
> Hi,
>
> as some of you might know, citrix has open sourced the library they 
> use to read and write to VHD disk images.
>
> I'm trying to implementing a block-vhd driver on top of libvhd, but my 
> C knowledge is very limited as I haven't written any code in C for a 
> long time.
>
> What I already have is a git repo with the libvhd code extracted from 
> the xen-unstable tree with the blocktap2 patches applied.
> libvhd also comes with vhd-util, a utility to create and modify vhd 
> images.
> I have only tried to compile it on ubuntu 8.10, so it might not work 
> on your system.
>
> The git repo is hosted on github: 
> http://github.com/schmidp/libvhd/tree/master

I took a look at the libvhd code.  I don't think I'd want to replace the 
QEMU vpc code with it so if you plan on pushing your work upstream 
eventually, you may want to consider other options.

The libvhd code provides a synchronous IO interface.  While it's 
relatively clean wrt using a global context, you'd have to hold a lock 
to ensure thread safety if you were to attempt to make it asynchronous 
with threads.  Because the read function blocks (while you were holding 
the global context lock), it's more or less impossible to use threads to 
make it asynchronous while supporting multiple requests.

The sum of this means that it's not going to fit into QEMU very well and 
doesn't make sense as a long term mechanism for VHD support in QEMU.

Ideally, the libvhd code would be implemented entirely with asynchronous 
IO functions that could be pluggable.  That's quite a different beast 
though from the current implementation.

Regards,

Anthony Liguori

> Are there any docs about how to implement a block driver for qemu?
> As far as I have seen from the qemu code, block_int.h defines the 
> interface and you register your driver in block.c, but that is all 
> I've found out so far.
>
> I will try to implement a synchrones driver first as it seems more 
> simple...
>
>
> greets Philipp
>
> ps: I'm not affiliated with citrix in any way
>
>
>

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

* Re: [Qemu-devel] Citrix VHD implementation
  2009-02-28 18:56 [Qemu-devel] Citrix VHD implementation Philipp Schmid
  2009-03-02 11:41 ` Stefano Stabellini
  2009-03-02 14:18 ` Anthony Liguori
@ 2009-03-02 17:41 ` Kevin Wolf
  2 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2009-03-02 17:41 UTC (permalink / raw)
  To: Philipp Schmid; +Cc: qemu-devel

Hi Philipp,

Philipp Schmid schrieb:
> as some of you might know, citrix has open sourced the library they use
> to read and write to VHD disk images.
>
> I'm trying to implementing a block-vhd driver on top of libvhd, but my C
> knowledge is very limited as I haven't written any code in C for a long
> time.

qemu already has a basic driver for VHD images. It's called block-vpc  
and currently works with dynamic disks. If you want to improve VHD  
support in qemu, I think you should start there. It's completely  
synchronous (changing this could be one of the next steps) and small  
enough to be easy to start with.

> Are there any docs about how to implement a block driver for qemu?
> As far as I have seen from the qemu code, block_int.h defines the
> interface and you register your driver in block.c, but that is all I've
> found out so far.

It's more or less all you need. ;-)

Kevin

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

end of thread, other threads:[~2009-03-02 17:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-28 18:56 [Qemu-devel] Citrix VHD implementation Philipp Schmid
2009-03-02 11:41 ` Stefano Stabellini
2009-03-02 11:55   ` Daniel P. Berrange
2009-03-02 14:18 ` Anthony Liguori
2009-03-02 17:41 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).