Bug 1936361

Summary: Live detach packed vhostuser disk return success but none is deleted
Product: Red Hat Enterprise Linux 9 Reporter: Han Han <hhan>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
qemu-kvm sub component: virtio-blk,scsi QA Contact: qing.wang <qinwang>
Status: CLOSED DUPLICATE Docs Contact:
Severity: medium    
Priority: medium CC: coli, meili, phrdina, virt-maint, xuzhang
Version: 9.0Keywords: 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: Environment:
Last Closed: 2022-01-10 11:44:40 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:

Description Han Han 2021-03-08 09:59:22 UTC
Description of problem:
As subjedct

Version-Release number of selected component (if applicable):
libvirt-7.0.0-8.module+el8.4.0+10233+8b7fd9eb.x86_64
qemu-kvm-5.2.0-10.module+el8.4.0+10217+cbdd2152.x86_64
Guest: kernel-5.11.0-1.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Start an VM
2. Attach the virtio disk with packed=on
Prepare as https://bugzilla.redhat.com/show_bug.cgi?id=1884659#c25

Disk xml:
<disk type='vhostuser' device='disk' snapshot='no'>
  <driver name='qemu' type='raw' packed="on"/>
  <source type='unix' path='/var/lib/libvirt/qemu/vhost.sock'/>
  <target dev='vdb' bus='virtio'/>
</disk>


➜ virsh attach-device rhel packed.xml
Device attached successfully


➜ virsh detach-device rhel packed.xml
Device detached successfully

However the disk is actually not detached:
➜  ~ virsh dumpxml rhel|xmllint --xpath //disk -
<disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/var/lib/libvirt/images/rhel.qcow2" index="1"/>
      <backingStore/>
      <target dev="vda" bus="virtio"/>
      <alias name="virtio-disk0"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x0"/>
    </disk><disk type="vhostuser" device="disk" snapshot="no">
      <driver name="qemu" type="raw" packed="on"/>
      <source type="unix" path="/var/lib/libvirt/qemu/vhost.sock"/>
      <target dev="vdb" bus="virtio"/>
      <alias name="virtio-disk1"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x09" function="0x0"/>
    </disk>#  

The vhostdisk is in VM
[root@fedora ~]# lsblk /dev/vdb
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vdb  252:16   0  100M  0 disk 

QMP log of attach and detach:
613.269 > 0x7f0d28036020 {"execute":"chardev-add","arguments":{"id":"chr-vu-virtio-disk1","backend":{"type":"socket","data":{"addr":{"type":"unix","data":{"path":"/var/lib/libvirt/qemu/vhost.sock"}},"server":false}}},"id":"libvirt-385"}
613.276 < 0x7f0d28036020 {"return": {}, "id": "libvirt-385"}
613.276 > 0x7f0d28036020 {"execute":"device_add","arguments":{"driver":"vhost-user-blk-pci","packed":"on","bus":"pci.0","addr":"0x9","chardev":"chr-vu-virtio-disk1","id":"virtio-disk1"},"id":"libvirt-386"}
614.190 < 0x7f0d28036020 {"return": {}, "id": "libvirt-386"}
614.190 > 0x7f0d28036020 {"execute":"qom-list","arguments":{"path":"/machine/peripheral"},"id":"libvirt-387"}                                                                                             
614.192 < 0x7f0d28036020 {"return": [{"name": "type", "type": "string"}, {"name": "sound0-codec0", "type": "child<hda-duplex>"}, {"name": "virtio-disk1", "type": "child<vhost-user-blk-pci>"}, {"name": "virtio-disk0", "type": "child<virtio-blk-pci>"}, {"name": "virtio-serial0", "type": "child<virtio-serial-pci>"}, {"name": "video0", "type": "child<qxl-vga>"}, {"name": "serial0", "type": "child<isa-serial>"}, {"name": "balloon0", "type": "child<virtio-balloon-pci>"}, {"name": "sound0", "type": "child<intel-hda>"}, {                                                                                         

1162.402 > 0x7f0d28036020 {"execute":"device_del","arguments":{"id":"virtio-disk1"},"id":"libvirt-388"}                                                                                                   
1162.404 < 0x7f0d28036020 {"return": {}, "id": "libvirt-388"}
1167.404 > 0x7f0d28036020 {"execute":"qom-list","arguments":{"path":"/machine/peripheral"},"id":"libvirt-389"}                                                                                            
1167.407 < 0x7f0d28036020 {"return": [{"name": "type", "type": "string"}, {"name": "sound0-codec0", "type": "child<hda-duplex>"}, {"name": "virtio-disk1", "type": "child<vhost-user-blk-pci>"}, {"name": "virtio-disk0", "type": "child<virtio-blk-pci>"}, {"name": "virtio-serial0", "type": "child<virtio-serial-pci>"}, {"name": "video0", "type": "child<qxl-vga>"}, {"name": "serial0", "type": "child<isa-serial>"}, {"name": "balloon0", "type": "child<virtio-balloon-pci>"}, {"name": "sound0", "type": "child<intel-hda>"}, {  


Actual results:
As above

Expected results:
Disk detached

Additional info:
It is only reproduced with vhostuser disk and packed=on.

Comment 1 qing.wang 2021-03-09 01:12:22 UTC
please refer to Bug 1935020 - qemu guest failed boot when attach vhost-user-blk-pci with option packed=on.
I think it have issue to support packed on

Comment 3 John Ferlan 2021-09-08 21:41:36 UTC
Move RHEL-AV bugs to RHEL9. If necessary to resolve in RHEL8, then clone to the current RHEL8 release.

Comment 4 CongLi 2022-01-10 11:44:40 UTC

*** This bug has been marked as a duplicate of bug 1935020 ***