[libvirt] [PATCH] Error out on missing address in 'server' type interface

jiahu jiahu at redhat.com
Fri Aug 15 09:13:08 UTC 2014


On 08/15/2014 04:21 PM, Ján Tomko wrote:
> It was possible to add the following interface:
> <interface type='server'>
>    <source port='5558'/>
> </interface>
>
> Resulting in:
> error: internal error Process exited while reading console log output:
> char device redirected to /dev/pts/4
> 2014-08-15T05:59:17.348271Z qemu-kvm: -netdev
> socket,listen=(null):5558,id=hostnet0: Device 'socket' could not be
> initialized
>
> We already do this check for NET_TYPE_CLIENT and NET_TYPE_MCAST,
> do it also for NET_TYPE_SERVER.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1130390
> ---
>   src/conf/domain_conf.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 5c762fa..7ea628c 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -7118,13 +7118,10 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
>           }
>   
>           if (address == NULL) {
> -            if (def->type == VIR_DOMAIN_NET_TYPE_CLIENT ||
> -                def->type == VIR_DOMAIN_NET_TYPE_MCAST) {
> -                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                               _("No <source> 'address' attribute "
> -                                 "specified with socket interface"));
> -                goto error;
> -            }
> +            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                           _("No <source> 'address' attribute "
> +                             "specified with socket interface"));
> +            goto error;
>           } else {
>               def->data.socket.address = address;
>               address = NULL;
I think domaincommon.rng should have a sync change, address element is a 
mandatory in client and mcast type. Is it necessary?










More information about the libvir-list mailing list