提交 74acc4ca 编写于 作者: M Michal Privoznik

processNicRxFilterChangedEvent: Take appropriate actions for NET_TYPE_NETWORK too

Because packets going through the egress from a bridge (where our
bandwidth limiting takes place) have no information about which
interface they came from, the QoS rules that we create instead
use the source MAC address of the packets to make their decisions
about which QDisc the packet should be in.

One flaw in this is that when a guest changed the MAC address it
used, packets from the guest would no longer be put into the
correct QDisc, but would instead be put in an "unprivileged"
class, resulting in the bandwidth "floor" (minimum guaranteed)
being no longer honored.

Now that libvirt has infrastructure to capture and respond to
RX_FILTER_CHANGE events from qemu (sent whenever a guest
interface modifies its MAC address, among other things), we can
notice when a guest MAC address changes, and update the QoS rules
accordingly, so that bandwidth floor is honored even after a
guest MAC address change.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 e128b4a4
......@@ -4385,6 +4385,20 @@ processNicRxFilterChangedEvent(virQEMUDriverPtr driver,
syncNicRxFilterDeviceOptions(def->ifname, guestFilter, hostFilter);
}
if (virDomainNetGetActualType(def) == VIR_DOMAIN_NET_TYPE_NETWORK) {
const char *brname = virDomainNetGetActualBridgeName(def);
/* For libivrt network connections, set the following TUN/TAP network
* device attributes to match those of the guest network device:
* - QoS filters (which are based on MAC address)
*/
if (virDomainNetGetActualBandwidth(def) &&
def->data.network.actual &&
virNetDevBandwidthUpdateFilter(brname, &guestFilter->mac,
def->data.network.actual->class_id) < 0)
goto endjob;
}
endjob:
qemuDomainObjEndJob(driver, vm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册