Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1088176

Summary: QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: chayang, famz, flang, juzhang, kwolf, michen, mrezanin, pbonzini, qzhang, rbalakri, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 08:06:25 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 Sibiao Luo 2014-04-16 08:01:58 UTC
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 12:17:24 UTC
Fixed in upstream commit f2d953ec. The 7.1 rebase will take care of it.

Comment 4 langfang 2014-09-05 02:59:37 UTC
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 11:26:33 UTC
Fix included in qemu-kvm-1.5.3-79.el7

Comment 6 Sibiao Luo 2014-11-20 08:10:53 UTC
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 08:06:25 UTC
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