Bug 771128

Summary: "Failed to build sexpr" when adding PCI passthrough device to Xen domain
Product: [Fedora] Fedora Reporter: Robin Green <greenrd>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 16CC: berrange, clalancette, crobinso, dougsland, itamar, jforbes, laine, libvirt-maint, Steven.Seed, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-21 01:12:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Robin Green 2012-01-01 18:55:55 UTC
Description of problem:
I have been trying to pass through a PCI device (a USB hub) to a Xen domU. virt-manager gives this error when I try to do so.

Version-Release number of selected component (if applicable):
libvirt-python-0.9.6-2.fc16.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create F16 domain using virsh-install
2. Open the F16 domain in virt-manager and click the Add Hardware button at the bottom of the window
3. Select a PCI USB hub and click the Finish button

Actual results:
An error dialog appears saying:
Error adding device: XML error: failed to build sexpr

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 1048, in add_device
    self.vm.add_device(self._dev)
  File "/usr/share/virt-manager/virtManager/domain.py", line 397, in add_device
    self.redefine_cached()
  File "/usr/share/virt-manager/virtManager/domain.py", line 326, in redefine_cached
    self._redefine_xml(xml)
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 147, in _redefine_xml
    return self._redefine_helper(origxml, newxml)
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 137, in _redefine_helper
    self._define(newxml)
  File "/usr/share/virt-manager/virtManager/domain.py", line 762, in _define
    self.conn.define_domain(newxml)
  File "/usr/share/virt-manager/virtManager/connection.py", line 805, in define_domain
    return self.vmm.defineXML(xml)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2110, in defineXML
    if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
libvirtError: XML error: failed to build sexpr

Expected results:
No error

Comment 1 Cole Robinson 2012-06-07 19:52:35 UTC
Robin, can you provide the virt-manager --debug output when reproducing?

Comment 2 Cole Robinson 2012-10-21 01:12:23 UTC
No response for a while, closing. If anyone can still reproduce, please reopen with the info requested in comment #1

Comment 3 Steven Seed 2013-05-16 18:52:41 UTC
I'd like to reopen this. I'm having this problem currently on a RHEL 6.4 with xen installed. I ran virt-manager --debug, however there is no output on the command line. I've seeing the same error when using virsh to attempt to modify the vm.

Here ist he pci device dump:

virsh # nodedev-dumpxml pci_0000_06_00_0
<device>
  <name>pci_0000_06_00_0</name>
  <parent>pci_0000_00_03_0</parent>
  <capability type='pci'>
    <domain>0</domain>
    <bus>6</bus>
    <slot>0</slot>
    <function>0</function>
    <product id='0x0dd8'>GF106GL [Quadro 2000]</product>
    <vendor id='0x10de'>NVIDIA Corporation</vendor>
    <capability type='virt_functions'>
    </capability>
  </capability>
</device>

Here is what I'm trying to add to the configuration:

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

And here is the result when I try to save:

error: XML error: failed to build sexpr
Failed. Try again? [y,n,f,?]:

Comment 4 Steven Seed 2013-05-16 18:55:29 UTC
I'm not sure how to re-open this ticket. Can you do that for me?

Comment 5 Laine Stump 2013-05-16 19:54:04 UTC
That error message is very general, and there have been several releases of libvirt since the version in this BZ (which is filed against F16 / libvirt-0.9.6). I would recommend opening a new BZ, then post about it to libvirt-users to make sure that somebody who works on the xen part of libvirt sees it. Almost all libvirt developers working on Fedora are using qemu instead.