On 03/18/2011 10:36 AM, Daniel P. Berrange wrote:
* src/storage/storage_driver.c: Wire up upload/download APIs
---
src/storage/storage_driver.c | 133 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 131 insertions(+), 2 deletions(-)
+static int
+storageVolumeDownload(virStorageVolPtr obj,
+ virStreamPtr stream,
+ unsigned long long offset,
+ unsigned long long length,
+ unsigned int flags)
+{
+ if (vol->building) {
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ _("volume '%s' is still being
allocated."),
+ vol->name);
+ goto out;
+ }
+
+ if (virFDStreamOpenFile(stream,
+ vol->target.path,
+ offset, length,
+ O_RDONLY) < 0)
+ goto out;
Should we prohibit more than one stream attached to a volume at a time?
It could be rather confusing if simultaneous transfers are taking place
to the same volume, especially if the transfers overlap in offsets of
the volume being addressed.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org