Bug 619793 - [RFE] Need a way to determine if a particular block device is a logical volume
Summary: [RFE] Need a way to determine if a particular block device is a logical volume
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 619826
TreeView+ depends on / blocked
 
Reported: 2010-07-30 14:46 UTC by Matthew Booth
Modified: 2010-09-22 09:33 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 619826 (view as bug list)
Environment:
Last Closed: 2010-07-30 16:03:17 UTC
Embargoed:


Attachments (Terms of Use)

Description Matthew Booth 2010-07-30 14:46:54 UTC
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):
libguestfs-1.5.0-4.fc13.x86_64

Comment 1 Richard W.M. Jones 2010-07-30 15:40:48 UTC
Patch posted upstream:
https://www.redhat.com/archives/libguestfs/2010-July/msg00086.html

Comment 2 Richard W.M. Jones 2010-07-30 16:03:17 UTC
Pushed upstream:
http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=6280ac9b987c14f89749b4b4fdfec5a647567432

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.