]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Report error when parsing character device target type
authorJim Fehlig <jfehlig@suse.com>
Wed, 9 May 2012 17:12:38 +0000 (11:12 -0600)
committerCole Robinson <crobinso@redhat.com>
Thu, 14 Jun 2012 22:16:48 +0000 (18:16 -0400)
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
(cherry picked from commit 10a87145f73068e572d14d82a13df46c95960273)

src/conf/domain_conf.c

index f3828c362aa0894fd85c78c7086ec1532bb1ea67..8a39721acdc3baabafe9d604958685f9884a6744 100644 (file)
@@ -4857,6 +4857,9 @@ virDomainChrDefParseTargetXML(virCapsPtr caps,
     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;
     }