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

Martin Kletzander mkletzan at redhat.com
Fri Aug 15 08:48:43 UTC 2014


On Fri, Aug 15, 2014 at 10:21:36AM +0200, 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 {

You could've removed the else to clean it up a bit.

ACK either way.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140815/911a1d44/attachment-0001.sig>


More information about the libvir-list mailing list