[PATCH 1/8] Add new API virDomainBlockPull* to headers

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

 



Set up the types for the block pull functions and insert them into the
virDriver structure definition.  Symbols are exported in this patch to prevent
documentation compile failures.

* include/libvirt/libvirt.h.in: new API
* src/driver.h: add the new entry to the driver structure
* python/generator.py: fix compiler errors, the actual python bindings are
  implemented later
* src/libvirt_public.syms: export symbols
* docs/apibuild.py: Extend 'unsigned long' parameter exception to this API

Signed-off-by: Adam Litke <agl@xxxxxxxxxx>
---
 docs/apibuild.py             |    7 ++++-
 include/libvirt/libvirt.h.in |   44 ++++++++++++++++++++++++++++++++++++++++++
 python/generator.py          |    2 +
 src/driver.h                 |   24 ++++++++++++++++++++++
 src/libvirt_public.syms      |    7 ++++++
 5 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/docs/apibuild.py b/docs/apibuild.py
index 6e35cfb..53b3421 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -1641,7 +1641,9 @@ class CParser:
         "virDomainMigrateSetMaxSpeed"    : (False, ("bandwidth")),
         "virDomainSetMaxMemory"          : (False, ("memory")),
         "virDomainSetMemory"             : (False, ("memory")),
-        "virDomainSetMemoryFlags"        : (False, ("memory")) }
+        "virDomainSetMemoryFlags"        : (False, ("memory")),
+        "virDomainBlockJobSetSpeed"      : (False, ("bandwidth")),
+        "virDomainBlockPull"             : (False, ("bandwidth")) }
 
     def checkLongLegacyFunction(self, name, return_type, signature):
         if "long" in return_type and "long long" not in return_type:
@@ -1667,7 +1669,8 @@ class CParser:
     # [unsigned] long long
     long_legacy_struct_fields = \
       { "_virDomainInfo"                 : ("maxMem", "memory"),
-        "_virNodeInfo"                   : ("memory") }
+        "_virNodeInfo"                   : ("memory"),
+        "_virDomainBlockJobInfo"         : ("bandwidth") }
 
     def checkLongLegacyStruct(self, name, fields):
         for field in fields:
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 607b5bc..23947c7 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1375,6 +1375,50 @@ int virDomainUpdateDeviceFlags(virDomainPtr domain,
                                const char *xml, unsigned int flags);
 
 /*
+ * BlockJob API
+ */
+
+/**
+ * virDomainBlockJobType:
+ *
+ * VIR_DOMAIN_BLOCK_JOB_TYPE_PULL: Block Pull (virDomainBlockPull)
+ */
+typedef enum {
+    VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = 0,
+    VIR_DOMAIN_BLOCK_JOB_TYPE_PULL = 1,
+} virDomainBlockJobType;
+
+/* An iterator for monitoring block job operations */
+typedef unsigned long long virDomainBlockJobCursor;
+
+typedef struct _virDomainBlockJobInfo virDomainBlockJobInfo;
+struct _virDomainBlockJobInfo {
+    virDomainBlockJobType type;
+    unsigned long bandwidth;
+    /*
+     * The following fields provide an indication of block job progress.  @cur
+     * indicates the current position and will be between 0 and @end.  @end is
+     * the final cursor position for this operation and represents completion.
+     * To approximate progress, divide @cur by @end.
+     */
+    virDomainBlockJobCursor cur;
+    virDomainBlockJobCursor end;
+};
+typedef virDomainBlockJobInfo *virDomainBlockJobInfoPtr;
+
+int       virDomainBlockJobAbort(virDomainPtr dom, const char *path,
+                                 unsigned int flags);
+int     virDomainGetBlockJobInfo(virDomainPtr dom, const char *path,
+                                 virDomainBlockJobInfoPtr info,
+                                 unsigned int flags);
+int    virDomainBlockJobSetSpeed(virDomainPtr dom, const char *path,
+                                 unsigned long bandwidth, unsigned int flags);
+
+int           virDomainBlockPull(virDomainPtr dom, const char *path,
+                                 unsigned long bandwidth, unsigned int flags);
+
+
+/*
  * NUMA support
  */
 
diff --git a/python/generator.py b/python/generator.py
index 1cb82f5..b25c74e 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -186,6 +186,7 @@ def enum(type, name, value):
 functions_failed = []
 functions_skipped = [
     "virConnectListDomains",
+    'virDomainGetBlockJobInfo',
 ]
 
 skipped_modules = {
@@ -202,6 +203,7 @@ skipped_types = {
      'virStreamEventCallback': "No function types in python",
      'virEventHandleCallback': "No function types in python",
      'virEventTimeoutCallback': "No function types in python",
+     'virDomainBlockJobInfoPtr': "Not implemented yet",
 }
 
 #######################################################################
diff --git a/src/driver.h b/src/driver.h
index 9d0d3de..776bb7f 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -661,6 +661,26 @@ typedef int
                      unsigned long flags,
                      int cancelled);
 
+
+typedef int
+    (*virDrvDomainBlockJobAbort)(virDomainPtr dom, const char *path,
+                                 unsigned int flags);
+
+typedef int
+    (*virDrvDomainGetBlockJobInfo)(virDomainPtr dom, const char *path,
+                                   virDomainBlockJobInfoPtr info,
+                                   unsigned int flags);
+
+typedef int
+    (*virDrvDomainBlockJobSetSpeed)(virDomainPtr dom,
+                                    const char *path, unsigned long bandwidth,
+                                    unsigned int flags);
+
+typedef int
+    (*virDrvDomainBlockPull)(virDomainPtr dom, const char *path,
+                             unsigned long bandwidth, unsigned int flags);
+
+
 /**
  * _virDriver:
  *
@@ -802,6 +822,10 @@ struct _virDriver {
     virDrvDomainMigrateFinish3	domainMigrateFinish3;
     virDrvDomainMigrateConfirm3	domainMigrateConfirm3;
     virDrvDomainSendKey domainSendKey;
+    virDrvDomainBlockJobAbort domainBlockJobAbort;
+    virDrvDomainGetBlockJobInfo domainGetBlockJobInfo;
+    virDrvDomainBlockJobSetSpeed domainBlockJobSetSpeed;
+    virDrvDomainBlockPull domainBlockPull;
 };
 
 typedef int
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 5f2541a..5fc6398 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -467,3 +467,10 @@ LIBVIRT_0.9.3 {
 } LIBVIRT_0.9.2;
 
 # .... define new API here using predicted next version number ....
+LIBVIRT_0.9.4 {
+    global:
+        virDomainBlockJobAbort;
+        virDomainGetBlockJobInfo;
+        virDomainBlockJobSetSpeed;
+        virDomainBlockPull;
+} LIBVIRT_0.9.3;
-- 
1.7.3

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