[PATCH 4/5] conf: Move virDomainClearNetBandwidth() to src/hypervisor/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The reason virDomainClearNetBandwidth() exists in src/conf/ is
that at the time its introduction we did not have a better place.
But now we do. Firstly, virDomainClearNetBandwidth() is
hypervisor agnostic code, but really has nothing to do with
domain configuration (it doesn't parse/format XML). Secondly, in
near future it'll call another function from src/hypervisor/ and
that's not really allowed from src/conf/.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/netdev_bandwidth_conf.c  | 14 --------------
 src/conf/netdev_bandwidth_conf.h  |  3 ---
 src/hypervisor/domain_interface.c | 16 ++++++++++++++++
 src/hypervisor/domain_interface.h |  2 ++
 src/libvirt_private.syms          |  2 +-
 5 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c
index cdf289270a..9faa46a27f 100644
--- a/src/conf/netdev_bandwidth_conf.c
+++ b/src/conf/netdev_bandwidth_conf.c
@@ -199,20 +199,6 @@ virNetDevBandwidthFormat(const virNetDevBandwidth *def,
     return 0;
 }
 
-void
-virDomainClearNetBandwidth(virDomainDef *def)
-{
-    size_t i;
-    virDomainNetType type;
-
-    for (i = 0; i < def->nnets; i++) {
-        type = virDomainNetGetActualType(def->nets[i]);
-        if (virDomainNetGetActualBandwidth(def->nets[i]) &&
-            virNetDevSupportsBandwidth(type))
-            virNetDevBandwidthClear(def->nets[i]->ifname);
-    }
-}
-
 
 bool virNetDevSupportsBandwidth(virDomainNetType type)
 {
diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h
index c698cc9dbc..b679b0f51f 100644
--- a/src/conf/netdev_bandwidth_conf.h
+++ b/src/conf/netdev_bandwidth_conf.h
@@ -34,9 +34,6 @@ int virNetDevBandwidthFormat(const virNetDevBandwidth *def,
                              unsigned int class_id,
                              virBuffer *buf);
 
-void virDomainClearNetBandwidth(virDomainDef *def)
-    ATTRIBUTE_NONNULL(1);
-
 bool virNetDevSupportsBandwidth(virDomainNetType type);
 bool virNetDevBandwidthHasFloor(const virNetDevBandwidth *b);
 bool virNetDevBandwidthSupportsFloor(virNetworkForwardType type);
diff --git a/src/hypervisor/domain_interface.c b/src/hypervisor/domain_interface.c
index ccf4cb94bd..0a9cad8011 100644
--- a/src/hypervisor/domain_interface.c
+++ b/src/hypervisor/domain_interface.c
@@ -27,6 +27,7 @@
 #include "domain_driver.h"
 #include "domain_interface.h"
 #include "domain_nwfilter.h"
+#include "netdev_bandwidth_conf.h"
 #include "network_conf.h"
 #include "viralloc.h"
 #include "virconftypes.h"
@@ -469,3 +470,18 @@ virDomainInterfaceDeleteDevice(virDomainDef *def,
     }
 
 }
+
+
+void
+virDomainClearNetBandwidth(virDomainDef *def)
+{
+    size_t i;
+    virDomainNetType type;
+
+    for (i = 0; i < def->nnets; i++) {
+        type = virDomainNetGetActualType(def->nets[i]);
+        if (virDomainNetGetActualBandwidth(def->nets[i]) &&
+            virNetDevSupportsBandwidth(type))
+            virNetDevBandwidthClear(def->nets[i]->ifname);
+    }
+}
diff --git a/src/hypervisor/domain_interface.h b/src/hypervisor/domain_interface.h
index 8047fdadfa..bb212cf3b8 100644
--- a/src/hypervisor/domain_interface.h
+++ b/src/hypervisor/domain_interface.h
@@ -44,3 +44,5 @@ void virDomainInterfaceDeleteDevice(virDomainDef *def,
                                 virDomainNetDef *net,
                                 bool priv_net_created,
                                 char *stateDir);
+void virDomainClearNetBandwidth(virDomainDef *def)
+    ATTRIBUTE_NONNULL(1);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8642305a8b..328f5b347b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -813,7 +813,6 @@ virDomainMomentDefPostParse;
 
 
 # conf/netdev_bandwidth_conf.h
-virDomainClearNetBandwidth;
 virNetDevBandwidthFormat;
 virNetDevBandwidthHasFloor;
 virNetDevBandwidthParse;
@@ -1635,6 +1634,7 @@ virDomainDriverParseBlkioDeviceStr;
 virDomainDriverSetupPersistentDefBlkioParams;
 
 # hypervisor/domain_interface.h
+virDomainClearNetBandwidth;
 virDomainInterfaceDeleteDevice;
 virDomainInterfaceEthernetConnect;
 virDomainInterfaceIsVnetCompatModel;
-- 
2.43.2
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux