Red Hat Bugzilla – Bug 470693
Colon as a delimiter to parse the 'lvs' is not always working
Last modified: 2010-03-16 13:16:08 EDT
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.
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:
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
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...
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...
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)
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.
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 ':'.
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.
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.
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.
Created attachment 323389 [details]
Switch the delimiter to a comma
Niklas, can you test this patch and see if it fixes your problem?
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!
This was fixed upstream and is in version 0.5.0:
Closing as UPSTREAM.