[PATCH 1/6] Add API virDomain{S,G}etInterfaceParameters

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

 



The APIs are used to set/get domain's network interface's parameters.
Currently supported parameters are bandwidth settings.


* include/libvirt/libvirt.h.in: new API and parameters definition
* python/generator.py: fix compiler errors
* src/driver.h: add new entry to the driver structure
* src/libvirt_public.syms: export symbols
---
 include/libvirt/libvirt.h.in |   50 ++++++++++++++++++++++++++++++++++++++++++
 python/generator.py          |    2 +
 src/driver.h                 |   12 ++++++++++
 src/libvirt_public.syms      |    6 +++++
 4 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 2480add..6335509 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -645,6 +645,48 @@ typedef virTypedParameter *virTypedParameterPtr;
  */
 #define VIR_DOMAIN_SCHEDULER_SHARES "shares"
 
+/**
+ * VIR_DOMAIN_BANDWIDTH_IN_AVERAGE:
+ *
+ * Macro represents the inbound average of NIC bandwidth.
+ */
+#define VIR_DOMAIN_BANDWIDTH_IN_AVERAGE "inbound.average"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_IN_PEAK:
+ *
+ * Macro represents the inbound peak of NIC bandwidth.
+ */
+#define VIR_DOMAIN_BANDWIDTH_IN_PEAK "inbound.peak"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_IN_BURST:
+ *
+ * Macro represents the inbound burst of NIC bandwidth.
+ */
+#define VIR_DOMAIN_BANDWIDTH_IN_BURST "inbound.burst"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE:
+ *
+ * Macro represents the outbound average of NIC bandwidth.
+ */
+#define VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE "outbound.average"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_OUT_PEAK:
+ *
+ * Macro represents the outbound peak of NIC bandwidth.
+ */
+#define VIR_DOMAIN_BANDWIDTH_OUT_PEAK "outbound.peak"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_OUT_BURST:
+ *
+ * Macro represents the outbound burst of NIC bandwidth.
+ */
+#define VIR_DOMAIN_BANDWIDTH_OUT_BURST "outbound.burst"
+
 /*
  * Fetch scheduler parameters, caller allocates 'params' field of size 'nparams'
  */
@@ -1407,6 +1449,14 @@ int                     virDomainInterfaceStats (virDomainPtr dom,
                                                  const char *path,
                                                  virDomainInterfaceStatsPtr stats,
                                                  size_t size);
+int                     virDomainSetInterfaceParameters (virDomainPtr dom,
+                                                        const char *device,
+                                                        virTypedParameterPtr params,
+                                                        int nparams, unsigned int flags);
+int                     virDomainGetInterfaceParameters (virDomainPtr dom,
+                                                        const char *device,
+                                                        virTypedParameterPtr params,
+                                                        int *nparams, unsigned int flags);
 int                     virDomainMemoryStats (virDomainPtr dom,
                                               virDomainMemoryStatPtr stats,
                                               unsigned int nr_stats,
diff --git a/python/generator.py b/python/generator.py
index 88c52b9..b45543d 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -416,6 +416,8 @@ skip_impl = (
     'virDomainBlockStatsFlags',
     'virDomainSetBlockIoTune',
     'virDomainGetBlockIoTune',
+    'virDomainSetInterfaceParameters',
+    'virDomainGetInterfaceParameters',
 )
 
 qemu_skip_impl = (
diff --git a/src/driver.h b/src/driver.h
index 941ff51..1276646 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -362,6 +362,16 @@ typedef int
                     (virDomainPtr domain,
                      const char *path,
                      struct _virDomainInterfaceStats *stats);
+typedef int
+    (*virDrvDomainSetInterfaceParameters) (virDomainPtr dom,
+                                          const char *device,
+                                          virTypedParameterPtr params,
+                                          int nparams, unsigned int flags);
+typedef int
+    (*virDrvDomainGetInterfaceParameters) (virDomainPtr dom,
+                                          const char *device,
+                                          virTypedParameterPtr params,
+                                          int *nparams, unsigned int flags);
 
 typedef int
     (*virDrvDomainMemoryStats)
@@ -868,6 +878,8 @@ struct _virDriver {
     virDrvDomainBlockStats      domainBlockStats;
     virDrvDomainBlockStatsFlags domainBlockStatsFlags;
     virDrvDomainInterfaceStats  domainInterfaceStats;
+    virDrvDomainSetInterfaceParameters domainSetInterfaceParameters;
+    virDrvDomainGetInterfaceParameters domainGetInterfaceParameters;
     virDrvDomainMemoryStats     domainMemoryStats;
     virDrvDomainBlockPeek	domainBlockPeek;
     virDrvDomainMemoryPeek      domainMemoryPeek;
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 164039a..768d488 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -508,4 +508,10 @@ LIBVIRT_0.9.8 {
         virNodeSuspendForDuration;
 } LIBVIRT_0.9.7;
 
+LIBVIRT_0.9.9 {
+    global:
+        virDomainGetInterfaceParameters;
+        virDomainSetInterfaceParameters;
+} LIBVIRT_0.9.8;
+
 # .... define new API here using predicted next version number ....
-- 
1.7.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]