* include/libvirt/libvirt.h.in: Add virConnectPutFile and
virConnectGetFile APis to demo streams
* src/driver.h, src/libvirt.c, src/libvirt_public.syms: Stub
code for get/putfile APIs
* src/esx/esx_driver.c, src/lxc_driver.c, src/opennebula/one_driver.c,
src/openvz_driver.c, src/qemu_driver.c, src/remote_internal.c,
src/test.c, src/uml_driver.c, src/vbox/vbox_tmpl.c,
src/xen_unified.c: Add dummy entries in driver table for new
APIs
---
include/libvirt/libvirt.h | 8 ++++
include/libvirt/libvirt.h.in | 8 ++++
src/driver.h | 6 +++
src/esx/esx_driver.c | 2 +
src/libvirt.c | 86 ++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 3 +
src/lxc_driver.c | 2 +
src/opennebula/one_driver.c | 2 +
src/openvz_driver.c | 2 +
src/qemu_driver.c | 2 +
src/remote_internal.c | 2 +
src/test.c | 2 +
src/uml_driver.c | 2 +
src/vbox/vbox_tmpl.c | 3 +-
src/xen_unified.c | 2 +
15 files changed, 131 insertions(+), 1 deletions(-)
diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h
index 5dcecfd..a654a05 100644
--- a/include/libvirt/libvirt.h
+++ b/include/libvirt/libvirt.h
@@ -1540,6 +1540,14 @@ int virStreamAbort(virStreamPtr st);
int virStreamFree(virStreamPtr st);
+int virConnectPutFile(virConnectPtr conn,
+ const char *name,
+ virStreamPtr st);
+
+int virConnectGetFile(virConnectPtr conn,
+ const char *name,
+ virStreamPtr st);
+
#ifdef __cplusplus
}
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index db091dc..d6c52dc 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1540,6 +1540,14 @@ int virStreamAbort(virStreamPtr st);
int virStreamFree(virStreamPtr st);
+int virConnectPutFile(virConnectPtr conn,
+ const char *name,
+ virStreamPtr st);
+
+int virConnectGetFile(virConnectPtr conn,
+ const char *name,
+ virStreamPtr st);
+
#ifdef __cplusplus
}
diff --git a/src/driver.h b/src/driver.h
index 25d34b6..bc862a8 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -344,6 +344,10 @@ typedef int
(*virDrvNodeDeviceReset)
(virNodeDevicePtr dev);
+
+typedef int (*virDrvPutFile)(virConnectPtr conn, const char *name, virStreamPtr st);
+typedef int (*virDrvGetFile)(virConnectPtr conn, const char *name, virStreamPtr st);
+
/**
* _virDriver:
*
@@ -424,6 +428,8 @@ struct _virDriver {
virDrvNodeDeviceDettach nodeDeviceDettach;
virDrvNodeDeviceReAttach nodeDeviceReAttach;
virDrvNodeDeviceReset nodeDeviceReset;
+ virDrvPutFile putFile;
+ virDrvGetFile getFile;
};
typedef int
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 0225e9a..d094ac1 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -2941,6 +2941,8 @@ static virDriver esxDriver = {
NULL, /* nodeDeviceDettach */
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
+ NULL,
+ NULL
};
diff --git a/src/libvirt.c b/src/libvirt.c
index d6536f4..f460876 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -9309,3 +9309,89 @@ int virStreamFree(virStreamPtr stream)
return (-1);
return (0);
}
+
+
+int virConnectPutFile(virConnectPtr conn,
+ const char *name,
+ virStreamPtr st)
+{
+ VIR_DEBUG("conn=%p, name=%s, stream=%p", conn, NULLSTR(name), st);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return -1;
+ }
+
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+
+ if (name == NULL) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+ if (conn != st->conn) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ if (conn->driver->putFile) {
+ int rv = conn->driver->putFile(conn, name, st);
+ if (rv < 0)
+ goto error;
+ return rv;
+ }
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(conn);
+ return -1;
+}
+
+
+int virConnectGetFile(virConnectPtr conn,
+ const char *name,
+ virStreamPtr st)
+{
+ VIR_DEBUG("conn=%p, name=%s, stream=%p", conn, NULLSTR(name), st);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return -1;
+ }
+
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+
+ if (name == NULL) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+ if (conn != st->conn) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ if (conn->driver->getFile) {
+ int rv = conn->driver->getFile(conn, name, st);
+ if (rv < 0)
+ goto error;
+ return rv;
+ }
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(conn);
+ return -1;
+}
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index f48b8c5..d06c0a4 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -304,6 +304,9 @@ LIBVIRT_0.7.1 {
virStreamFinish;
virStreamAbort;
virStreamFree;
+ virConnectPutFile;
+ virConnectGetFile;
} LIBVIRT_0.7.0;
+
# .... define new API here using predicted next version number ....
diff --git a/src/lxc_driver.c b/src/lxc_driver.c
index bd0cf0e..b9bf1e4 100644
--- a/src/lxc_driver.c
+++ b/src/lxc_driver.c
@@ -1931,6 +1931,8 @@ static virDriver lxcDriver = {
NULL, /* nodeDeviceDettach */
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
+ NULL,
+ NULL,
};
static virStateDriver lxcStateDriver = {
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
index 135397c..184720b 100644
--- a/src/opennebula/one_driver.c
+++ b/src/opennebula/one_driver.c
@@ -779,6 +779,8 @@ static virDriver oneDriver = {
NULL, /* nodeDeviceDettach; */
NULL, /* nodeDeviceReAttach; */
NULL, /* nodeDeviceReset; */
+ NULL,
+ NULL
};
static virStateDriver oneStateDriver = {
diff --git a/src/openvz_driver.c b/src/openvz_driver.c
index 6b7c49d..fdc3a6e 100644
--- a/src/openvz_driver.c
+++ b/src/openvz_driver.c
@@ -1392,6 +1392,8 @@ static virDriver openvzDriver = {
NULL, /* nodeDeviceDettach */
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
+ NULL,
+ NULL,
};
int openvzRegister(void) {
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index eb22940..81485b5 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -7261,6 +7261,8 @@ static virDriver qemuDriver = {
qemudNodeDeviceDettach, /* nodeDeviceDettach */
qemudNodeDeviceReAttach, /* nodeDeviceReAttach */
qemudNodeDeviceReset, /* nodeDeviceReset */
+ NULL,
+ NULL,
};
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 12e3bb9..c8ea1a3 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -8047,6 +8047,8 @@ static virDriver remote_driver = {
remoteNodeDeviceDettach, /* nodeDeviceDettach */
remoteNodeDeviceReAttach, /* nodeDeviceReAttach */
remoteNodeDeviceReset, /* nodeDeviceReset */
+ NULL,
+ NULL,
};
static virNetworkDriver network_driver = {
diff --git a/src/test.c b/src/test.c
index 305f2c9..cda7be7 100644
--- a/src/test.c
+++ b/src/test.c
@@ -4242,6 +4242,8 @@ static virDriver testDriver = {
NULL, /* nodeDeviceDettach */
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
+ NULL,
+ NULL,
};
static virNetworkDriver testNetworkDriver = {
diff --git a/src/uml_driver.c b/src/uml_driver.c
index dc1e8ef..53e7e10 100644
--- a/src/uml_driver.c
+++ b/src/uml_driver.c
@@ -1853,6 +1853,8 @@ static virDriver umlDriver = {
NULL, /* nodeDeviceDettach */
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
+ NULL,
+ NULL,
};
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index d3158ef..5a3079e 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -5621,7 +5621,8 @@ virDriver NAME(Driver) = {
NULL, /* nodeDeviceDettach */
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
-
+ NULL,
+ NULL,
};
virNetworkDriver NAME(NetworkDriver) = {
diff --git a/src/xen_unified.c b/src/xen_unified.c
index dfa9ca5..ac52ce9 100644
--- a/src/xen_unified.c
+++ b/src/xen_unified.c
@@ -1722,6 +1722,8 @@ static virDriver xenUnifiedDriver = {
xenUnifiedNodeDeviceDettach, /* nodeDeviceDettach */
xenUnifiedNodeDeviceReAttach, /* nodeDeviceReAttach */
xenUnifiedNodeDeviceReset, /* nodeDeviceReset */
+ NULL,
+ NULL,
};
/**
--
1.6.2.5