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

[libvirt] [PATCH 1/6] Add new API virDomainStreamDisk[Info] to header and drivers



Set up the types for the disk streaming functions and insert it into the
virDriver structure definition.  Because of static initializers, update every
driver and set the new field to NULL.

* include/libvirt/libvirt.h.in: new API
* src/driver.h src/*/*_driver.c src/vbox/vbox_tmpl.c: add the new
  entry to the driver structure
* python/generator.py: fix compiler errors, the actual python bindings are
  implemented later

Signed-off-by: Adam Litke <agl us ibm com>
---
 include/libvirt/libvirt.h.in |   34 ++++++++++++++++++++++++++++++++++
 python/generator.py          |    3 +++
 src/driver.h                 |   11 +++++++++++
 src/esx/esx_driver.c         |    2 ++
 src/lxc/lxc_driver.c         |    2 ++
 src/opennebula/one_driver.c  |    2 ++
 src/openvz/openvz_driver.c   |    2 ++
 src/phyp/phyp_driver.c       |    2 ++
 src/qemu/qemu_driver.c       |    2 ++
 src/remote/remote_driver.c   |    2 ++
 src/test/test_driver.c       |    2 ++
 src/uml/uml_driver.c         |    2 ++
 src/vbox/vbox_tmpl.c         |    2 ++
 src/xen/xen_driver.c         |    2 ++
 14 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 81db3a2..b46e0cb 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1046,6 +1046,40 @@ int virDomainUpdateDeviceFlags(virDomainPtr domain,
                                const char *xml, unsigned int flags);
 
 /*
+ * Disk Streaming
+ */
+typedef enum {
+    VIR_STREAM_DISK_ONE   = 1,  /* Stream a single disk unit */
+    VIR_STREAM_DISK_START = 2,  /* Stream the entire disk */
+    VIR_STREAM_DISK_STOP  = 4,  /* Stop streaming a disk */
+} virDomainStreamDiskFlags;
+
+#define VIR_STREAM_PATH_BUFLEN 1024
+#define VIR_STREAM_DISK_MAX_STREAMS 10
+
+typedef struct _virStreamDiskState virStreamDiskState;
+struct _virStreamDiskState {
+    char path[VIR_STREAM_PATH_BUFLEN];
+    /*
+     * The unit of measure for size and offset is unspecified.  These fields
+     * are meant to indicate the progress of a continuous streaming operation.
+     */
+    unsigned long long offset; /* Current offset of active streaming */
+    unsigned long long size;   /* Disk size */
+};
+typedef virStreamDiskState *virStreamDiskStatePtr;
+
+unsigned long long       virDomainStreamDisk(virDomainPtr dom,
+                                             const char *path,
+                                             unsigned long long offset,
+                                             unsigned int flags);
+
+int                      virDomainStreamDiskInfo(virDomainPtr dom,
+                                                 virStreamDiskStatePtr states,
+                                                 unsigned int nr_states,
+                                                 unsigned int flags);
+
+/*
  * NUMA support
  */
 
