* src/libvirt.c: implement the main entry points
* src/libvirt_public.syms: add them to the exported symbols
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
src/libvirt.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 6 ++
2 files changed, 127 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index aebd3bc..4244d23 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5897,6 +5897,127 @@ error:
}
/**
+ * virDomainStreamDisk:
+ * @dom: pointer to the domain object
+ * @path: path to the block device
+ * @offset: when streaming a single disk unit, the offset of the unit to stream
+ * @flags: flags to control disk streaming behavior
+ *
+ * Returns: Next offset or 0 on success, -1 on failure.
+ */
+unsigned long long
+virDomainStreamDisk(virDomainPtr dom,
+ const char *path,
+ unsigned long long offset,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ unsigned long long ret = -1;
+
+ DEBUG("domain=%p, path=%p, offset=%llu, flags=%u",
+ dom, path, offset, flags);
+
+ if (path == NULL) {
+ virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+ _("path must not be NULL"));
+ goto error;
+ }
+
+ if (flags == VIR_STREAM_DISK_START || flags == VIR_STREAM_DISK_STOP) {
+ if (offset != 0) {
+ virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+ _("offset must be 0 for continuous
streaming"));
+ goto error;
+ }
+ } else if (flags != VIR_STREAM_DISK_ONE) {
+ virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+ _("Invalid value for flags"));
+ goto error;
+ }
+
+ virResetLastError();
+ if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
+ virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ return -1;
+ }
+
+ conn = dom->conn;
+ if (conn->driver->domainStreamDisk) {
+ ret = conn->driver->domainStreamDisk (dom, path, offset, flags);
+ if (ret == -1)
+ goto error;
+ return ret;
+ }
+
+ virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(dom->conn);
+ return -1;
+}
+
+/**
+ * virDomainStreamDiskInfo:
+ * @dom: pointer to the domain object
+ * @states: An array of virStreamDiskState structures to store stream info
+ * @nr_states: The maximimum number of stream states to report
+ * @flags: future flags, use 0 for now
+ *
+ * Returns: The number of streams reported or -1 on failure.
+ */
+int
+virDomainStreamDiskInfo(virDomainPtr dom,
+ virStreamDiskStatePtr states,
+ unsigned int nr_states,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ int ret = -1;
+
+ DEBUG("dom=%p, states=%p, nr_states=%u, flags=%u",
+ dom, states, nr_states, flags);
+
+ if (states == NULL) {
+ virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+ _("states must not be NULL"));
+ goto error;
+ }
+
+ if (nr_states == 0) {
+ virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+ _("nr_states must be positive"));
+ goto error;
+ }
+
+ if (flags != 0) {
+ virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+ _("flags must be 0"));
+ goto error;
+ }
+
+ virResetLastError();
+ if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
+ virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ return -1;
+ }
+
+ conn = dom->conn;
+ if (conn->driver->domainStreamDiskInfo) {
+ ret = conn->driver->domainStreamDiskInfo (dom, states, nr_states,
+ flags);
+ if (ret == -1)
+ goto error;
+ return ret;
+ }
+
+ virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(dom->conn);
+ return -1;
+}
+
+/**
* virNodeGetCellsFreeMemory:
* @conn: pointer to the hypervisor connection
* @freeMems: pointer to the array of unsigned long long
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index a8091b1..a25596c 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -413,4 +413,10 @@ LIBVIRT_0.8.5 {
virDomainSetVcpusFlags;
} LIBVIRT_0.8.2;
+LIBVIRT_0.8.6 {
+ global:
+ virDomainStreamDisk;
+ virDomainStreamDiskInfo;
+} LIBVIRT_0.8.5;
+
# .... define new API here using predicted next version number ....
--
1.7.3.2.164.g6f10c