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 712266 - Hotplug virtio disk fails with error message "Duplicate ID 'drive-virtio-disk2' for drive"
Summary: Hotplug virtio disk fails with error message "Duplicate ID 'drive-virtio-disk...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: rc
: ---
Assignee: Osier Yang
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-10 03:21 UTC by Min Zhan
Modified: 2013-02-28 13:21 UTC (History)
7 users (show)

Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
No documentaion needed.
Clone Of:
Environment:
Last Closed: 2012-06-20 06:28:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description Min Zhan 2011-06-10 03:21:44 UTC
Description of problem:
For a health guest in virt-manager, hotplug a virtio disk, then error message display:
dialog message: Are you sure you want to add this device? : internal error unable to execute QEMU command '__com.redhat_drive_add': Duplicate ID 'drive-virtio-disk2' for drive

Version-Release number of selected component (if applicable):
libvirt-0.9.1-1.el6.x86_64
virt-manager-0.8.6-4.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1. For a health running guest in virt-manager,

# virsh dumpxml <guest>
<domain type='kvm' id='11'>
  <name>rhel6cd</name>
  <uuid>1b2822fa-3c59-f66c-d662-cbf389403bb9</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.1.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='threads'/>
      <source file='/var/lib/libvirt/images/rhel6cd.img'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/var/lib/libvirt/images/a4.img'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:10:e9:7b'/>
      <source network='default'/>
      <target dev='vnet3'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/3'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5902' autoport='yes'/>
    <sound model='ich6'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux'>
    <label>system_u:system_r:svirt_t:s0:c22,c772</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c22,c772</imagelabel>
  </seclabel>
</domain>

2. Hotplug a virtio disk to the guest

# tail -f /root/.virt-manager/virt-manager.log
...
[Fri, 10 Jun 2011 11:05:23 virt-manager 18798] DEBUG (addhardware:906) Adding device:
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/http.img'/>
      <target dev='vdc' bus='virtio'/>
    </disk>
[Fri, 10 Jun 2011 11:05:23 virt-manager 18798] DEBUG (addhardware:913) Device could not be hotplugged: internal error unable to execute QEMU command '__com.redhat_drive_add': Duplicate ID 'drive-virtio-disk2' for drive
[Fri, 10 Jun 2011 11:05:23 virt-manager 18798] DEBUG (error:66) dialog message: Are you sure you want to add this device? : internal error unable to execute QEMU command '__com.redhat_drive_add': Duplicate ID 'drive-virtio-disk2' for drive

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 911, in add_device
    self.vm.attach_device(self._dev)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1159, in attach_device
    self._backend.attachDevice(devxml)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 295, in attachDevice
    if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', dom=self)
libvirtError: internal error unable to execute QEMU command '__com.redhat_drive_add': Duplicate ID 'drive-virtio-disk2' for drive

  
Actual results:
As above

Expected results:
virtio disk hotplug should be success


Additional info:
For shutdown guest, coldplugging this virtio disk works well.

Comment 2 Cole Robinson 2011-07-15 00:17:40 UTC
Sounds like either a libvirt or qemu issue. Reassigning to libvirt.

Comment 3 Osier Yang 2011-07-18 12:58:27 UTC
Hi, mzhan, 

Could you paste the qemu command line for this testing domain?

Comment 4 Min Zhan 2011-07-19 06:43:03 UTC
# /var/log/libvirt/qemu/rhel6cd.log

2011-06-09 14:04:44.306: starting up
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.1.0 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rhel6cd -uuid 1b2822fa-3c59-f66c-d662-cbf389403bb9 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/rhel6cd.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -boot c -drive file=/var/lib/libvirt/images/rhel6cd.img,if=none,id=drive-virtio-disk0,format=raw,cache=none,aio=threads -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -drive file=/var/lib/libvirt/images/a4.img,if=none,id=drive-virtio-disk1,format=qcow2,cache=writeback -device virtio-blk-pci,bus=pci.0,addr=0x8,drive=drive-virtio-disk1,id=virtio-disk1 -netdev tap,fd=23,id=hostnet0,vhost=on,vhostfd=27 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:10:e9:7b,bus=pci.0,addr=0x3 -netdev tap,fd=28,id=hostnet1 -device e1000,netdev=hostnet1,id=net1,mac=52:54:00:61:5a:46,bus=pci.0,addr=0x7 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:2 -vga cirrus -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/3
Using CPU model "cpu64-rhel6"

Comment 5 Osier Yang 2011-07-19 08:52:51 UTC
Actually you just see the second error, the first error is:

# virsh attach-device rhel6cd /var/lib/libvirt/images/http-virtio-disk.xml 
Error:.....
Error:operation failed: drive hotplug is not supported

# virsh attach-device rhel6cd /var/lib/libvirt/images/http-virtio-disk.xml 
Error:....
Error:internal error unable to execute QEMU command '__com.redhat_drive_add': Duplicate ID 'drive-virtio-disk2' for drive

And actually the disk was attached successfully with command "__com.redhat_drive_add" in the first time. 

# nc -U /var/lib/libvirt/qemu/rhel6cd.monitor
{"execute":"qmp_capabilities"}
{"execute":"query-block"}
{"return": [{"device": "drive-virtio-disk0", "locked": false, "removable": false, "inserted": {"ro": false, "drv": "raw", "encrypted": false, "file": "/var/lib/libvirt/images/cdrom.img"}, "type": "hd"}, {"device": "drive-ide0-1-0", "locked": false, "removable": true, "type": "cdrom"}, {"device": "drive-virtio-disk1", "locked": false, "removable": false, "inserted": {"ro": false, "drv": "qcow2", "encrypted": false, "file": "/var/lib/libvirt/images/a4.img"}, "type": "hd"}, {"device": "drive-virtio-disk2", "locked": false, "removable": false, "inserted": {"ro": false, "drv": "raw", "encrypted": false, "file": "/var/lib/libvirt/images/http.img"}, "type": "hd"}]}

