Bug 208545

Summary: Make virsh return useful error messages for not-well-formed XML
Product: [Fedora] Fedora Reporter: Mark McLoughlin <markmc>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-11-08 11:01:52 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Mark McLoughlin 2006-09-29 06:54:36 EDT
i.e. atm with not-well-formed XML, you get

$> virsh create ./Test1-diskless.xml
error: Failed to create domain from ./Test1-diskless.xml

because:

       xml = xmlReadDoc((const xmlChar *) xmldesc, "domain.xml", NULL,
                        XML_PARSE_NOENT | XML_PARSE_NONET |
                        XML_PARSE_NOERROR | XML_PARSE_NOWARNING);

it'd be nice to get the real libxml warning:

domain.xml:11: parser error : expected '>'
  <devices><interface><mac address="00:16:3E:6C:05:FB"/></interface</devices>
Comment 1 Daniel Veillard 2006-11-08 11:01:26 EST
Okay, makes sense, but need to be hooked with care as the program embedding 
libvirt may use libxml2 for other operations. Seems fixed in libvirt CVS:

---------------------------------
[root@paphio src]# ./virsh create bug.xml 
libvir: XML error : line 10: Opening and ending tag mismatch: os line 5 and s
libvir: Xen Daemon error : XML description for domain is not well formed or invalid
error: Failed to create domain from bug.xml

[root@paphio src]# 
------------------------------

  thanks !

Daniel
Comment 2 Daniel Veillard 2006-11-08 11:01:52 EST
Okay, makes sense, but need to be hooked with care as the program embedding 
libvirt may use libxml2 for other operations. Seems fixed in libvirt CVS:

---------------------------------
[root@paphio src]# ./virsh create bug.xml 
libvir: XML error : line 10: Opening and ending tag mismatch: os line 5 and s
libvir: Xen Daemon error : XML description for domain is not well formed or invalid
error: Failed to create domain from bug.xml

[root@paphio src]# 
------------------------------

  thanks !

Daniel