Yes it works.
Thanks. You saved my life.
Let me ask something I can't see it in the code:
This is the code that i found:
static int
networkStartNetworkVirtual(virNetworkObjPtr network)
{
size_t i;
bool v4present = false, v6present = false;
virErrorPtr save_err = NULL;
virNetworkIpDefPtr ipdef;
virNetworkRouteDefPtr routedef;
char *macTapIfName = NULL;
int tapfd = -1;
/* Check to see if any network IP collides with an existing route */
if (networkCheckRouteCollision(network->def) < 0)
return -1;
/* Create and configure the bridge device */
if (virNetDevBridgeCreate(network->def->bridge) < 0)
return -1;
....
It either create device or return -1. So I was hopeless about a solution :)
But your method saved me.
On 08/13/2015 01:18 AM, Laine Stump wrote:
On 08/12/2015 05:49 PM, Fırat KÜÇÜK wrote:
> Hello,
>
> Simply I want to create a network on an existing bridge.
> My XML:
>
> <network>
> <name>nn1</name>
> <bridge name="br-nn1" />
> </network>
I think what you want is this:
<network>
<name>nn1</name>
<forward mode='bridge'/>
<bridge name='br-nn1'/>
</network>
https://libvirt.org/formatnetwork.html#examplesBridge
(Originally a network with no <forward> element was considered to be a
virtual network with bridge created by libvirt but no physical device
attached. When support for networks that used an existing bridge was
added, we had to maintain backward compatibility, so we decided that
the new type of network would be identified by setting <forward
mode='bridge'/> on a network that has a bridge name defined.)
>
> when i want to start network I got "File exist" error.
>
> error: Failed to start network nn1
> error: Unable to create bridge br-nn1: File exist
>
> I could define on older releases but now I can't.
> Ubuntu 15.04 / libvirt version: 1.2.12
No, that wouldn't have worked in any older release of libvirt. Perhaps
you've forgotten that you previously had <forward mode='bridge'/> in
your definition?
>
> virsh version:
> Compiled against library: libvirt 1.2.12
> Using library: libvirt 1.2.12
> Using API: QEMU 1.2.12
> Running hypervisor: QEMU 2.2.0
>
> Is there any way to activate network?
>
> Regards.
>
>
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/libvirt-users
--
CODVIO <
http://codv.io>
Fırat KÜÇÜK / CEO, Founder
firat(a)codv.io <mailto:firat@codv.io> / +90 555 422 77 55
CODVIO
+90 216 330 55 11
OSMAN AĞA MAH. SÖĞÜTLÜ ÇEŞME CAD. NO: 64/96 KADIKÖY / İSTANBUL
codv.io <
http://codv.io>