Comment 6 Osier Yang 2011-07-19 09:08:12 UTC
Problem "drive hotplug is not supported" is duplicated with https://bugzilla.redhat.com/show_bug.cgi?id=712050, and the "Duplicate ID" problem was fixed along with the patch for 712050.

Following is the diff which fixes the "Duplicate ID" problem.

    --- a/src/qemu/qemu_monitor_json.c
    +++ b/src/qemu/qemu_monitor_json.c
    @@ -2395,7 +2395,8 @@ int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
     
             VIR_DEBUG0("__com.redhat_drive_add command not found,"
                        " trying upstream way");
    -    } else if ((ret = qemuMonitorJSONCheckError(cmd, reply)) < 0) {
    +    } else {
    +        ret = qemuMonitorJSONCheckError(cmd, reply);
             goto cleanup;
         }  

Per above comments, move to POST.

Comment 10 Wayne Sun 2012-01-11 07:36:07 UTC
# rpm -q libvirt qemu-kvm
libvirt-0.9.9-1.el6.x86_64
qemu-kvm-0.12.1.2-2.213.el6.x86_64
virt-manager-0.9.0-7.el6.x86_64

# cat attach.xml
<disk type='file' device='disk'>
  <driver name='qemu' type='raw'/>
  <source file='/var/lib/libvirt/images/foo.img'/>
  <target dev='vdc' bus='virtio'/>
</disk>

# virsh list
 Id Name                 State
----------------------------------
 53 rhel6u2              running

# virsh detach-device rhel6u2 attach.xml 
Device detached successfully

Also tried with virt-manager, attach virtio disk works fine. 
So, this is fixed.

Comment 11 Osier Yang 2012-05-04 10:47:29 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No documentaion needed.

Comment 13 errata-xmlrpc 2012-06-20 06:28:15 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.

http://rhn.redhat.com/errata/RHSA-2012-0748.html

Comment 14 nigil 2013-02-03 13:43:11 UTC
The bug is still valid for RHEL6.3. I have the following packages which is same/higher as said in Errata.

[root@lnx132-75 new]# lsb_release -r
Release:        6.3

[root@lnx132-75 new]# rpm -q libvirt qemu-kvm
libvirt-0.9.10-21.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64

I saw the issue when I tried to hotplug a disk in RHEL 5.9 VM. 

Neither the errata "http://rhn.redhat.com/errata/RHSA-2012-0748.html" nor the technical notes for RHEL6.3 discuss this issue. 
So is the code changes missed some where in the release path or not yet fixed?
Please move the bug status accordingly.

Comment 15 nigil 2013-02-03 14:13:42 UTC
Errata RHSA-2012-0748, contains the bug info and says as fixed. But issue I found with RHEL 5.9 VM/Guest. 
I used to virt-manager to attach disk.

Comment 16 nigil 2013-02-04 08:20:53 UTC
Found the same problem(duplicate ID) even with Windows VMs too for the hypervisor RHEL6.3 KVM.

Comment 17 Wayne Sun 2013-02-04 09:15:15 UTC
(In reply to comment #16)
> Found the same problem(duplicate ID) even with Windows VMs too for the
> hypervisor RHEL6.3 KVM.

Did you install virtio-win driver in windows guest?

For rhel5.9 guest, did you run:
# modprobe acpiphp

before you attach/detach disk?

I just tried with 
libvirt-0.9.10-21.el6_3.8.x86_64

it works fine with rhel5.9 guest disk hotplug, I'll contiue with winxp next.

Comment 18 Wayne Sun 2013-02-04 09:49:14 UTC
winxp also works fine for me.

Comment 19 nigil 2013-02-28 11:41:29 UTC
Hi,
I am getting this issue in random. Today I got it again when I am working with Windows Vista.
in VM ie Windows Vista, virtio win scsi driver is installed. 

[root@lnx132-75 new]# lsb_release -r
Release:        6.3

[root@lnx132-75 new]# rpm -q libvirt qemu-kvm
libvirt-0.9.10-21.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64

Scenario:
1. Hotplug a qcow2 virtual disk of 10G to Windows Vista-64Bit guest OS. 
2. Format in NTFS and run IO. IOs happening successfully and Size increasing as the IOs happening(qcow2 thin provisioning).
3. Stop IO.
4. Remove virtual disk.
5. Hotplug the same qcow2 virtual disk to the same VM, 
Below error occurs:

Are you Sure you want to add this device?
This device could not be attached to the running machine. Would you like to make the device available after the next guest shutdown?

internal error unable to execute QEMU command '__com.redhat_drive_add': Duplicate ID 'drive-virtio-disk1' for drive

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 1033, in add_device
    self.vm.attach_device(self._dev)
  File "/usr/share/virt-manager/virtManager/domain.py", line 711, in attach_device
    self._backend.attachDevice(devxml)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 400, in attachDevice
    if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', dom=self)
libvirtError: internal error unable to execute QEMU command '__com.redhat_drive_add': Duplicate ID 'drive-virtio-disk1' for drive

Comment 20 nigil 2013-02-28 13:21:46 UTC
I have verified comment#19 with other windows VMs and RHEL6.3 VM itself, but found issue exist in all with the scenario "detach and re hotplug same virtual disk in qcow2 format".


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