Bug 1820532 - qmp command query-block get wrong result after hotplug device under hotplug=off controller
Summary: qmp command query-block get wrong result after hotplug device under hotplug=o...
Keywords:
Status: CLOSED DUPLICATE of bug 1820531
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: qemu-kvm
Version: 8.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.3
Assignee: Julia Suvorova
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-03 10:06 UTC by qing.wang
Modified: 2020-04-24 13:53 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-24 13:53:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description qing.wang 2020-04-03 10:06:11 UTC
Description of problem:
hotplug device under hotplug=off controller, the device do not really hotplug in guest, there is no relevant devices in guest. but using qmp command query-block may get the disk. 

Version-Release number of selected component (if applicable):
host:
4.18.0-193.el8.x86_64
qemu-kvm-core-5.0.0-0.scrmod+el8.2.0+6151+7a36dcb6.wrb200401.x86_64

How reproducible:
100%

Steps to Reproduce:

1.create images with different size
 qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg1.qcow2 1G
 qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg2.qcow2 2G
 ...
 qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg8.qcow2 8G

2.boot vm 
/usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1' \
    -machine q35  \
    -nodefaults \
    -device VGA,bus=pcie.0,addr=0x1  \
    -device pcie-root-port,id=pcie.0-root-port-2,slot=2,chassis=2,addr=0x2,bus=pcie.0 \
    -device qemu-xhci,id=usb1,bus=pcie.0-root-port-2,addr=0x0 \
    -object iothread,id=iothread0 \
    -device pcie-root-port,id=pcie.0-root-port-3,slot=3,chassis=3,addr=0x3,bus=pcie.0 \
    -device virtio-scsi-pci,id=virtio_scsi_pci,iothread=iothread0,bus=pcie.0-root-port-3,addr=0x0 \
    -drive id=drive_image1,if=none,snapshot=off,aio=threads,cache=none,format=qcow2,file=/home/kvm_autotest_root/images/rhel820-64-virtio-scsi.qcow2 \
    -device scsi-hd,id=image1,drive=drive_image1,bootindex=0 \
    -device pcie-root-port,id=pcie.0-root-port-4,slot=4,chassis=4,addr=0x4,bus=pcie.0 \
    -device virtio-net-pci,mac=9a:ab:fa:09:62:1c,id=idLVRSKI,netdev=idfMN0PL,bus=pcie.0-root-port-4,addr=0x0  \
    -netdev tap,id=idfMN0PL,vhost=on \
    -m 8G  \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -vnc :6  \
    -qmp tcp:0:5956,server,nowait \
    -rtc base=localtime,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off,strict=off \
    -enable-kvm \
    -monitor stdio \
    -blockdev node-name=file_stg1,driver=file,aio=threads,filename=/home/kvm_autotest_root/images/stg1.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_stg1,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_stg1 \
    -blockdev node-name=file_stg2,driver=file,aio=threads,filename=/home/kvm_autotest_root/images/stg2.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_stg2,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_stg2 \
    \
    -blockdev node-name=file_stg3,driver=file,aio=threads,filename=/home/kvm_autotest_root/images/stg3.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_stg3,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_stg3 \
    -blockdev node-name=file_stg4,driver=file,aio=threads,filename=/home/kvm_autotest_root/images/stg4.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_stg4,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_stg4 \
    \
    -blockdev node-name=file_stg5,driver=file,aio=threads,filename=/home/kvm_autotest_root/images/stg5.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_stg5,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_stg5 \
    -blockdev node-name=file_stg6,driver=file,aio=threads,filename=/home/kvm_autotest_root/images/stg6.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_stg6,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_stg6 \
    \
    -blockdev node-name=file_stg7,driver=file,aio=threads,filename=/home/kvm_autotest_root/images/stg7.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_stg7,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_stg7 \
    -blockdev node-name=file_stg8,driver=file,aio=threads,filename=/home/kvm_autotest_root/images/stg8.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_stg8,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_stg8 \
    \
    -device pcie-root-port,id=pcie_port_1,slot=5,chassis=5,addr=0x5,bus=pcie.0,hotplug=off \
    -device virtio-blk-pci,id=stg1,drive=drive_stg1,bus=pcie_port_1,addr=0x0 \
    \
    -device pcie-root-port,id=pcie_port_2,slot=6,chassis=6,addr=0x6,bus=pcie.0,hotplug=on \
    -device virtio-blk-pci,id=stg2,drive=drive_stg2,bus=pcie_port_2,addr=0x0 \
    \
    -device pcie-root-port,id=pcie_port_3,slot=7,chassis=7,addr=0x7,bus=pcie.0,hotplug=off \
    -device pcie-root-port,id=pcie_port_4,slot=8,chassis=8,addr=0x8,bus=pcie.0,hotplug=on \


3.check disk in guest
[root@bootp-73-131-155 ~]# lsblk
NAME                              MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda                                 8:0    0  20G  0 disk 
\u251c\u2500sda1                              8:1    0   1G  0 part /boot
\u2514\u2500sda2                              8:2    0  19G  0 part 
  \u251c\u2500rhel_bootp--73--131--189-root 253:0    0  17G  0 lvm  /
  \u2514\u2500rhel_bootp--73--131--189-swap 253:1    0   2G  0 lvm  [SWAP]
vda                               252:0    0   1G  0 disk 
vdb                               252:16   0   2G  0 disk 


4.hot plug new disks
#qmp
{"execute":"qmp_capabilities"}

{"execute": "device_add", "arguments": {"driver": "virtio-blk-pci", "id": "stg3", "drive": "drive_stg3", "bus": "pcie_port_3"}, "id": "t07OBwF3"}
{"execute": "device_add", "arguments": {"driver": "virtio-blk-pci", "id": "stg4", "drive": "drive_stg4", "bus": "pcie_port_4"}, "id": "t07OBwF4"}


5.check disks in guest

[root@bootp-73-131-155 ~]# lsblk
NAME                              MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda                                 8:0    0  20G  0 disk 
\u251c\u2500sda1                              8:1    0   1G  0 part /boot
\u2514\u2500sda2                              8:2    0  19G  0 part 
  \u251c\u2500rhel_bootp--73--131--189-root 253:0    0  17G  0 lvm  /
  \u2514\u2500rhel_bootp--73--131--189-swap 253:1    0   2G  0 lvm  [SWAP]
vda                               252:0    0   1G  0 disk 
vdb                               252:16   0   2G  0 disk 
vdc                               252:32   0   4G  0 disk 



6.check disk in qmp

{"execute":"query-block"}


Actual results:
{"io-status": "ok", "device": "", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 3221225472, "filename": "/home/kvm_autotest_root/images/stg3.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "drive_stg3", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": true, "writeback": true}, "file": "/home/kvm_autotest_root/images/stg3.qcow2", "encryption_key_missing": false}, "qdev": "/machine/peripheral/stg3/virtio-backend", "type": "unknown"}, 

Expected results:
stg3 not added in guest, it should get sync info with guest via query-block. 

Additional info:

Comment 1 John Ferlan 2020-04-17 18:30:31 UTC
Assigned to Amnon for initial triage per bz process and age of bug created or assigned to virt-maint > 5d

Comment 2 Julia Suvorova 2020-04-24 13:53:35 UTC

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


Note You need to log in before you can comment on or make changes to this bug.