When fetching stats for a domain's <interface/>, or when setting up its QoS, we can face two situations: 1) the device "shares" the host view, meaning each packet sent/received on the interface by a domain is accounted for in the same category on the host, or 2) the device is at the other side, and a packet send by a domain, is in fact packet received on the host. This fact affects whether we need to swap RX/TX values when fetching stats, or setting up QoS. We have this convenient helper function (virDomainNetTypeSharesHostView()), which returns to which category given interface type falls into. Now, for unmanaged type='ethernet' our options are quite limited, because it's user's responsibility to set up the host side of the interface. And it can be just anything. Fortunately, we have another convenience function (virNetDevMacVLanIsMacvtap()), which determines whether given interface is a macvtap (which is notoriously known for falling into the first category). Let's use it to help virDomainNetTypeSharesHostView() determine the view more accurately. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2175449 Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/domain_conf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 34d38f9958..ee74d5ab8a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29576,8 +29576,12 @@ virDomainNetTypeSharesHostView(const virDomainNetDef *net) switch (actualType) { case VIR_DOMAIN_NET_TYPE_DIRECT: return true; - case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_ETHERNET: + if (net->managed_tap == VIR_TRISTATE_BOOL_NO && + virNetDevMacVLanIsMacvtap(net->ifname)) + return true; + break; + case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: -- 2.39.2