virDomainInterfaceStats: Accept MAC addresses properly

https://bugzilla.redhat.com/show_bug.cgi?id=1497396

In 0d3d020ba6 I've added capability to accept MAC addresses
for the API too. However, the implementation was faulty. It needs
to lookup the corresponding interface in the domain definition
and pass the ifname instead of MAC address.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Michal Privoznik 2017-10-13 16:29:36 -07:00
parent ac7cc62419
commit be9978bb89
4 changed files with 5 additions and 5 deletions

View File

@ -4982,7 +4982,7 @@ libxlDomainInterfaceStats(virDomainPtr dom,
if (!(net = virDomainNetFind(vm->def, device)))
goto endjob;
if (virNetDevTapInterfaceStats(device, stats,
if (virNetDevTapInterfaceStats(net->ifname, stats,
!virDomainNetTypeSharesHostView(net)) < 0)
goto endjob;

View File

@ -2875,7 +2875,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
if (!(net = virDomainNetFind(vm->def, device)))
goto endjob;
if (virNetDevTapInterfaceStats(device, stats,
if (virNetDevTapInterfaceStats(net->ifname, stats,
!virDomainNetTypeSharesHostView(net)) < 0)
goto endjob;

View File

@ -2009,7 +2009,7 @@ openvzDomainInterfaceStats(virDomainPtr dom,
if (!(net = virDomainNetFind(vm->def, device)))
goto cleanup;
if (virNetDevTapInterfaceStats(device, stats,
if (virNetDevTapInterfaceStats(net->ifname, stats,
!virDomainNetTypeSharesHostView(net)) < 0)
goto cleanup;

View File

@ -11044,10 +11044,10 @@ qemuDomainInterfaceStats(virDomainPtr dom,
goto cleanup;
if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
if (virNetDevOpenvswitchInterfaceStats(device, stats) < 0)
if (virNetDevOpenvswitchInterfaceStats(net->ifname, stats) < 0)
goto cleanup;
} else {
if (virNetDevTapInterfaceStats(device, stats,
if (virNetDevTapInterfaceStats(net->ifname, stats,
!virDomainNetTypeSharesHostView(net)) < 0)
goto cleanup;
}