Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2186397

Summary: Disk detach is unsuccessful while the guest is still booting
Product: Red Hat Enterprise Linux 9 Reporter: Xuesong Zhang <xuzhang>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
libvirt sub component: Storage QA Contact: Han Han <hhan>
Status: CLOSED COMPLETED Docs Contact:
Severity: medium    
Priority: medium CC: afazekas, apevec, asyedham, bgibizer, coli, imammedo, jinzhao, jparker, jsuchane, jsuvorov, jusual, juzhang, kchamart, kwolf, lmen, mkletzan, nilal, smooney, thuth, vgoyal, virt-maint, yalzhang, yisun, yiwei
Version: 9.0Keywords: TestOnly, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2087047 Environment:
Last Closed: 2023-11-20 10:57:06 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:
Bug Depends On: 2087047    
Bug Blocks: 2012096    
Attachments:
Description Flags
Reproducing script none

Comment 3 Han Han 2023-04-26 09:02:50 UTC
Created attachment 1960050 [details]
Reproducing script

Reproduced on:
libvirt-9.2.0-1.el9.x86_64
qemu-kvm-7.2.0-14.el9_2.x86_64

+ virsh create rhel-9.2.xml                                                                                                                                              
Domain 'rhel-9.2' created from rhel-9.2.xml                                                                                                                              
                                                                                                                                                                         
+ sleep 3                                                                                                                                                                
+ qemu-img create /tmp/vdb 10M                                                      
Formatting '/tmp/vdb', fmt=raw size=10485760                                        
+ virsh attach-disk rhel-9.2 /tmp/vdb vdb                                           
Disk attached successfully                

+ sleep 3                                 
+ virsh detach-disk rhel-9.2 vdb                                                    
Disk detached successfully                

+ virsh dumpxml rhel-9.2 --xpath //disk/target                                      
+ grep -q vdb                             
+ declare -i RET1=0                       
+ sleep 3                                 
+ virsh detach-disk rhel-9.2 vdb                                                    
error: Failed to detach disk                                                        
error: internal error: unable to execute QEMU command 'device_del': Device virtio-disk1 is already in the process of unplug

+ declare -i RET2=1                       
+ '[' 0 -eq 0 ']'                         
+ '[' 1 -ne 0 ']'                         
+ echo FAIL                               
FAIL

Comment 4 Han Han 2023-05-11 04:42:33 UTC
PASS on libvirt-9.3.0-1.el9.x86_64 qemu-kvm-8.0.0-2.el9.x86_64 
+ virsh create rhel-9.2.xml
Domain 'rhel-9.2' created from rhel-9.2.xml

+ sleep 3
+ qemu-img create /tmp/vdb 10M
Formatting '/tmp/vdb', fmt=raw size=10485760
+ virsh attach-disk rhel-9.2 /tmp/vdb vdb
Disk attached successfully

+ sleep 3
+ virsh detach-disk rhel-9.2 vdb
Disk detached successfully

+ virsh dumpxml rhel-9.2 --xpath //disk/target
+ grep -q vdb
+ declare -i RET1=0
+ virsh event --domain rhel-9.2 --event agent-lifecycle
event 'agent-lifecycle' for domain 'rhel-9.2': state: 'connected' reason: 'channel event'
events received: 1

+ virsh detach-disk rhel-9.2 vdb
Disk detached successfully

+ declare -i RET2=0
+ '[' 0 -eq 0 ']'
+ '[' 0 -ne 0 ']'
+ echo PASS
PASS
+ exit 0

Comment 5 Thomas Huth 2023-11-20 10:57:06 UTC
Now that 9.3 has been released, I think this can be closed.