Bug 1844341

Summary: The duplicate block device is listed when iface is set to 'virtio'
Product: Red Hat Enterprise Linux 9 Reporter: YongkuiGuo <yoguo>
Component: libguestfsAssignee: Laszlo Ersek <lersek>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: lersek, ptoscano, rjones, virt-maint
Target Milestone: rcKeywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.48.4-2.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 09:52:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
guestfish log none

Description YongkuiGuo 2020-06-05 07:00:50 UTC
Created attachment 1695376 [details]
guestfish log

Description of problem:
The duplicate block device is listed when iface is set to 'virtio'.


Version-Release number of selected component (if applicable):
libguestfs-1.42.0-1.module+el8.3.0+6496+d39ac712.x86_64
qemu-kvm-4.2.0-19.module+el8.3.0+6478+69f490bb.x86_64
kernel-4.18.0-208.el8.x86_64


How reproducible:
100%


Steps:

1. On rhel8.3 host
# qemu-img create virtio.img 1G
Formatting 'virtio.img', fmt=raw size=1073741824

2.
# LIBGUESTFS_BACKEND=direct guestfish

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: ‘help’ for help on commands
      ‘man’ to read the manual
      ‘quit’ to quit the shell

><fs> add-drive virtio.img iface:virtio
><fs> run
><fs> list-devices
/dev/sda
/dev/sda
><fs> list-filesystems
/dev/sda: unknown
/dev/sda: unknown
><fs> quit


Actual results:
as above

Expected results:
Only one block device(/dev/sda) is listed.


Additional info:
No problem when iface is set to 'ide'

Comment 1 Richard W.M. Jones 2020-06-05 09:54:50 UTC
One line reproducer is:

$ LIBGUESTFS_BACKEND=direct guestfish add-drive /dev/null iface:virtio : run : list-devices
/dev/sda
/dev/sda

The libvirt backend has never allowed the iface parameter.  We should
probably ignore it in the direct backend since it's never been possible
to use this parameter correctly.

Comment 2 YongkuiGuo 2020-06-05 10:02:13 UTC
(In reply to Richard W.M. Jones from comment #1)
> One line reproducer is:
> 
> $ LIBGUESTFS_BACKEND=direct guestfish add-drive /dev/null iface:virtio : run
> : list-devices
> /dev/sda
> /dev/sda
> 
> The libvirt backend has never allowed the iface parameter.  We should
> probably ignore it in the direct backend since it's never been possible
> to use this parameter correctly.

Ok, i see. Thanks you.

Comment 4 Eric Hadley 2021-09-08 16:42:26 UTC
Bulk update: Move RHEL-AV bugs to RHEL9. If necessary to resolve in RHEL8, then clone to the current RHEL8 release.

Comment 6 RHEL Program Management 2021-12-05 07:26:58 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 7 Richard W.M. Jones 2021-12-06 08:27:51 UTC
This bug was closed in error by a process we do not control.

Comment 8 Laszlo Ersek 2022-05-04 13:42:36 UTC
[libguestfs PATCH 0/4] ignore "iface" in "add-drive" variants
Message-Id: <20220504134155.11832-1-lersek>
https://listman.redhat.com/archives/libguestfs/2022-May/028802.html

Comment 9 Laszlo Ersek 2022-05-05 11:09:23 UTC
(In reply to Laszlo Ersek from comment #8)
> [libguestfs PATCH 0/4] ignore "iface" in "add-drive" variants
> Message-Id: <20220504134155.11832-1-lersek>
> https://listman.redhat.com/archives/libguestfs/2022-May/028802.html

Upstream commit range 4864d21cb8eb..ddf276884c04.

Comment 10 YongkuiGuo 2022-05-13 04:47:52 UTC
Test with libguestfs-1.48.2-2.el9.x86_64 on RHEL9.1 host:

$ LIBGUESTFS_BACKEND=direct guestfish add-drive /dev/null iface:virtio : run : list-devices
/dev/sda

The result is expected.

Comment 13 YongkuiGuo 2022-07-08 02:53:05 UTC
Verified this bug since the test case for this bug has been automated and passed in the latest nightly compose test.

Comment 15 errata-xmlrpc 2022-11-15 09:52:35 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 (Low: libguestfs security, 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/RHSA-2022:7958