diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c index 2fe0499638..396ac62019 100644 --- a/src/conf/netdev_bandwidth_conf.c +++ b/src/conf/netdev_bandwidth_conf.c @@ -285,16 +285,16 @@ virNetDevBandwidthFormat(const virNetDevBandwidth *def, } void -virDomainClearNetBandwidth(virDomainObjPtr vm) +virDomainClearNetBandwidth(virDomainDefPtr def) { size_t i; virDomainNetType type; - for (i = 0; i < vm->def->nnets; i++) { - type = virDomainNetGetActualType(vm->def->nets[i]); - if (virDomainNetGetActualBandwidth(vm->def->nets[i]) && + for (i = 0; i < def->nnets; i++) { + type = virDomainNetGetActualType(def->nets[i]); + if (virDomainNetGetActualBandwidth(def->nets[i]) && virNetDevSupportsBandwidth(type)) - virNetDevBandwidthClear(vm->def->nets[i]->ifname); + virNetDevBandwidthClear(def->nets[i]->ifname); } } diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h index 5a70cb6bba..34046eacd7 100644 --- a/src/conf/netdev_bandwidth_conf.h +++ b/src/conf/netdev_bandwidth_conf.h @@ -34,7 +34,7 @@ int virNetDevBandwidthFormat(const virNetDevBandwidth *def, unsigned int class_id, virBufferPtr buf); -void virDomainClearNetBandwidth(virDomainObjPtr vm) +void virDomainClearNetBandwidth(virDomainDefPtr def) ATTRIBUTE_NONNULL(1); bool virNetDevSupportsBandwidth(virDomainNetType type); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c4b794c4bd..d9035055e8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7349,7 +7349,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, } /* Clear network bandwidth */ - virDomainClearNetBandwidth(vm); + virDomainClearNetBandwidth(vm->def); virDomainConfVMNWFilterTeardown(vm);