[libvirt] [PATCH 6/7] storage:dir: adapts .refreshVol .refreshPool for ploop volumes

Ján Tomko jtomko at redhat.com
Fri Apr 15 14:17:47 UTC 2016


On Mon, Apr 11, 2016 at 07:16:24PM +0300, Olga Krishtal wrote:
> Refreshes meta-information such as allocation, capacity, format, etc.
> Ploop volumes differ from other volume types. Path to volume is the path
> to directory with image file root.hds and DiskDescriptor.xml.
> https://openvz.org/Ploop/format
> Due to this fact, operations of opening the volume have to be done once
> again. get the information.
> 
> To decide whether the given volume is ploops one, it is necessary to check
> the presence of root.hds and DiskDescriptor.xml files in volumes' directory.
> Only in this case the volume can be manipulated as the ploops one.
> Such strategy helps us to resolve problems that might occure, when we
> upload some other volume type from ploop source.
> 
> Signed-off-by: Olga Krishtal <okrishtal at virtuozzo.com>
> ---
>  src/storage/storage_backend.c    | 62 ++++++++++++++++++++++++++++++++++++++--
>  src/storage/storage_backend.h    |  5 ++++
>  src/storage/storage_backend_fs.c | 20 ++++++++++---
>  src/util/virstoragefile.c        |  7 +++--
>  4 files changed, 85 insertions(+), 9 deletions(-)
> 

> @@ -84,14 +85,22 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
>          goto cleanup;
>  
>      if (S_ISDIR(sb.st_mode)) {
> -        target->format = VIR_STORAGE_FILE_DIR;
> -        ret = 0;
> -        goto cleanup;
> +        if (virStorageBackendIsPloopDir(target->path)) {
> +            if (virStorageBackendRedoPloopUpdate(target, &sb, &fd,
> +                                                 VIR_STORAGE_VOL_FS_PROBE_FLAGS)
> +                < 0)
> +                goto cleanup;
> +            format = VIR_STORAGE_FILE_PLOOP;
> +        } else {
> +            target->format = VIR_STORAGE_FILE_DIR;
> +            ret = 0;
> +            goto cleanup;
> +        }
>      }
>  

>      if (!(meta = virStorageFileGetMetadataFromFD(target->path,
>                                                   fd,
> -                                                 VIR_STORAGE_FILE_AUTO,
> +                                                 format,

This change does not seem necessary.

RedoPloopUpdate should point the fd at the root.hds file which should
have the right "WithouFreSpacExt" magic and fill out the format.

ACK with VIR_STORAGE_FILE_AUTO left in.

Jan




More information about the libvir-list mailing list