Bug 1835528 - It is failed hotplug device but get DEVICE_DELETED event under hotplug=off controller
Summary: It is failed hotplug device but get DEVICE_DELETED event under hotplug=off co...
Keywords:
Status: CLOSED CURRENTRELEASE
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: jingzhao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-14 01:44 UTC by qing.wang
Modified: 2020-12-20 05:43 UTC (History)
7 users (show)

Fixed In Version: qemu-kvm-4.2.0-27.module+el8.2.1+7092+9d345e72
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-06-30 11:28:04 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description qing.wang 2020-05-14 01:44:55 UTC
Description of problem:

There is DEVICE_DELETED event when hotplug disk under hotplug=off controller.

Version-Release number of selected component (if applicable):

 
4.18.0-193.2.1.el8_2.x86_64
qemu-kvm-core-4.2.0-21.module+el8.2.1+6586+8b7713b9.x86_64


How reproducible:
100%

Steps to Reproduce:

1.Create images (only execute one time)
 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/stg3.qcow2 3G
  qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg4.qcow2 4G
  qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg5.qcow2 5G
  qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg6.qcow2 6G
  qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg7.qcow2 7G
  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.hotplug disks
{'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"}

4.check disk in guest
only stg4 added in guest

Actual results:
On step3:

{"timestamp": {"seconds": 1589419726, "microseconds": 726098}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/stg3/virtio-backend"}}
{"id": "t07OBwF3", "error": {"class": "GenericError", "desc": "Hot-plug failed: unsupported by the port device 'pcie_port_3'"}}
{"return": {}, "id": "t07OBwF4"}


Expected results:
If hotplug is failed for any reason, it should not generate DEVICE_DELETED event.

Additional info:
Bug 1820531 - qmp command query-pci get wrong result after hotplug device under hotplug=off controller

Comment 1 John Ferlan 2020-05-15 17:11:36 UTC
Amnon - this looks related to a number of other recently assigned hotplug=off bugs I've sent your way - trying to keep them all together.

Comment 2 qing.wang 2020-06-29 09:23:53 UTC
Test on:
Host:
qemu-kvm-common-4.2.0-27.module+el8.2.1+7092+9d345e72.x86_64
4.18.0-193.10.1.el8_2.x86_64

Guest:4.18.0-193.el8.x86_64


Test steps:
1.Create images (only execute one time)
 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/stg3.qcow2 3G
  qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg4.qcow2 4G
  qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg5.qcow2 5G
  qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg6.qcow2 6G
  qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg7.qcow2 7G
  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.hotplug disks
{'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"}


{"id": "t07OBwF3", "error": {"class": "GenericError", "desc": "Hot-plug failed: unsupported by the port device 'pcie_port_3'"}}


4.check output with query command and guest
{"execute":"query-block"}
{"execute":"query-pci"}
lsblk

5.hotunplg disks
{"execute":"device_del","arguments":{"id":"stg1"}}
{"execute":"device_del","arguments":{"id":"stg2"}}

{"error": {"class": "GenericError", "desc": "Hot-unplug failed: unsupported by the port device 'pcie_port_1'"}}
{"timestamp": {"seconds": 1593418237, "microseconds": 633700}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/stg2/virtio-backend"}}
{"timestamp": {"seconds": 1593418237, "microseconds": 922377}, "event": "DEVICE_DELETED", "data": {"device": "stg2", "path": "/machine/peripheral/stg2"}}


6.check output with query command and guest
{"execute":"query-block"}
stg2 not in output

{"execute":"query-pci"}

lsblk

No issue found.
It also passed test on guest win2019


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