Bug 619793 - [RFE] Need a way to determine if a particular block device is a logical volume
[RFE] Need a way to determine if a particular block device is a logical volume
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
Depends On:
Blocks: 619826
  Show dependency treegraph
Reported: 2010-07-30 10:46 EDT by Matthew Booth
Modified: 2010-09-22 05:33 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 619826 (view as bug list)
Last Closed: 2010-07-30 12:03:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Matthew Booth 2010-07-30 10:46:54 EDT
Description of problem:
I need a robust, reliable way to determine if a particular block device is a logical volume when inspecting a guest. This rules out methods based on path name inspection, as these paths can be changed by configuration and vary between distributions.

My chosen solution to this problem is to stat every device returned by lvs(), and to stat the target device, and test if the major and minor numbers of the target appear in the list returned by lvs(). This avoid any issues relating to path names. However, it is complicated because stat() doesn't chroot, and therefore you can't stat a device node. I'm doing sh("stat...") to work round this, which is ugly.

I don't know what the best approach to this is. It could be a new is_lvm_device(dev), a change to the existing stat() api to work on device nodes, a new api to stat device nodes(), or something else.

However, I'm slightly concerned that this use case is quite esoteric. I can't think of any previous occasion using libguestfs or otherwise when I have been concerned to know whether or not a block device is a logical volume. The high-level api may be extremely under-used, meaning an implementation in virt-v2v is more appropriate.

Version-Release number of selected component (if applicable):
Comment 1 Richard W.M. Jones 2010-07-30 11:40:48 EDT
Patch posted upstream:
Comment 2 Richard W.M. Jones 2010-07-30 12:03:17 EDT
Pushed upstream:

Matt, you'd better clone this bug for RHEL 6.

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