[PATCH 1/6] libvirt: Add virDomainSetBlkioParameters virDomainGetBlkioParameters

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

 



Add virDomainSetBlkioParameters virDomainGetBlkioParameters

Signed-off-by: Gui Jianfeng <guijianfeng@xxxxxxxxxxxxxx>
---
 include/libvirt/libvirt.h.in    |   67 +++++++++++++++++++++++++++++++++++++++
 python/generator.py             |    2 +
 python/libvirt-override-api.xml |   12 +++++++
 python/libvirt-override.c       |   17 ++++++++++
 4 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 5dfb752..00b6216 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -676,6 +676,73 @@ int                     virDomainGetInfo        (virDomainPtr domain,
  */
 char *                  virDomainGetSchedulerType(virDomainPtr domain,
                                                  int *nparams);
+/**
+ * virDomainBlkioParameterType:
+ *
+ * A blkio parameter field type
+ */
+typedef enum {
+    VIR_DOMAIN_BLKIO_PARAM_INT     = 1, /* integer case */
+    VIR_DOMAIN_BLKIO_PARAM_UINT    = 2, /* unsigned integer case */
+    VIR_DOMAIN_BLKIO_PARAM_LLONG   = 3, /* long long case */
+    VIR_DOMAIN_BLKIO_PARAM_ULLONG  = 4, /* unsigned long long case */
+    VIR_DOMAIN_BLKIO_PARAM_DOUBLE  = 5, /* double case */
+    VIR_DOMAIN_BLKIO_PARAM_BOOLEAN = 6  /* boolean(character) case */
+} virBlkioParameterType;
+
+/**
+ * VIR_DOMAIN_BLKIO_FIELD_LENGTH:
+ *
+ * Macro providing the field length of virBlkioParameter
+ */
+
+#define VIR_DOMAIN_BLKIO_FIELD_LENGTH 80
+
+/**
+ * VIR_DOMAIN_BLKIO_WEIGHT:
+ *
+ * Macro for the Blkio tunable weight: it represents the io weight
+ * the guest can use.
+ */
+
+#define VIR_DOMAIN_BLKIO_WEIGHT "weight"
+
+/**
+ * virDomainBlkioParameter:
+ *
+ * a virDomainBlkioParameter is the set of blkio cgroup parameteer
+ */
+
+typedef struct _virBlkioParameter virBlkioParameter;
+
+struct _virBlkioParameter {
+    char field[VIR_DOMAIN_BLKIO_FIELD_LENGTH];  /* parameter name */
+    int type;   /* parameter type */
+    union {
+        int i;                          /* data for integer case */
+        unsigned int ui;        /* data for unsigned integer case */
+        long long int l;        /* data for long long integer case */
+        unsigned long long int ul;      /* data for unsigned long long integer case */
+        double d;       /* data for double case */
+        char b;         /* data for char case */
+    } value; /* parameter value */
+};
+
+/**
+ * virBlkioParameterPtr:
+ *
+ * a virBlkioParameterPtr is a pointer to a virBlkioParameter structure.
+ */
+
+typedef virBlkioParameter *virBlkioParameterPtr;
+
+/* Set Blkio tunables for the domain*/
+int     virDomainSetBlkioParameters(virDomainPtr domain,
+                                     virBlkioParameterPtr params,
+                                     int nparams, unsigned int flags);
+int     virDomainGetBlkioParameters(virDomainPtr domain,
+                                     virBlkioParameterPtr params,
+                                     int *nparams, unsigned int flags);
 
 /**
  * virDomainMemoryParameterType:
diff --git a/python/generator.py b/python/generator.py
index 15751bd..8db4b9e 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -306,6 +306,8 @@ skip_impl = (
     'virDomainGetSchedulerType',
     'virDomainGetSchedulerParameters',
     'virDomainSetSchedulerParameters',
+    'virDomainSetBlkioParameters',
+    'virDomainGetBlkioParameters',
     'virDomainSetMemoryParameters',
     'virDomainGetMemoryParameters',
     'virDomainGetVcpus',
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index f209608..54deeb5 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -162,6 +162,18 @@
       <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
       <arg name='params' type='virSchedParameterPtr' info='pointer to scheduler parameter objects'/>
     </function>
+    <function name='virDomainSetBlkioParameters' file='python'>
+      <info>Change the blkio tunables</info>
+      <return type='int' info='-1 in case of error, 0 in case of success.'/>
+      <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
+      <arg name='params' type='virBlkioParameterPtr' info='pointer to blkio tunable objects'/>
+    </function>
+    <function name='virDomainGetBlkioParameters' file='python'>
+      <info>Get the blkio parameters, the @params array will be filled with the values.</info>
+      <return type='int' info='-1 in case of error, 0 in case of success.'/>
+      <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
+      <arg name='params' type='virBlkioParameterPtr' info='pointer to blkio tunable objects'/>
+    </function>
     <function name='virDomainSetMemoryParameters' file='python'>
       <info>Change the memory tunables</info>
       <return type='int' info='-1 in case of error, 0 in case of success.'/>
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 4a03d72..e09e2b5 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -371,6 +371,23 @@ libvirt_virDomainSetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED,
     return VIR_PY_INT_SUCCESS;
 }
 
+
+
+
+/* FIXME: This is a place holder for the implementation. */
+static PyObject *
+libvirt_virDomainSetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED,
+                                     PyObject *args ATTRIBUTE_UNUSED) {
+    return VIR_PY_INT_FAIL;
+}
+
+/* FIXME: This is a place holder for the implementation. */
+static PyObject *
+libvirt_virDomainGetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED,
+                                     PyObject *args ATTRIBUTE_UNUSED) {
+    return VIR_PY_INT_FAIL;
+}
+
 /* FIXME: This is a place holder for the implementation. */
 static PyObject *
 libvirt_virDomainSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
-- 
1.7.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]