Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug
QEMU fail to check whether duplicate ID for block device drive using 'blockde...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Kevin Wolf
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-16 04:01 EDT by Sibiao Luo
Modified: 2015-03-05 03:06 EST (History)
12 users (show)

See Also:
Fixed In Version: qemu-kvm-1.5.3-79.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-05 03:06:25 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0349 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2015-03-05 07:27:34 EST

  None (edit)
Description Sibiao Luo 2014-04-16 04:01:58 EDT
Description of problem:
QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug.
BTW, original '__com.redhat_drive_add' command which did not hit such issue.

host info:
# uname -r && rpm -q qemu-kvm
3.10.0-121.el7.x86_64
qemu-kvm-1.5.3-60.el7.x86_64
guest info:
# uname -r
3.10.0-121.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.launch a KVM guest.
2.using 'blockdev-add' to hotplug with duplicate ID for block device drive.
{ "execute": "blockdev-add", "arguments": {'options' : {'driver': 'raw', 'id':'drive-disk1', 'read-only': true, 'discard':'unmap', 'file': {'driver': 'file', 'filename': '/home/my-data-disk.raw'}, 'cache': { 'writeback': false, 'direct': true, 'no-flush': false }}} }
{"return": {}}

{ "execute": "blockdev-add", "arguments": {'options' : {'driver': 'qcow2', 'id':'drive-disk1', 'read-only': true, 'discard':'unmap', 'file': {'driver': 'file', 'filename': '/home/my-data-disk.qcow2'}, 'cache': { 'writeback': false, 'direct': true, 'no-flush': false }}} }
{"return": {}}

(qemu) info block
drive-system-disk: removable=0 io-status=ok file=/home/RHEL-7.0-20140409.0_Server_x86_64.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
drive-disk1: removable=1 locked=0 tray-open=0 file=/home/my-data-disk.raw ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-disk1: removable=1 locked=0 tray-open=0 file=/home/my-data-disk.qcow2 ro=1 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
(qemu) 

{"execute":"__com.redhat_drive_del","arguments":{"id":"drive-disk1"}}
{"return": {}}
{"execute":"__com.redhat_drive_del","arguments":{"id":"drive-disk1"}}
{"return": {}}
{"execute":"__com.redhat_drive_del","arguments":{"id":"drive-disk1"}}
{"error": {"class": "DeviceNotFound", "desc": "Device 'drive-disk1' not found"}}

Actual results:


Expected results:
QEMU should check whether duplicate ID for block device drive using 'blockdev-add' to hotplug, just like original '__com.redhat_drive_add' command.
{"execute":"__com.redhat_drive_add","arguments": {"file":"/home/my-data-disk.raw","format":"raw","id":"drive-data-disk","aio":"native","werror":"stop","rerror":"stop"}}
{"return": {}}
{"execute":"__com.redhat_drive_add","arguments": {"file":"/home/my-data-disk.qcow2","format":"qcow2","id":"drive-data-disk","aio":"native","werror":"stop","rerror":"stop"}}
{"error": {"class": "GenericError", "desc": "Duplicate ID 'drive-data-disk' for drive"}}

Additional info:
# /usr/libexec/qemu-kvm -M pc -cpu host -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name sluo -uuid 990ea161-6b67-47b2-b803-19fb01d30d30 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/home/RHEL-7.0-20140409.0_Server_x86_64.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=00:01:02:B6:40:21,bus=pci.0,addr=0x5 -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x6 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -k en-us -boot menu=on -qmp tcp:0:4444,server,nowait -spice disable-ticketing,port=5931 -monitor stdio
Comment 1 Kevin Wolf 2014-04-25 08:17:24 EDT
Fixed in upstream commit f2d953ec. The 7.1 rebase will take care of it.
Comment 4 langfang 2014-09-04 22:59:37 EDT
Test on latest qemu-kvm version

AMD machine & win2008 guest

