On Thu, Feb 18, 2016 at 06:17:09PM +0300, Olga Krishtal wrote: > On 18/02/16 16:57, Ján Tomko wrote: > > 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@xxxxxxxxxxxxx> > >> --- > >> 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 > The thing is that that volume target.path is path to folder with > root.hds and DiskDescriptor.xml. I don't like VOL_TYPE_FILE pointing to a directory. > And after resize we have to update DiskDescriptor.xml. This can be done > only after volume will be fully > upload, I mean after stream operations will be finished. Now I am > looking for the correct place to do it. If DiskDescriptor.xml contains the headers, then they should be updated by the same tool that changes the data. > I think about refreshPool. But not quite sure yet. The purpose of refreshPool is to update libvirtd's knowledge of the files by reading the on-disk metadata, not chaning the on-disk metadata. Jan -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list