[libvirt] [PATCH] Report error when parsing character device target type

Eric Blake eblake at redhat.com
Wed May 9 19:00:45 UTC 2012


On 05/09/2012 11:48 AM, Jim Fehlig wrote:
> 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
> ---
>  src/conf/domain_conf.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 976e42b..54ac1db 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4895,6 +4895,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;

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120509/f89f1865/attachment-0001.sig>


More information about the libvir-list mailing list