[Libvir] Re: parted/LVM for ET [Storage manager initial requirements and thoughts

Jim Meyering jim at meyering.net
Thu Jun 14 15:55:33 UTC 2007


"Richard W.M. Jones" <rjones at 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:

    http://www.gnu.org/software/gnulib/MODULES.html

the big pieces:

    http://cvs.sv.gnu.org/viewcvs/gnulib/lib/mountlist.c?root=gnulib&view=markup
    http://cvs.sv.gnu.org/viewcvs/gnulib/m4/ls-mntd-fs.m4?root=gnulib&view=markup

Of course, if your target is just Linux, then it is easier.




More information about the libvir-list mailing list