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: rc   
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.