# HG changeset patch # User john.levon@xxxxxxx # Date 1233586907 28800 # Node ID 68087e3caf39c74797720bde71a8df524ec036c8 # Parent aa50ca252e1419f30eb0e16204b48db42d92c785 Allow no <source> for bridge interfaces Historically, it was allowed to specify a bridge interface without a specific bridge source, in which case xend would choose one. Keep compatible with this behaviour. Signed-off-by: John Levon <john.levon@xxxxxxx> diff --git a/src/domain_conf.c b/src/domain_conf.c --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -962,13 +962,10 @@ virDomainNetDefParseXML(virConnectPtr co break; case VIR_DOMAIN_NET_TYPE_BRIDGE: - if (bridge == NULL) { - virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s", - _("No <source> 'dev' attribute specified with <interface type='bridge'/>")); - goto error; - } - def->data.bridge.brname = bridge; - bridge = NULL; + if (bridge != NULL) { + def->data.bridge.brname = bridge; + bridge = NULL; + } if (script != NULL) { def->data.bridge.script = script; script = NULL; @@ -2920,8 +2917,9 @@ virDomainNetDefFormat(virConnectPtr conn break; case VIR_DOMAIN_NET_TYPE_BRIDGE: - virBufferEscapeString(buf, " <source bridge='%s'/>\n", - def->data.bridge.brname); + if (def->data.bridge.brname) + virBufferEscapeString(buf, " <source bridge='%s'/>\n", + def->data.bridge.brname); if (def->data.bridge.ipaddr) virBufferVSprintf(buf, " <ip address='%s'/>\n", def->data.bridge.ipaddr); diff --git a/src/xend_internal.c b/src/xend_internal.c --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -5149,7 +5149,8 @@ xenDaemonFormatSxprNet(virConnectPtr con switch (def->type) { case VIR_DOMAIN_NET_TYPE_BRIDGE: - virBufferVSprintf(buf, "(bridge '%s')", def->data.bridge.brname); + if (def->data.bridge.brname) + virBufferVSprintf(buf, "(bridge '%s')", def->data.bridge.brname); if (def->data.bridge.script) script = def->data.bridge.script; -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list