From be9978bb89a8b390f457706ff425cc20ff3937a0 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 13 Oct 2017 16:29:36 -0700 Subject: [PATCH] virDomainInterfaceStats: Accept MAC addresses properly https://bugzilla.redhat.com/show_bug.cgi?id=1497396 In 0d3d020ba6c4f 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 Reviewed-by: John Ferlan --- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_driver.c | 2 +- src/openvz/openvz_driver.c | 2 +- src/qemu/qemu_driver.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 08b0f03177..2230343b03 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -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; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 6cf4993679..b3f6f064f3 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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; diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index ffd64da04b..9bd73d85c4 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -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; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7b79c09505..260184ce87 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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; } -- 2.39.5