[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/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/vmware/vmware_driver.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 bd36015..7c7686d 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1143,6 +1143,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 4fa4f65..69ffcad 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -166,6 +166,8 @@ def enum(type, name, value):
 functions_failed = []
 functions_skipped = [
     "virConnectListDomains",
+    "virDomainStreamDisk",
+    "virDomainStreamDiskInfo",
 ]
 
 skipped_modules = {
@@ -180,6 +182,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 e5f91ca..b333075 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -505,6 +505,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);
@@ -639,6 +648,8 @@ struct _virDriver {
     virDrvDomainSnapshotDelete domainSnapshotDelete;
     virDrvQemuDomainMonitorCommand qemuDomainMonitorCommand;
     virDrvDomainOpenConsole domainOpenConsole;
+    virDrvDomainStreamDisk domainStreamDisk;
+    virDrvDomainStreamDiskInfo domainStreamDiskInfo;
 };
 
 typedef int
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index deda372..22a8cb7 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -4675,6 +4675,8 @@ static virDriver esxDriver = {
     esxDomainSnapshotDelete,         /* domainSnapshotDelete */
     NULL,                            /* qemuDomainMonitorCommand */
     NULL,                            /* domainOpenConsole */
+    NULL,                            /* domainStreamDisk */
+    NULL,                            /* domainStreamDiskInfo */
 };
 
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index e905302..f6f7d83 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2906,6 +2906,8 @@ static virDriver lxcDriver = {
     NULL, /* domainSnapshotDelete */
     NULL, /* qemuDomainMonitorCommand */
     lxcDomainOpenConsole, /* domainOpenConsole */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static virStateDriver lxcStateDriver = {
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 4af28e9..ef52e1e 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1667,6 +1667,8 @@ static virDriver openvzDriver = {
     NULL, /* domainSnapshotDelete */
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainOpenConsole */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 int openvzRegister(void) {
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index ddbc103..5555d7b 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -4072,6 +4072,8 @@ static virDriver phypDriver = {
     NULL,                       /* domainSnapshotDelete */
     NULL,                       /* qemuMonitorCommand */
     NULL, /* domainOpenConsole */
+    NULL,                       /* domainStreamDisk */
+    NULL,                       /* domainStreamDiskInfo */
 };
 
 static virStorageDriver phypStorageDriver = {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a84780b..5e2d725 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6928,6 +6928,8 @@ static virDriver qemuDriver = {
     qemuDomainSnapshotDelete, /* domainSnapshotDelete */
     qemuDomainMonitorCommand, /* qemuDomainMonitorCommand */
     qemuDomainOpenConsole, /* domainOpenConsole */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9310ddf..29c9ff6 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -11300,6 +11300,8 @@ static virDriver remote_driver = {
     remoteDomainSnapshotDelete, /* domainSnapshotDelete */
     remoteQemuDomainMonitorCommand, /* qemuDomainMonitorCommand */
     remoteDomainOpenConsole, /* domainOpenConsole */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 17f5ad9..72929d8 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5447,6 +5447,8 @@ static virDriver testDriver = {
     NULL, /* domainSnapshotDelete */
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainOpenConsole */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static virNetworkDriver testNetworkDriver = {
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 33849a0..2f64f47 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2253,6 +2253,8 @@ static virDriver umlDriver = {
     NULL, /* domainSnapshotDelete */
     NULL, /* qemuDomainMonitorCommand */
     umlDomainOpenConsole, /* domainOpenConsole */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 static int
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 0fbfba5..03286fc 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -8647,6 +8647,8 @@ virDriver NAME(Driver) = {
     vboxDomainSnapshotDelete, /* domainSnapshotDelete */
     NULL, /* qemuDomainMonitorCommand */
     NULL, /* domainOpenConsole */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 virNetworkDriver NAME(NetworkDriver) = {
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index b5e416b..49d86e8 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -1007,6 +1007,8 @@ static virDriver vmwareDriver = {
     NULL,                       /* domainSnapshotDelete */
     NULL,                       /* qemuDomainMonitorCommand */
     NULL,                       /* domainOpenConsole */
+    NULL,                       /* domainStreamDisk */
+    NULL,                       /* domainStreamDiskInfo */
 };
 
 int
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 9f47722..516919e 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2141,6 +2141,8 @@ static virDriver xenUnifiedDriver = {
     NULL, /* domainSnapshotDelete */
     NULL, /* qemuDomainMonitorCommand */
     xenUnifiedDomainOpenConsole, /* domainOpenConsole */
+    NULL, /* domainStreamDisk */
+    NULL, /* domainStreamDiskInfo */
 };
 
 /**
-- 
1.7.3


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