On Sat, Apr 25, 2015 at 12:14 AM, Laine Stump <laine@xxxxxxxxx> wrote: > If someone has updated a network to change its bridge name, but the > network is still active (so that bridge name hasn't taken effect yet), > we still want to disallow another network from taking that new name. > --- > As suggested by Shivaprasad following his tests of patches 1 and 2... > > src/conf/network_conf.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c > index aa8d6c6..5b734f2 100644 > --- a/src/conf/network_conf.c > +++ b/src/conf/network_conf.c > @@ -3270,15 +3270,22 @@ virNetworkBridgeInUseHelper(const void *payload, > const void *name ATTRIBUTE_UNUSED, > const void *opaque) > { > - int ret = 0; > + int ret; > virNetworkObjPtr net = (virNetworkObjPtr) payload; > const struct virNetworkBridgeInUseHelperData *data = opaque; > > virObjectLock(net); > - if (net->def->bridge && > - STREQ(net->def->bridge, data->bridge) && > - !(data->skipname && STREQ(net->def->name, data->skipname))) > + if (data->skipname && > + ((net->def && STREQ(net->def->name, data->skipname)) || > + (net->newDef && STREQ(net->newDef->name, data->skipname)))) Should the newDef->name be really be checked? The network cant be renamed. Right ? Thanks, Shiva > + ret = 0; > + else if ((net->def && net->def->bridge && > + STREQ(net->def->bridge, data->bridge)) || > + (net->newDef && net->newDef->bridge && > + STREQ(net->newDef->bridge, data->bridge))) > ret = 1; > + else > + ret = 0; > virObjectUnlock(net); > return ret; > } > -- > 2.1.0 > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list