Bug 470693 - Colon as a delimiter to parse the 'lvs' is not always working
Colon as a delimiter to parse the 'lvs' is not always working
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Veillard
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-08 18:12 EST by Niklas Hagman
Modified: 2010-03-16 13:16 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-12-02 11:39:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Niklas Hagman 2008-11-08 18:12:31 EST
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">
  <name>vg</name>
  <source>
    <name>vg</name>
  </source>
  <target>
    <path>/dev/vg</path>
  </target>
</pool>
Comment 1 Cole Robinson 2008-11-10 09:41:31 EST
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 18:19:43 EST
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 15:03:34 EST
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 15:21:01 EST
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 15:45:36 EST
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:
  root:6V34m5-Jvrt-Mbdp-wgiY-DiMk-ssZk-xFoqFq:/dev/block/254:0(0):9663676416:4194304

Fedora output:
lvhome:fktHK1-MC62-tjuz-AxrR-js47-waBp-6clGPh:/dev/sda2(0):50331648000:33554432

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 16:29:19 EST
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 16:45:20 EST
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 16:49:44 EST
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 16:32:51 EST
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 02:28:12 EST
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 11:39:44 EST
This was fixed upstream and is in version 0.5.0:

http://git.et.redhat.com/?p=libvirt.git;a=commit;h=c6b0d780cc0b245226e668bada94d02bf4cd9831

Closing as UPSTREAM.

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