Bug 787272 - Duplicate ID 'hostdev0' for device (pci-hotplug, pci-unplug, pci-hotplug test)
Summary: Duplicate ID 'hostdev0' for device (pci-hotplug, pci-unplug, pci-hotplug test)
Keywords:
Status: CLOSED DUPLICATE of bug 696877
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-03 18:33 UTC by Shradha Shah
Modified: 2012-02-06 17:44 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-03 21:48:19 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Shradha Shah 2012-02-03 18:33:28 UTC
Description of problem:
When using a model of separate network and guest XML's (using forward mode) to start a guest on RHEL 6.2, a simple test of pci-hotplug, pci-unplug and pci-hotplug again of PCI device fails.

Version-Release number of selected component (if applicable):
RHEL 6.2 : 2.6.32-220.el6.x86_64
Libvirt :  libvirt-0.9.4-23.el6.x86_64
qemu-kvm : qemu-kvm-0.12.1.2-2.209.el6.x86_64

How reproducible:
Always

Steps to Reproduce: 
1. virsh net-define network.xml
2. virsh define guest.xml
3. virsh start guest
4. virsh qemu-monitor-command --domain guest --cmd 'info pci' --hmp
   Observe result.
5. virsh attach-device guest hostdev.xml
6. virsh qemu-monitor-command --domain guest --cmd 'info pci' --hmp
   Observe result
7. virsh detach-device guest hostdev.xml
8. virsh qemu-monitor-command --domain guest --cmd 'info pci' --hmp
   Observe result
9. virsh attach-device guest hostdev.xml 
  
Actual results:
error: Failed to attach device from /home/sshah/xml/hostdev_attach.xml
error: internal error unable to execute QEMU command 'device_add': Duplicate ID 'hostdev0' for device

Expected results:
The second hotplug should succeed without errors and on detach-device hostdev0 should be removed from the info pci list of the qemu-monitor-command

Additional info:

Observations in the Actual results:
1) After the first attach-device a new device called hostdev0 is added to the info pci list of the qemu-monitor-command
2) After the first detach-device the hostdev0 entry still remains in the info pci list of the qemu-monitor-command

The XML used to create the guest:

network.xml:
<network>
  <name>bridge-network</name>
  <uuid>81ff2340-c91e-6742-64da-4a736edb9a8f</uuid>
  <forward mode="bridge"/>
  <bridge name="br1"/>
</network>

hostdev.xml:
<hostdev mode='subsystem' type='pci' managed='yes'>
  <source>
    <address bus='0x04' slot='0x00' function='0x2'/>
  </source>
</hostdev>

guest.xml:
<domain type='kvm'>
  <name>guest</name>
  <uuid>a4452511-fcb7-864a-dbcc-f4c66f821956</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
    <boot dev='cdrom'/>
    <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'/>
      <source file='/var/lib/libvirt/images/vguestc2.img'/>
      <target dev='hda' bus='virtio'/>
      <alias name='virtio-disk0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' io='threads'/>
      <source file='/misc/linux-dist/redhat/rhel6/x86_64/rhel-workstation-supplementary-6.0-x86_64-dvd.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide-disk0'/>
    </disk>
    <interface type='network'>
      <source network='bridge-network'/>
      <model type='virtio'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
    </memballoon>
  </devices>
</domain>

Comment 2 Dave Allan 2012-02-03 21:48:19 UTC
I believe you're hitting BZ 696877, so I'm closing this as a duplicate.  Please feel free to reopen if that turns out not to be the case.

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

Comment 3 Don Dutile (Red Hat) 2012-02-06 17:31:45 UTC
Could you provide guest.xml & hostdev.xml files?
what was the guest? (linux, win, what version of the guest, e.g., rhel5, winxp-32, etc.)

Comment 4 Shradha Shah 2012-02-06 17:44:30 UTC
(In reply to comment #3)
> Could you provide guest.xml & hostdev.xml files?
> what was the guest? (linux, win, what version of the guest, e.g., rhel5,
> winxp-32, etc.)

The guest I am using is RHEL 6.1.

The guest xml is as follows:

<domain type='kvm'>
  <name>guest</name>
  <uuid>a4452511-fcb7-864a-dbcc-f4c66f821956</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
    <boot dev='cdrom'/>
    <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'/>
      <source file='/var/lib/libvirt/images/vguestc2.img'/>
      <target dev='hda' bus='virtio'/>
      <alias name='virtio-disk0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' io='threads'/>
      <source
file='/misc/linux-dist/redhat/rhel6/x86_64/rhel-workstation-supplementary-6.0-x86_64-dvd.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide-disk0'/>
    </disk>
    <interface type='network'>
      <source network='bridge-network'/>
      <model type='virtio'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
    </memballoon>
  </devices>
</domain>

The hostdev xml is as follows:

<hostdev mode='subsystem' type='pci' managed='yes'>
  <source>
    <address bus='0x04' slot='0x00' function='0x2'/>
  </source>
</hostdev>


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