Host:
# uname -r
3.10.0-147.el7.x86_64
# rpm -q qemu-kvm
qemu-kvm-1.5.3-69.el7.x86_64

Steps as same as comment3

Resutls:
...
{ "execute": "blockdev-add", "arguments": {'options' : {'driver': 'raw', 'id':'drive-disk1', 'read-only': true, 'discard':'unmap', 'file': {'driver': 'file', 'filename': '/home/my-data-disk.raw'}, 'cache': { 'writeback': false, 'direct': true, 'no-flush': false }}} }
{"return": {}}
{ "execute": "blockdev-add", "arguments": {'options' : {'driver': 'qcow2', 'id':'drive-disk1', 'read-only': true, 'discard':'unmap', 'file': {'driver': 'file', 'filename': '/home/my-data-disk.qcow2'}, 'cache': { 'writeback': false, 'direct': true, 'no-flush': false }}} }
{"return": {}}

(qemu) info block
...
drive-disk1: removable=1 locked=0 tray-open=0 file=/home/my-data-disk.raw ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-disk1: removable=1 locked=0 tray-open=0 file=/home/my-data-disk.qcow2 ro=1 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
(qemu) 

According to above test ,this bug not fixed on qemu-kvm version.

Hi,Kevin
   Please help see comment3 and comment4

thanks
Comment 5 Miroslav Rezanina 2014-11-12 06:26:33 EST
Fix included in qemu-kvm-1.5.3-79.el7
Comment 6 Sibiao Luo 2014-11-20 03:10:53 EST
Verify this issue with the same steps as comment #0.

#######qemu-kvm-1.5.3-79.el7.x86_64.
host info:
# uname -r && rpm -q qemu-kvm
3.10.0-205.el7.x86_64
qemu-kvm-1.5.3-79.el7.x86_64

{"execute":"qmp_capabilities"}
{"return": {}}
{ "execute": "blockdev-add", "arguments": {'options' : {'driver': 'raw', 'id':'drive-disk1', 'read-only': true, 'discard':'unmap', 'file': {'driver': 'file', 'filename': '/home/my-data-disk.raw'}, 'cache': { 'writeback': false, 'direct': true, 'no-flush': false }}} }
{"return": {}}
{ "execute": "blockdev-add", "arguments": {'options' : {'driver': 'raw', 'id':'drive-disk1', 'read-only': true, 'discard':'unmap', 'file': {'driver': 'file', 'filename': '/home/my-data-disk.raw'}, 'cache': { 'writeback': false, 'direct': true, 'no-flush': false }}} }
{"error": {"class": "GenericError", "desc": "Device with id 'drive-disk1' already exists"}}

#######qemu-kvm-rhev-2.1.2-8.el7.x86_64
host info:
# uname -r && rpm -q qemu-kvm-rhev
3.10.0-205.el7.x86_64
qemu-kvm-rhev-2.1.2-8.el7.x86_64

{ "execute": "blockdev-add", "arguments": {'options' : {'driver': 'raw', 'id':'drive-disk1', 'read-only': true, 'discard':'unmap', 'file': {'driver': 'file', 'filename': '/home/my-data-disk.raw'}, 'cache': { 'writeback': false, 'direct': true, 'no-flush': false }}} }
{"return": {}}
{ "execute": "blockdev-add", "arguments": {'options' : {'driver': 'qcow2', 'id':'drive-disk1', 'read-only': true, 'discard':'unmap', 'file': {'driver': 'file', 'filename': '/home/my-data-disk.qcow2'}, 'cache': { 'writeback': false, 'direct': true, 'no-flush': false }}} }
{"error": {"class": "GenericError", "desc": "Device with id 'drive-disk1' already exists"}}

Base on above, this issue has been fixed correctly, move to VERIFIED status.

Best Regards,
sluo
Comment 8 errata-xmlrpc 2015-03-05 03:06:25 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0349.html

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