提交 06313277 编写于 作者: L Laine Stump

network: check newDef for used bridge names in addition to def

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.
上级 37b8bc6f
......@@ -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))))
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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册