For the QEMU / KVM driver, if the user doesn't specify an explicit name for the TAP device associated with a virtual NIC, we auto-generate one with a name vnetXXX. You can see this if you dump XML for a running QEMU guest. Unfortunately if you dump XML, make a change and then feed it back in with the define XML API, you have now persisted this auto-generated VIF name. Do this for several domains at varying times and you'll eventually get 2 domains which have persisted the same auto-generated vnetXXX device name. You can now not start both of these VMs at once. The fix for this is simple - simply strip any TAP device name starting with the string 'vnet' when defining a new VM. It will thus get assigned a new automatically generate name which doesn't clash. The patch also strips out hardcoded vnetXXX names when starting a VM to proactively deal with any existing VMs whose config has been broken in this way. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
Index: src/qemu_conf.c =================================================================== RCS file: /data/cvs/libvirt/src/qemu_conf.c,v retrieving revision 1.21 diff -u -p -r1.21 qemu_conf.c --- src/qemu_conf.c 3 Dec 2007 14:30:47 -0000 1.21 +++ src/qemu_conf.c 4 Dec 2007 16:56:42 -0000 @@ -657,6 +657,11 @@ static int qemudParseInterfaceXML(virCon (net->type == QEMUD_NET_BRIDGE)) && xmlStrEqual(cur->name, BAD_CAST "target")) { ifname = xmlGetProp(cur, BAD_CAST "dev"); + if (STREQLEN("vnet", (const char*)ifname, 4)) { + /* An auto-generated target name, blank it out */ + xmlFree(ifname); + ifname = NULL; + } } else if ((script == NULL) && (net->type == QEMUD_NET_ETHERNET) && xmlStrEqual(cur->name, BAD_CAST "script")) { @@ -1411,6 +1416,7 @@ qemudNetworkIfaceConnect(virConnectPtr c } brname = network->bridge; if (net->dst.network.ifname[0] == '\0' || + STREQLEN(net->dst.network.ifname, "vnet", 4) || strchr(net->dst.network.ifname, '%')) { strcpy(net->dst.network.ifname, "vnet%d"); } @@ -1418,6 +1424,7 @@ qemudNetworkIfaceConnect(virConnectPtr c } else if (net->type == QEMUD_NET_BRIDGE) { brname = net->dst.bridge.brname; if (net->dst.bridge.ifname[0] == '\0' || + STREQLEN(net->dst.bridge.ifname, "vnet", 4) || strchr(net->dst.bridge.ifname, '%')) { strcpy(net->dst.bridge.ifname, "vnet%d"); }
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list