Bug 470693 - Colon as a delimiter to parse the 'lvs' is not always working
Summary: Colon as a delimiter to parse the 'lvs' is not always working
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Daniel Veillard
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2008-11-08 23:12 UTC by Niklas Hagman
Modified: 2010-03-16 17:16 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-12-02 16:39:44 UTC

Attachments (Terms of Use)
Logfile from autogen.sh (11.78 KB, application/octet-stream)
2008-11-10 23:19 UTC, Niklas Hagman
no flags Details
Switch the delimiter to a comma (2.45 KB, text/plain)
2008-11-12 21:32 UTC, Cole Robinson
no flags Details

Description Niklas Hagman 2008-11-08 23:12:31 UTC
Description of problem:
Am having problem starting a logical volume pool. It has worked before but stopped starting a couple of months back. I run "pool-start vg" and get error. The output from libvirt is below and so is my xml file. Why is libvirt trying to open /dev/vg/root:6V34m5-Jvrt-Mbdp-wgiY-DiMk-ssZk-xFoqFq when I run "pool-start vg"?

Am using libvirt 0.4.6 compiled from source. Ubuntu 8.10.

Libvirt output:
9 logical volume(s) in volume group "vg" now active
cannot open volume '/dev/vg/root:6V34m5-Jvrt-Mbdp-wgiY-DiMk-ssZk-xFoqFq': No such file or directorylibvir: Storage error : cannot open volume '/dev/vg/root:6V34m5-Jvrt-Mbdp-wgiY-DiMk-ssZk-xFoqFq': No such file or directory
lvs command failedlibvir: Storage error : lvs command failed
Can't deactivate volume group "vg" with 5 open logical volume(s)
libvir: error : /sbin/vgchange exited with non-zero status 5 and signal 0

Volume group storage pool xml:
<pool type="logical">

Comment 1 Cole Robinson 2008-11-10 14:41:31 UTC
I believe there were some regressions in 0.4.6 wrt logical pools. These should be fixed upstream. Can you try with latest upstream?

git clone git://git.et.redhat.com/libvirt.git

Comment 2 Niklas Hagman 2008-11-10 23:19:43 UTC
Created attachment 323132 [details]
Logfile from autogen.sh

Having problem compiling libvirt from git. Am not an expert at this so am probably doing something wrong. See the attachment for my errors. Using ubuntu 8.10 server...

Comment 3 Niklas Hagman 2008-11-11 20:03:34 UTC
I figure out what I was missing. I did not have automake. Sorry about that.

Okay, I tested the latest git and it produces the same error for me. So no go...

Comment 4 Niklas Hagman 2008-11-11 20:21:01 UTC
I can see now that it was a slightly difference in the error output from libvirt taken from git:

libvir: Storage error : internal error cannot open volume '/dev/vg/root:6V34m5-Jvrt-Mbdp-wgiY-DiMk-ssZk-xFoqFq': No such file or directory
libvir: Storage error : internal error lvs command failed
libvir: error : internal error '/sbin/vgchange -an vg' exited with non-zero status 5 and signal 0:   Can't deactivate volume group "vg" with 5 open logical volume(s)

Comment 5 Cole Robinson 2008-11-11 20:45:36 UTC
Okay, we debugged this on IRC.

Libvirt uses the a colon as a delimiter to parse the 'lvs' command when starting a pool. Unfortunately, on ubuntu, lvs prints a colon in the physical device name, so our parsing is all messed up.

Ubuntu output:

Fedora output:

Notice the extra ':' between the device name and (0).

We verified that the use of : is hardcoded, since specifying a different separator (tested with '#') shows the expected output format.

So we should probably change our call in libvirt to not use ':'.

Comment 6 Daniel Berrange 2008-11-11 21:29:19 UTC
Ah, i see the actual device name is "/dev/block/254:0" which is a little wierd. 

While changing the separator will be needed, we may also need to do some extra magic to turn '/dev/block/254:0' back into a /dev/sdXXX  type name. This is because if you have an iSCSI / disk pool you want to be able to correlate LVM pvs against the devices in other pools. 

For separator, using ';' or ',' or '|' would be possible choices.

Comment 7 Niklas Hagman 2008-11-11 21:45:20 UTC
For your information, '/dev/block/254:0' is a encrypted volume with lvm inside. The encrypted volume is mounted with the command "cryptsetup luksOpen /dev/sda cryptroot" that will give the source path "/dev/mapper/cryptroot" for this encrypted volume with lvm inside. After mounting this encrypted volume, ubuntu is setting up lvm2 automatic.

Comment 8 Daniel Berrange 2008-11-11 21:49:44 UTC
Thanks, that's useful info - its almost certainly not Ubuntu specific then - I imagine if we did an encrypted phys device in LVM on Fedora we'd hit the same issue.

Comment 9 Cole Robinson 2008-11-12 21:32:51 UTC
Created attachment 323389 [details]
Switch the delimiter to a comma

Niklas, can you test this patch and see if it fixes your problem?

Comment 10 Niklas Hagman 2008-11-13 07:28:12 UTC
Yes, it seems to work.
virt-manager can see the list of lvs. Have created and deleted a lv from within virt-manager at it works.

But virt-install (within virt-manager) don't allow me to choose a disk as virtual harddrive. But that is another problem/bug.

You can mark this bug solved when ready. Nice done!

Comment 11 Cole Robinson 2008-12-02 16:39:44 UTC
This was fixed upstream and is in version 0.5.0:


Closing as UPSTREAM.

Note You need to log in before you can comment on or make changes to this bug.