Bug 2209280

Summary: RFE: virt-inspector should recognize device pathnames like '/dev/mapper/rhel boot--73--75--123-root' with "--key"
Product: Red Hat Enterprise Linux 9 Reporter: Laszlo Ersek <lersek>
Component: guestfs-toolsAssignee: Laszlo Ersek <lersek>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.2CC: chhu, hongzliu, juzhou, lersek, mxie, qzhang, rjones, tyan, tzheng, virt-bugs, virt-maint, vwu, xiaodwan, ymao, yoguo
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: guestfs-tools-1.50.1-3.el9 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 2168506 Environment:
Last Closed: 2023-11-07 08:25:09 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2168506    
Bug Blocks:    

Description Laszlo Ersek 2023-05-23 10:29:05 UTC
+++ This bug was initially created as a clone of Bug #2168506 +++

* Description of problem:
virt-inspector should recognize device pathnames like '/dev/mapper/rhel boot--73--75--123-root' in related keys option

* Version-Release number of selected component (if applicable):
guestfs-tools-1.48.2-8.el9.x86_64

* How reproducible:
100%

1.Prepare a guest with LUKS-on-LVM scheme
# lsblk
NAME                                            MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
sda                                               8:0    0   16G  0 disk  
├─sda1                                            8:1    0    1G  0 part  /boot
└─sda2                                            8:2    0   15G  0 part  
  ├─rhel_bootp--73--75--123-root                253:0    0 13.4G  0 lvm   
  │ └─luks-cf19e4ac-3f54-450b-b801-72e539a8f870 253:2    0 13.4G  0 crypt /
  └─rhel_bootp--73--75--123-swap                253:1    0  1.6G  0 lvm   [SWAP]
sr0     
                     
2. Check the disk image with virt-inspector:
# virt-inspector -a disk.img --key "/dev/mapper/rhel_bootp--73--75--123-root":key:redhat123

* Actual results:
virt-inspector asks for the passphrase in spite of the --key option:

Enter key or passphrase ("/dev/rhel_bootp-73-75-123/root"): 

* Expected results:
virt-inspector should understand that "/dev/mapper/rhel_bootp--73--75--123-root" is the same as "/dev/rhel_bootp-73-75-123/root", and produce the output XML without asking for a password

* Additional info:
fixed upstream by commit range 67647b883e13..569bd1dd29da

Comment 6 YongkuiGuo 2023-06-13 03:35:41 UTC
Verified this bug with the package:
guestfs-tools-1.50.1-3.el9.x86_64

Steps:

On rhel9.3 host:
1. Prepare a guest image 'rhel9.3-luks-on-lvm.qcow2'
[root@localhost ~]# lsblk
NAME                                            MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
vda                                             252:0    0   10G  0 disk  
├─vda1                                          252:1    0    1G  0 part  /boot
└─vda2                                          252:2    0    9G  0 part  
  ├─vg----rhel-lv----root                       253:0    0    8G  0 lvm   
  │ └─luks-c45ece75-54d6-4d39-a11a-dcda168f61fd 253:3    0    8G  0 crypt /
  └─vg----rhel-lv----swap                       253:1    0    1G  0 lvm   
    └─luks-d3d68e46-87a3-4e59-9f5d-67495eb2d623 253:2    0 1008M  0 crypt [SWAP]

2.
# virt-inspector -a rhel9.3-luks-on-lvm.qcow2 --key "/dev/mapper/vg----rhel-lv----root":key:redhat --key "/dev/mapper/vg----rhel-lv----swap":key:redhat
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/mapper/luks-c45ece75-54d6-4d39-a11a-dcda168f61fd</root>
    <name>linux</name>
    <arch>x86_64</arch>
    <distro>rhel</distro>
    <product_name>Red Hat Enterprise Linux 9.3 Beta (Plow)</product_name>
    <major_version>9</major_version>
    <minor_version>3</minor_version>
    <package_format>rpm</package_format>
    <package_management>dnf</package_management>
    <osinfo>rhel9.3</osinfo>
    <mountpoints>
      <mountpoint dev="/dev/mapper/luks-c45ece75-54d6-4d39-a11a-dcda168f61fd">/</mountpoint>
      <mountpoint dev="/dev/sda1">/boot</mountpoint>
    </mountpoints>
    <filesystems>
      <filesystem dev="/dev/mapper/luks-c45ece75-54d6-4d39-a11a-dcda168f61fd">
        <type>xfs</type>
        <uuid>60b63f67-0033-47fe-bc98-333a73e2db7c</uuid>
      </filesystem>
      <filesystem dev="/dev/mapper/luks-d3d68e46-87a3-4e59-9f5d-67495eb2d623">
        <type>swap</type>
        <uuid>6f6db93c-c6db-4f36-9471-485ed4886269</uuid>
      </filesystem>
      <filesystem dev="/dev/sda1">
        <type>xfs</type>
        <uuid>0687de84-25c7-4dc3-ab75-0154c2d07c31</uuid>
      </filesystem>
    </filesystems>
    <applications>
      <application>
...

Comment 8 errata-xmlrpc 2023-11-07 08:25:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (guestfs-tools bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6345