Bug 582752

Summary: decimal/hex confusion when adding pci devices to a vm
Product: [Fedora] Fedora Reporter: Gerd v. Egidy <gerd>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: agospoda, berrange, clalance, crobinso, hbrock, itamar, jforbes, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.7.7-4.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-28 13:58:48 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
Device list as shown by add pci device wizard none

Description Gerd v. Egidy 2010-04-15 14:02:18 EDT
Created attachment 406874 [details]
Device list as shown by add pci device wizard

Description of problem:
When adding a pci device to a libvirt-managed vm via virt-manager, the wrong pci id is configured in libvirt.

Version-Release number of selected component (if applicable):
virt-manager-0.8.3-2.fc13.noarch
libvirt-0.7.7-1.fc13.x86_64

How reproducible:
always for device-ids matching some yet unknown criteria (probably some value >= 0x10)

Steps to Reproduce:
1. create a vm using qemu-kvm
2. add a pci device vm with virt-manager. It seems like the slot of the pci id must be lager than 0x10 to trigger the bug. I selected pci id "01:10:1" to reproduce it (see screenshot). The list of ids shown by virt-manager matches the output of lspci
  
Actual results:
virt-manager tells libvirt to add the device, but confuses the slot data. This is what gets written to the libvirt-xml:

<hostdev mode='subsystem' type='pci' managed='yes'>
  <source>
    <address domain='0x0000' bus='0x01' slot='0x16' function='0x1'/>
  </source>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</hostdev>

So to me it seems like virt-manager writes 0x10 or 16 decimal to libvirt, but libvirt treats it as 16 hex.

Expected results:

<hostdev mode='subsystem' type='pci' managed='yes'>
  <source>
    <address domain='0x0000' bus='0x01' slot='0x10' function='0x1'/>
  </source>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</hostdev>
Comment 1 Cole Robinson 2010-05-06 14:54:53 EDT
This is a libvirt issue, now fixed upstream. Should be a simple backport:

http://libvirt.org/git/?p=libvirt.git;a=commit;h=e984019688509605966c03cd77f4591d2cc222d3
Comment 2 Gerd v. Egidy 2010-05-13 17:12:04 EDT
I can confirm that this issue is fixed with current libvirt git.

Now we only need a backport of the patch into F13 or (even better) an upgrade to current libvirt.
Comment 3 Fedora Update System 2010-05-18 15:02:41 EDT
libvirt-0.7.7-4.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/libvirt-0.7.7-4.fc13
Comment 4 Fedora Update System 2010-05-19 15:14:19 EDT
libvirt-0.7.7-4.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update libvirt'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/libvirt-0.7.7-4.fc13
Comment 5 Cole Robinson 2010-05-26 15:38:25 EDT
*** Bug 596473 has been marked as a duplicate of this bug. ***
Comment 6 Fedora Update System 2010-05-28 13:58:24 EDT
libvirt-0.7.7-4.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.