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

Richard W.M. Jones rjones at
Thu Mar 15 13:57:54 UTC 2007

Jim Meyering wrote:
> "Daniel P. Berrange" <berrange at> wrote:
>> On Wed, Mar 14, 2007 at 09:17:37AM +0000, Richard W.M. Jones wrote:
> ...
>>> I did look at the API for libparted a few months ago (actually from the
>>> rather ancient released version on and it didn't look to me
>>> like there was any way to express LVM notions through the API, so I
>>> guess this will require a lot of new API calls and structures?
>> The other option is to simply call the LVM commands directly from libvirt
>> which is what pretty much every app seems todo when they need to talk
>> to LVM. We already do this in the network driver backend to deal with
>> iptables and it isn't all that evil.  If the libparted developers are
>> working on LVM APIs we should encourage them, but its not clear to me that
>> its worth expending our own resources to develop full LVM support in
>> libparted when libvirt will only ever need a tiny number of LVM operations
>> to be invokved.
> If the set of LVM operations required by libvirt is really so small,
> then I'd say it's worth investing in doing the right thing, if only
> to create the tiny API right away.
> With a real library API, libvirt stand a much better chance of properly
> diagnosing, and even detecting, partitioning failures.  Of course,
> when everything works well, there's very little difference, but it's
> when things go wrong that users will thank us.
> Can you give me (an LVM newbie) an idea of what the few libvirt-required
> LVM operations are?

Quoting almost directly from the operations manual at my former 
workplace, the LVM-related operations needed to create a new VM were:

lvcreate -L 3G -n newroot raidvg
lvcreate -L 1G -n newswap raidvg
dd if=/dev/raidvg/oldroot of=/dev/raidvg/newroot
mkswap /dev/raidvg/newswap

(That's right - we used to create new machines by dupping old ones).


Emerging Technologies, Red Hat
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421
  "[Negative numbers] darken the very whole doctrines of the equations
  and make dark of the things which are in their nature excessively
  obvious and simple" (Francis Maseres FRS, mathematician, 1759)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <>

More information about the libvir-list mailing list