[libvirt PATCH 6/8] conf: do not pass vm object to virDomainClearNetBandwidth

Ján Tomko jtomko at redhat.com
Sat Feb 22 16:31:57 UTC 2020


This function only uses the domain definition.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/conf/netdev_bandwidth_conf.c | 10 +++++-----
 src/conf/netdev_bandwidth_conf.h |  2 +-
 src/qemu/qemu_process.c          |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

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 8c1ed76677..3099099819 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7348,7 +7348,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     }
 
     /* Clear network bandwidth */
-    virDomainClearNetBandwidth(vm);
+    virDomainClearNetBandwidth(vm->def);
 
     virDomainConfVMNWFilterTeardown(vm);
 
-- 
2.24.1




More information about the libvir-list mailing list