提交 0a85aad5 编写于 作者: D Daniel P. Berrangé

network: apply bandwidth settings for forward mode=bridge

We previously allowed bandwidth settings when attaching NICs
to networks with forward mode=bridge:

  commit 42a92ee9
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Tue Nov 20 11:30:05 2018 +0000

    network: add missing bandwidth limits for bridge forward type

    In the case of a network with forward=bridge, which has a bridge device
    listed, we are capable of setting bandwidth limits but fail to call the
    function to register them.
Reviewed-by: NCole Robinson <crobinso@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>

Unfortunately the wrong version of this patch was posted and
reviewed and thus it lacked the code to actually apply the
bandwidth settings to the bridge itself.
Reviewed-by: NLaine Stump <laine@laine.org>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 7ab9bdd4
......@@ -2743,21 +2743,39 @@ networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver,
static int
networkStartNetworkBridge(virNetworkObjPtr obj)
{
virNetworkDefPtr def = virNetworkObjGetDef(obj);
/* put anything here that needs to be done each time a network of
* type BRIDGE, is started. On failure, undo anything you've done,
* and return -1. On success return 0.
*/
return networkStartHandleMACTableManagerMode(obj, NULL);
if (virNetDevBandwidthSet(def->bridge, def->bandwidth, true, true) < 0)
goto error;
if (networkStartHandleMACTableManagerMode(obj, NULL) < 0)
goto error;
return 0;
error:
if (def->bandwidth)
virNetDevBandwidthClear(def->bridge);
return -1;
}
static int
networkShutdownNetworkBridge(virNetworkObjPtr obj ATTRIBUTE_UNUSED)
{
virNetworkDefPtr def = virNetworkObjGetDef(obj);
/* put anything here that needs to be done each time a network of
* type BRIDGE is shutdown. On failure, undo anything you've done,
* and return -1. On success return 0.
*/
if (def->bandwidth)
virNetDevBandwidthClear(def->bridge);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册