On Thu, Jun 14, 2007 at 05:55:33PM +0200, Jim Meyering wrote:
"Richard W.M. Jones" <rjones(a)redhat.com> wrote:
...
> From the virt-manager/libvirt p.o.v. it seems to me the important
> operations are:
>
> (1) Find attached drives.
>
> (2) Find partitions available & their sizes.
>
> (3) Allocate logical volumes.
>
> (4) Find out how much free space is available on a partition, and
> carve out a file.
How about creating a regular partition,
or resizing an existing (non-LVM) file system?
> Correct me if I'm wrong (I usually am), but:
>
> Nothing can do (1) except doing a brute force scan over /dev and
> looking for likely block devices (this is what vgscan does).
>
> Parted can do (2), with several limitations including sector size. It
> can't do (3) at all, but then neither can anything else except forking
> the LVM command line tools.
>
> And (4) can be done by libvirtd using ordinary POSIX calls, so no
> external library support is needed, just some work to remote those
> operations (which is mostly done).
Isn't doing #4 portably pretty tricky? There's still too much
variation, because many of the details aren't covered by POSIX.
At least for GNU df, it was -- it uses the mountlist module from gnulib:
We don't need to enumerate all the mount points. The admin will simply
configure particulra directories (eg /var/lib/xen/images) as storage
repositories. So we only need to be able to call statfs/statvfs on
particular paths where we want to create a new image.
Of course, if your target is just Linux, then it is easier.
Minimally we have to target Solaris too, since we know they already use
libvirt.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|