Signed-off-by: Lin Ma <lma@xxxxxxxx> --- src/qemu/qemu_driver.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7a9a2bcf97..33ae68129d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19804,9 +19804,6 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, struct _virDomainInterfaceStats tmp; int ret = -1; - if (!virDomainObjIsActive(dom)) - return 0; - QEMU_ADD_COUNT_PARAM(record, maxparams, "net", dom->def->nnets); /* Check the path is one of the domain's network interfaces. */ @@ -19814,6 +19811,14 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, virDomainNetDefPtr net = dom->def->nets[i]; virDomainNetType actualType; + QEMU_ADD_NAME_PARAM(record, maxparams, + "net", "type", i, virDomainNetTypeToString(net->type)); + QEMU_ADD_NAME_PARAM(record, maxparams, + "net", "source", i, net->data.bridge.brname); + + if (!virDomainObjIsActive(dom)) + return 0; + if (!net->ifname) continue; @@ -19823,10 +19828,6 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, QEMU_ADD_NAME_PARAM(record, maxparams, "net", "name", i, net->ifname); - QEMU_ADD_NAME_PARAM(record, maxparams, - "net", "type", i, virDomainNetTypeToString(net->type)); - QEMU_ADD_NAME_PARAM(record, maxparams, - "net", "source", i, net->data.bridge.brname); if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) { if (virNetDevOpenvswitchInterfaceStats(net->ifname, &tmp) < 0) { -- 2.15.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list