Bug 1184131
Summary: | nodedev 'system' info can contain non-ascii text and control codes | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Hansen Tanjung <mht> | ||||||||
Component: | libvirt | Assignee: | Ján Tomko <jtomko> | ||||||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||||
Severity: | high | Docs Contact: | |||||||||
Priority: | unspecified | ||||||||||
Version: | 21 | CC: | agedosier, berrange, clalancette, crobinso, francisco.marchena, itamar, jforbes, jtomko, laine, libvirt-maint, mht, veillard, virt-maint, vitalwonhyo | ||||||||
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: | 2015-06-05 23:02:02 UTC | Type: | Bug | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Attachments: |
|
Description
Hansen Tanjung
2015-01-20 15:47:30 UTC
(In reply to Hansen Tanjung from comment #0) > Description of problem: > I have a weird laptop motherboard that produce non ASCII information when > quried. That character raise parsing error from xmlParseDoc(). > > This is relevant info when virt-manager running with debug parameter: > --- > <device> > <name>computer</name> > <capability type='system'> > <product>��������U310����</product> > <hardware> > <vendor>LENOVO</vendor> > <version>�������U310���������������������</version> > <serial>��������������������������������</serial> > <uuid>771f691d-2d42-4f44-96d5-cac2dedad56b</uuid> > </hardware> > <firmware> > <vendor>LENOVO</vendor> > <version>65CN21WW</version> > <release_date>12/26/2012</release_date> > </firmware> > </capability> > </device> > > [Tue, 20 Jan 2015 21:41:35 virt-manager 29497] DEBUG (cli:208) Uncaught > exception: > Traceback (most recent call last): > File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 230, in > _reparse_xml > self._xmlobj = self._build_xmlobj(self._get_raw_xml()) > File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 233, in > _build_xmlobj > return self._parseclass(self.conn.get_backend(), parsexml=xml) > File "/usr/share/virt-manager/virtManager/nodedev.py", line 27, in > _parse_convert > return NodeDevice.parse(conn, parsexml) > File "/usr/share/virt-manager/virtinst/nodedev.py", line 92, in parse > tmpdev = NodeDevice(conn, parsexml=xml, allow_node_instantiate=True) > File "/usr/share/virt-manager/virtinst/nodedev.py", line 101, in __init__ > XMLBuilder.__init__(self, *args, **kwargs) > File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 781, in > __init__ > parent_xpath, relative_object_xpath) > File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 683, in > __init__ > self._parse(parsexml, parsexmlnode) > File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 696, in _parse > doc = libxml2.parseDoc(xml) > File "/usr/lib64/python2.7/site-packages/libxml2.py", line 1325, in > parseDoc > if ret is None:raise parserError('xmlParseDoc() failed') > parserError: xmlParseDoc() failed > --- > > I can't change that motherboard info because BIOS also produce that. This > error makes me can't make any new virtual component or machine, altough any > virtual machine that produced before this error occur can run properly. > > Version-Release number of selected component (if applicable): > libvirt.x86_64 1.2.9.1-2.fc21 > virt-manager.noarch 1.1.0-4.git310f6527.fc21 > > How reproducible: > always > > Steps to Reproduce: > 1. Start virt-manager > 2. Create a new virtual machine > > Actual results: > Step-by-step creating new virtual machine stop at step 1 with error massage > at dialog box "Error: xmlParseDoc() failed" > > Expected results: > Success creating a new virtual machine > > Additional info: > This parsing error seems related to bug 1072770 and bug 1074528 that had > been closed, unfortunately my malformed device properties not the storage > like the two previous bugs. SAME Error With Me [Wed, 04 Feb 2015 23:52:59 virt-manager 20222] DEBUG (connection:797) Using domain events [Wed, 04 Feb 2015 23:52:59 virt-manager 20222] DEBUG (connection:831) Using network events [Wed, 04 Feb 2015 23:52:59 virt-manager 20222] DEBUG (xmlbuilder:698) Error parsing xml= <device> <name>computer</name> <capability type='system'> <product>��������U410����</product> <hardware> <vendor>LENOVO</vendor> <version>�������U410���������������������</version> <serial>��������������������������������</serial> <uuid>610b271e-f473-4454-ad81-afe332bff712</uuid> </hardware> <firmware> <vendor>LENOVO</vendor> <version>65CN21WW</version> <release_date>12/26/2012</release_date> </firmware> </capability> </device> Exception in thread nodedev=computer AddMediadev: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 813, in __bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 766, in run self.__target(*self.__args, **self.__kwargs) File "/usr/share/virt-manager/virtManager/connection.py", line 847, in _add_thread mediadev = vmmMediaDevice.mediadev_from_nodedev(vobj) File "/usr/share/virt-manager/virtManager/mediadev.py", line 41, in mediadev_from_nodedev nodedev = dev.get_xmlobj() File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 164, in get_xmlobj self._reparse_xml() File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 230, in _reparse_xml self._xmlobj = self._build_xmlobj(self._get_raw_xml()) File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 233, in _build_xmlobj return self._parseclass(self.conn.get_backend(), parsexml=xml) File "/usr/share/virt-manager/virtManager/nodedev.py", line 27, in _parse_convert return NodeDevice.parse(conn, parsexml) File "/usr/share/virt-manager/virtinst/nodedev.py", line 92, in parse tmpdev = NodeDevice(conn, parsexml=xml, allow_node_instantiate=True) File "/usr/share/virt-manager/virtinst/nodedev.py", line 101, in __init__ XMLBuilder.__init__(self, *args, **kwargs) File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 781, in __init__ parent_xpath, relative_object_xpath) File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 683, in __init__ self._parse(parsexml, parsexmlnode) File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 696, in _parse doc = libxml2.parseDoc(xml) File "/usr/lib64/python2.7/site-packages/libxml2.py", line 1325, in parseDoc if ret is None:raise parserError('xmlParseDoc() failed') parserError: xmlParseDoc() failed Bug I found Easy Way To Fix This Bug download virt-manager: git clone git://git.fedorahosted.org/virt-manager.git cd virt-manager edit file: virtinst/xmlbuilder.py change doc = libxml2.parseDoc(xml) to xml = xml.decode("ascii", 'ignore') doc = libxml2.parseDoc(xml) ./virt-manager It Work Created attachment 1002747 [details]
Filter ascii and non ascii characters from the information given by the hardware vendors
I've added also the ascii filter as vitalwonhyo suggested.
Hello, I have a different problem but it is related to this. Use case: - Using virt-manager-1.1.0-4.git310f6527.fc21.noarch or virt-manager master - run: virt-manager --debug - Error log: [Tue, 17 Mar 2015 09:57:17 virt-manager 18951] DEBUG (connection:768) Using domain events [Tue, 17 Mar 2015 09:57:17 virt-manager 18951] DEBUG (connection:802) Using network events [Tue, 17 Mar 2015 09:57:17 virt-manager 18951] DEBUG (xmlbuilder:667) Error parsing xml= <device> <name>computer</name> <capability type='system'> <product>7200-2004A</product> <hardware> <vendor>ZOOSTORM</vendor> <version>7200-2004A</version> <serial>CM015262-0</serial> <uuid>9402de03-8004-fb05-ec06-ed0700080009</uuid> </hardware> <firmware> <vendor>American Megatrends Inc.</vendor> <version>F4 UM1</version> <release_date>08/20/2014</release_date> </firmware> </capability> </device> Exception in thread nodedev=computer AddMediadev: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 813, in __bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 766, in run self.__target(*self.__args, **self.__kwargs) File "/home/franred/virt-manager/virtManager/connection.py", line 818, in _add_thread mediadev = vmmMediaDevice.mediadev_from_nodedev(vobj) File "/home/franred/virt-manager/virtManager/mediadev.py", line 41, in mediadev_from_nodedev nodedev = dev.get_xmlobj() File "/home/franred/virt-manager/virtManager/libvirtobject.py", line 164, in get_xmlobj self._reparse_xml() File "/home/franred/virt-manager/virtManager/libvirtobject.py", line 230, in _reparse_xml self._xmlobj = self._build_xmlobj(self._get_raw_xml()) File "/home/franred/virt-manager/virtManager/libvirtobject.py", line 233, in _build_xmlobj return self._parseclass(self.conn.get_backend(), parsexml=xml) File "/home/franred/virt-manager/virtManager/nodedev.py", line 27, in _parse_convert return NodeDevice.parse(conn, parsexml) File "/home/franred/virt-manager/virtinst/nodedev.py", line 92, in parse tmpdev = NodeDevice(conn, parsexml=xml, allow_node_instantiate=True) File "/home/franred/virt-manager/virtinst/nodedev.py", line 101, in __init__ XMLBuilder.__init__(self, *args, **kwargs) File "/home/franred/virt-manager/virtinst/xmlbuilder.py", line 750, in __init__ parent_xpath, relative_object_xpath) File "/home/franred/virt-manager/virtinst/xmlbuilder.py", line 652, in __init__ self._parse(parsexml, parsexmlnode) File "/home/franred/virt-manager/virtinst/xmlbuilder.py", line 665, in _parse doc = libxml2.parseDoc(xml) File "/usr/lib64/python2.7/site-packages/libxml2.py", line 1325, in parseDoc if ret is None:raise parserError('xmlParseDoc() failed') parserError: xmlParseDoc() failed The error is because in <serial>CM015262-0</serial> there is a non printable character so the xml parser failed to parse it. The attached patch fixes this error for me. Created attachment 1003344 [details]
SPEC file for RPMBUILD
Created attachment 1003345 [details]
Patch for RPMBUILD
(In reply to francisco.marchena from comment #2) > Created attachment 1002747 [details] > Filter ascii and non ascii characters from the information given by the > hardware vendors > > I've added also the ascii filter as vitalwonhyo suggested. thank i has add spec and .patch use for rpmbuild new .rpm package with the fix.. I'll add a workaround to virt-manager for the nodedev 'system' case, but the root issue here is that libvirt shouldn't be generating this bogus XML. So reassigning. Here's the virt-manager workaround: commit e125aa69d8024fddb72dde9371f172061f388160 Author: Cole Robinson <crobinso> Date: Thu Mar 26 18:04:23 2015 -0400 nodedev: Handle busted 'system' XML francisco and vitalwonhyo, I adjusted your code to only work for node devices where you guys are seeing this problem, rather than do it for every XML parsing which would have a serious performance cost. And added test cases and docs. Thanks for the suggestions ! I have sent a patch to strip control codes when generating XML: https://www.redhat.com/archives/libvir-list/2015-March/msg01529.html Hopefully that will generate XML that will pass validation: virsh nodedev-dumpxml computer > computer.xml virt-xml-validate computer.xml nodedev Fixed upstream by: commit aeb5262e4397528d582682471cb8075141189465 Strip control codes in virBufferEscapeString commit 557107500b22d4a5ba7d1b09f5f516512dfca67b Strip control characters from sysfs attributes git describe: v1.2.14-194-gaeb5262 Backported to v1.2.9-maint as of v1.2.9.2-10-g7eb973e libvirt-1.2.9.3-1.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/libvirt-1.2.9.3-1.fc21 Package libvirt-1.2.9.3-1.fc21: * should fix your issue, * was pushed to the Fedora 21 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing libvirt-1.2.9.3-1.fc21' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-7150/libvirt-1.2.9.3-1.fc21 then log in and leave karma (feedback). Still not working for me. Installed Packages libvirt.x86_64 1.2.9.3-1.fc21 @updates-testing libxml2.x86_64 2.9.1-7.fc21 @updates virt-manager.noarch 1.1.0-8.git310f6527.fc21 @updates Need another packages update? Hansen, did you restart libvirtd ? Is virt-manager failing in the exact same way as reported in comment #0? Yes, i try to restart libvirtd and even to restart computer and still get the same error Thanks Hansen. Sorry but can you file a different bug then, this one is going to get autoclosed. Please report: sudo virsh nodedev-dumpxml computer > nodedev and then upload output to the bug report (don't paste it) sudo dmidecode > dmi and then upload the output Sorry for the inconvenience |