Red Hat Bugzilla – Bug 547045
libvirt can generate bogus node device XML
Last modified: 2010-02-10 04:37:54 EST
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
Steps to Reproduce:
1. Start libvirtd.
2. Start virt-manager.
No VMs below "localhost (QEMU)".
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.
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
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
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
Entity: line 12: parser error : PCDATA invalid Char value 18
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?
(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.
My VM (the plural in the initial report was erroneous) doesn't have a description field :-).
[root@ehw1 /etc/libvirt 44K]# ls qemu/
[root@ehw1 /etc/libvirt 44K]# grep -inR "description" *
[root@ehw1 /etc/libvirt 44K]#
*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
Created attachment 378045 [details]
virsh nodedev-list --tree output.
Created attachment 378046 [details]
for n in `virsh nodedev-list`; do virsh nodedev-dumpxml $n; done > nodedev-xml.log 2>&1 output.
Thanks for the quick response. The offending output is:
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?
> Thanks for the quick response.
Thanks for working on a Sunday ;-).
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.
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
Looks like my mirror hasn't synced the latest push yet; will retry later or tomorrow (CET here).
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.
The escaping problem in libvirt has now been pushed upstream,