File 10a87145-improve-error-reporting.patch of Package libvirt.openSUSE_12.1_Update

commit 10a87145f73068e572d14d82a13df46c95960273
Author: Jim Fehlig <jfehlig@suse.com>
Date:   Wed May 9 11:12:38 2012 -0600

    Report error when parsing character device target type
    
    No useful error was being reported when an invalid character device
    target type is specified in the domainXML. E.g.
    
        ...
        <console type="pty">
          <source path="/dev/pts/2"/>
          <target type="kvm" port="0"/>
        </console>
        ...
    
    resulted in
    
    error: Failed to define domain from x.xml
    error: An error occurred, but the cause is unknown
    
    With this small patch, the error is more helpful
    
    error: Failed to define domain from x.xml
    error: XML error: unknown target type 'kvm' specified for character device

Index: libvirt-0.9.6/src/conf/domain_conf.c
===================================================================
--- libvirt-0.9.6.orig/src/conf/domain_conf.c
+++ libvirt-0.9.6/src/conf/domain_conf.c
@@ -3522,6 +3522,9 @@ virDomainChrDefParseTargetXML(virCapsPtr
     if ((def->targetType =
          virDomainChrTargetTypeFromString(caps, vmdef,
                                           def->deviceType, targetType)) < 0) {
+        virDomainReportError(VIR_ERR_XML_ERROR,
+                             _("unknown target type '%s' specified for character device"),
+                             targetType);
         goto error;
     }
 
openSUSE Build Service is sponsored by