On Wed, Feb 17, 2016 at 02:40:02PM +0300, Olga Krishtal wrote:
In case of ploop volume, target path of the volume is the path to
the
directory that contains image file named root.hds and DiskDescriptor.xml.
While using uploadVol and downloadVol callbacks we need to open root.hds
itself. To accomplish this goal we must change path from
path/to/ploop directory to path/to/ploop/root.hds
In case of .uploadVol, we have to additionaly update DiskDescriptor.xml
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
---
src/storage/storage_backend.c | 66 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 64 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 9f0e020..ac44fdf 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -2023,12 +2023,63 @@ virStorageBackendVolUploadLocal(virConnectPtr conn
ATTRIBUTE_UNUSED,
unsigned long long len,
unsigned int flags)
{
+ char *path = NULL;
+ char *target_path = vol->target.path;
+ int ret;
+ virCommandPtr cmd = NULL;
+ char *create_tool = NULL;
+
virCheckFlags(0, -1);
/* Not using O_CREAT because the file is required to already exist at
* this point */
- return virFDStreamOpenBlockDevice(stream, vol->target.path,
+ if (vol->target.format != VIR_STORAGE_FILE_PLOOP) {
+ return virFDStreamOpenBlockDevice(stream, target_path,
offset, len, O_WRONLY);
+ } else {
Looking at the last patch, it seems a volume could be detected as
VIR_STORAGE_FILE_PLOOP if it's a disk image matching the magic,
but this code assumes it's a directory with "root.hds" image and the
XML.
+ if (virAsprintf(&path, "%s/root.hds",
vol->target.path) < 0)
+ return -1;
I thought the target.path was already pointing to the image, not
directory.
Jan