[linux-lvm] metadata format processing

Dieter Stüken stueken at conterra.de
Mon Sep 12 14:22:59 UTC 2005

I want to develop a tool to get a graphical representation of my LVM configuration.
I thought about parsing the output of lvm commands, or even using the C-API directly.
Unfortunately I did not found a way to enforce read only access when using the API.
All user space tools have to run as root and may modify/destroy my LVM. So I think
they are a bad choice to build any CGI-scripts upon. Finally I discovered the external
metadata format, which describes any aspects of my LVM in detail. After I even found
a parser for this syntax within the LVM libs, I was able to convert the metadata
into XML. Once having XML it should be possible to transfer any informations towards

My very first try looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
   <contents>Text Format Volume Group</contents>
   <description>Created *after* executing 'lvextend /dev/raster/eglv -l 7452 /dev/sdg1'</description>
   <group name="raster">
     <group name="physical_volumes">
       <group name="pv0">
       <group name="pv1">
     <group name="logical_volumes">
       <group name="eglv">
         <group name="segment1">

I manually shortened it, just as an example...

I used the parser to get it into a "struct config_tree" and developed
some procedure to dump it out as XML. There are some aspects that can be
discussed (why are all nesting elements simply called <group> whereas
arrays are not grouped ...)

I'm just about to learn XSLT to get this processed further.

Is some one interested to participate?

Dieter Stüken, con terra GmbH, Münster
     stueken at conterra.de

More information about the linux-lvm mailing list