John Levon wrote:
On Thu, Sep 27, 2007 at 07:07:00PM +0100, Richard W.M. Jones wrote:(2) It only understands a limited set of partition types. Assuming that the files and partitions that we get back from libvirt / Xen correspond to block devices in the guests, we can go some way towards manually parsing those partitions to find out what they contain. We can read the MBR, EBR, superblocks and so on. However that's a lot of parsing work, and currently there is no library which understands a wide range of partition schemes and filesystem types (not even libparted which doesn't support LVM yet). The Linux kernel does support that, but there's not really any good way to access that work.Note that extending libfsimage would be the way to go for the latter part of this (understanding file systems), I think.
Yes ... There are (at least) four separate reimplementations of filesystem / partition parsing code:
- fdisk - libparted - grub (from which libfsimage seems to be derived) - Linux kernelUnfortunately libparted & GRUB don't understand LVM which is kind of a problem because everyone's using LVM nowadays. (Well, everyone in the Linux world, obviously different on Solaris).
There is some work that I'm aware of to "librarify" LVM and to get LVM support into libparted.
Having said all that, the hand-written code I wrote deals with MBRs, EBRs and ext2/3 and it's under 600 lines of code, and even with LVM support I can't see it going over 1,500 lines in total.
The big question is what sort of API could libvirt export? For the general provisioning scenario, perhaps it would be something like this:
https://www.redhat.com/archives/libvir-list/2007-September/thread.html#00119Reading and understanding the contents of block devices OTOH is way beyond what libvirt can or ought to provide. Instead it can export a way to snoop on the contents of the block devices (simple operations like: read the size, seek to an offset, read some bytes); then we could extend libparted to abstract away the Unix syscalls so it can work on the libvirt "virtual block device".
Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list