Bug 547045 - libvirt can generate bogus node device XML
Summary: libvirt can generate bogus node device XML
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Veillard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F13VirtImportant
TreeView+ depends on / blocked
 
Reported: 2009-12-13 10:50 UTC by Eike Hein
Modified: 2010-02-10 09:37 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-02-10 09:37:54 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
virt-manager log showing Python backtrace (4.01 KB, text/plain)
2009-12-13 10:50 UTC, Eike Hein
no flags Details
virsh nodedev-list --tree output. (3.67 KB, text/plain)
2009-12-13 18:35 UTC, Eike Hein
no flags Details
for n in `virsh nodedev-list`; do virsh nodedev-dumpxml $n; done > nodedev-xml.log 2>&1 output. (23.30 KB, text/plain)
2009-12-13 18:36 UTC, Eike Hein
no flags Details

Description Eike Hein 2009-12-13 10:50:47 UTC
Created attachment 377970 [details]
virt-manager log showing Python backtrace

Description of problem:
On a x86_64 Fedora 12 box with updates and updates-testing enabled and upgraded to the latest versions of everything, virt-manager fails to list the VMs on the local system. $HOME/.virt-manager/virt-manager.log contains a Python traceback showing a script stumbling over an XML parsing problem; the log file is attached to this bug report.

Downgrading to virt-manager-0.8.0-7.fc12.noarch from updates fixes the problem again.

Version-Release number of selected component (if applicable):
Name       : virt-manager
Arch       : noarch
Version    : 0.8.1
Release    : 3.fc12
Size       : 4.8 M
Repo       : installed
From repo  : updates-testing
Summary    : Virtual Machine Manager

How reproducible:
Always

Steps to Reproduce:
1. Start libvirtd.
2. Start virt-manager.

Actual results:
No VMs below "localhost (QEMU)".

Expected results:
Seeing my VMs below "localhost (QEMU)" as I used to with older versions of virt-manager such as virt-manager-0.8.0-7.fc12.noarch.

Comment 1 Cole Robinson 2009-12-13 17:03:27 UTC
Huh, interesting. Backtrace is:

[Sun, 13 Dec 2009 11:44:08 virt-manager 15216] ERROR (virt-manager:162) Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 931, in _open_notify
    self.tick()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1331, in tick
    (oldNodedevs, newNodedevs, self.nodedevs) = self._update_nodedevs()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1196, in _update_nodedevs
    check_obj(name)
  File "/usr/share/virt-manager/virtManager/connection.py", line 1183, in check_obj
    vdev = virtinst.NodeDeviceParser.parse(obj.XMLDesc(0))
  File "/usr/lib/python2.6/site-packages/virtinst/NodeDeviceParser.py", line 443, in parse
    return _util.parse_node_helper(xml, "device", _parse_func)
  File "/usr/lib/python2.6/site-packages/virtinst/_util.py", line 406, in parse_node_helper
    raise exec_class("%s\n%s" % (e, error.msg))
ValueError: xmlReadMemory() failed
Entity: line 12: parser error : PCDATA invalid Char value 16
    <description> ̄￯メ|￴</description>
                           ^
Entity: line 12: parser error : PCDATA invalid Char value 18
    <description> ̄￯メ|￴</description>

ccing DV since this is an error coming from libxml.

Have you manually added a <description> field to your VMs? How did you do so? (manually editting /etc/libvirt xml files or using virsh edit)? Can you provide 'virsh dumpxml' of any VM with a description field?

Comment 2 Cole Robinson 2009-12-13 17:04:19 UTC
(In reply to comment #1)

> Have you manually added a <description> field to your VMs? How did you do so?
> (manually editting /etc/libvirt xml files or using virsh edit)? Can you provide
> 'virsh dumpxml' of any VM with a description field?  

That should say, provide 'virsh dumpxml' of ALL VMs with a description field.

Comment 3 Eike Hein 2009-12-13 17:31:25 UTC
My VM (the plural in the initial report was erroneous) doesn't have a description field :-).

[root@ehw1 /etc/libvirt 44K]# ls qemu/
Gentoo.xml  networks
[root@ehw1 /etc/libvirt 44K]# grep -inR "description" *
[root@ehw1 /etc/libvirt 44K]#

Comment 4 Cole Robinson 2009-12-13 18:05:07 UTC
*slaps forehead*, sorry, I misread the backtrace. Something is going on here and preventing us from parsing node device XML.

Can you provide the output of (run as root):

virsh nodedev-list --tree

for n in `virsh nodedev-list`; do virsh nodedev-dumpxml $n; done > nodedev-xml.log 2>&1

Comment 5 Eike Hein 2009-12-13 18:35:16 UTC
Created attachment 378045 [details]
virsh nodedev-list --tree output.

Comment 6 Eike Hein 2009-12-13 18:36:15 UTC
Created attachment 378046 [details]
for n in `virsh nodedev-list`; do virsh nodedev-dumpxml $n; done > nodedev-xml.log 2>&1 output.

Comment 7 Cole Robinson 2009-12-13 18:54:17 UTC
Thanks for the quick response. The offending output is:

<device>
  <name>usb_device_5e3_70e_000000325491_if0</name>
  <parent>usb_device_5e3_70e_000000325491</parent>
  <driver>
    <name>usb-storage</name>
  </driver>
  <capability type='usb'>
    <number>0</number>
    <class>8</class>
    <subclass>6</subclass>
    <protocol>80</protocol>
    <description> ̄￯メ|￴</description>
  </capability>
</device>

Seems like libvirt shouldn't be generating XML that xmlReadMemory will choke on. Reassigning to libvirt. DV, any ideas how to properly handle this? Is there some function we can use to santize the description string, or check for invalid data and just throw it out when dumping the XML?

Comment 8 Eike Hein 2009-12-13 19:04:03 UTC
> Thanks for the quick response.

Thanks for working on a Sunday ;-).

Comment 9 Daniel Berrangé 2009-12-13 19:48:02 UTC
libvirt has a function for escaping XML strings that we clearly forgot to use here. In addition though we probably need to check where this garbage is coming from, because in this particular case we probably shouldn't be including the element at all.

Comment 10 Cole Robinson 2009-12-15 19:01:51 UTC
FYI, virt-manager-0.8.2 in F12 updates-testing should no longer fail here: we catch the error and just move along. The libvirt bug still remains, but at least virt-manager should be usable now.

You can get this version by doing

yum --enablerepo=updates-testing update virt-manager

Comment 11 Eike Hein 2009-12-15 19:10:10 UTC
Looks like my mirror hasn't synced the latest push yet; will retry later or tomorrow (CET here).

Comment 12 Eike Hein 2009-12-16 14:20:51 UTC
0.8.2 indeed works fine for me, thanks!

Since this was reassigned to libvirt due to the underlying issue, I won't close from my end.

Comment 13 Daniel Veillard 2010-02-10 09:37:54 UTC
The escaping problem in libvirt has now been pushed upstream,

  thanks !

Daniel


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