diff --git a/python/generator.py b/python/generator.py
index 68009b9..2477b59 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -161,6 +161,8 @@ def enum(type, name, value):
 functions_failed = []
 functions_skipped = [
     "virConnectListDomains",
+    "virDomainStreamDisk",
+    "virDomainStreamDiskInfo",
 ]
 
 skipped_modules = {
@@ -175,6 +177,7 @@ skipped_types = {
      'virConnectDomainEventIOErrorCallback': "No function types in python",
      'virConnectDomainEventGraphicsCallback': "No function types in python",
      'virEventAddHandleFunc': "No function types in python",
+     'virStreamDiskStatePtr': "Not implemented yet",
 }
 
 #######################################################################
diff --git a/src/driver.h b/src/driver.h
index 79a96c1..3c83cf5 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -476,6 +476,15 @@ typedef int
     (*virDrvDomainSnapshotDelete)(virDomainSnapshotPtr snapshot,
                                   unsigned int flags);
 
+typedef unsigned long long
+    (*virDrvDomainStreamDisk)(virDomainPtr dom, const char *path,
+                              unsigned long long offset, unsigned int flags);
+
+typedef int
+    (*virDrvDomainStreamDiskInfo)(virDomainPtr dom,
+                                  virStreamDiskStatePtr states,
+                                  unsigned int nr_states, unsigned int flags);
+
 typedef int
     (*virDrvQemuDomainMonitorCommand)(virDomainPtr domain, const char *cmd,
                                       char **result, unsigned int flags);
@@ -598,6 +607,8 @@ struct _virDriver {
     virDrvQemuDomainMonitorCommand qemuDomainMonitorCommand;
     virDrvDomainSetMemoryParameters domainSetMemoryParameters;
     virDrvDomainGetMemoryParameters domainGetMemoryParameters;
+    virDrvDomainStreamDisk domainStreamDisk;
+    virDrvDomainStreamDiskInfo domainStreamDiskInfo;
 };
 
 typedef int
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index b3e1284..39c6e43 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -4253,6 +4253,8 @@ static virDriver esxDriver = {
     NULL,                            /* qemuDomainMonitorCommand */
     NULL,                            /* domainSetMemoryParameters */
     NULL,                            /* domainGetMemoryParameters */
+    NULL,                            /* domainStreamDisk */
+    NULL,                            /* domainStreamDiskInfo */
 };
 
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index d39b60e..685316d 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2844,6 +2844,8 @@ static virDriver lxcDriver = {
     NULL, /* qemuDomainMonitorCommand */
     lxcDomainSetMemoryParameters, /* domainSetMemoryParameters */
     lxcDomainGetMemoryParameters, /* domainGetMemoryParameters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static virStateDriver lxcStateDriver = {
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
index 199fca3..1525815 100644
--- a/src/opennebula/one_driver.c
+++ b/src/opennebula/one_driver.c
@@ -822,6 +822,8 @@ static virDriver oneDriver = {
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainSetMemoryParameters */
     NULL, /* domainGetMemoryParameters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static virStateDriver oneStateDriver = {
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index b7c2754..752f764 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1690,6 +1690,8 @@ static virDriver openvzDriver = {
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainSetMemoryParameters */
     NULL, /* domainGetMemoryParameters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 int openvzRegister(void) {
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 3d0ed11..5cf8ef0 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -4036,6 +4036,8 @@ static virDriver phypDriver = {
     NULL,                       /* qemuMonitorCommand */
     NULL,                       /* domainSetMemoryParameters */
     NULL,                       /* domainGetMemoryParameters */
+    NULL,                       /* domainStreamDisk */
+    NULL,                       /* domainStreamDiskInfo */
 };
 
 static virStorageDriver phypStorageDriver = {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1eea3a9..dbde9e7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13298,6 +13298,8 @@ static virDriver qemuDriver = {
     qemuDomainMonitorCommand, /* qemuDomainMonitorCommand */
     qemuDomainSetMemoryParameters, /* domainSetMemoryParameters */
     qemuDomainGetMemoryParameters, /* domainGetMemoryParameters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index c8d9a4d..237e03b 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -10540,6 +10540,8 @@ static virDriver remote_driver = {
     remoteQemuDomainMonitorCommand, /* qemuDomainMonitorCommand */
     remoteDomainSetMemoryParameters, /* domainSetMemoryParameters */
     remoteDomainGetMemoryParameters, /* domainGetMemoryParameters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index a9d3d89..01c2956 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5447,6 +5447,8 @@ static virDriver testDriver = {
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainSetMemoryParameters */
     NULL, /* domainGetMemoryParameters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static virNetworkDriver testNetworkDriver = {
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 5161012..37fe937 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2200,6 +2200,8 @@ static virDriver umlDriver = {
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainSetMemoryParamters */
     NULL, /* domainGetMemoryParamters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static int
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index ddbca97..b317a11 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -8464,6 +8464,8 @@ virDriver NAME(Driver) = {
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainSetMemoryParameters */
     NULL, /* domainGetMemoryParameters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 virNetworkDriver NAME(NetworkDriver) = {
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 66e8518..08550a7 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2087,6 +2087,8 @@ static virDriver xenUnifiedDriver = {
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainSetMemoryParameters */
     NULL, /* domainGetMemoryParameters */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 /**
-- 
1.7.3.2.164.g6f10c


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