[libvirt] [PATCH 1/7] storage:dir: added ploop format in vol-create-as cmd

Maxim Nestratov mnestratov at virtuozzo.com
Mon Feb 8 14:59:01 UTC 2016


08.02.2016 16:04, Olga Krishtal пишет:
> In order to support ploop in storage pools we need separate
> volume type: VIR_STORAGE_VOL_PLOOP
>
> Signed-off-by: Olga Krishtal <okrishtal at virtuozzo.com>
> ---
>   include/libvirt/libvirt-storage.h | 2 +-
>   src/conf/storage_conf.c           | 2 +-
>   src/storage/storage_backend_fs.c  | 3 +++
>   tools/virsh-volume.c              | 3 ++-
>   4 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h
> index 1a868cc..b1e6ba5 100644
> --- a/include/libvirt/libvirt-storage.h
> +++ b/include/libvirt/libvirt-storage.h
> @@ -122,7 +122,7 @@ typedef enum {
>       VIR_STORAGE_VOL_NETWORK = 3,  /* Network volumes like RBD (RADOS Block Device) */
>       VIR_STORAGE_VOL_NETDIR = 4,   /* Network accessible directory that can
>                                      * contain other network volumes */
> -
> +    VIR_STORAGE_VOL_PLOOP = 5,     /* Ploop based volumes */
>   # ifdef VIR_ENUM_SENTINELS
>       VIR_STORAGE_VOL_LAST
>   # endif
> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
> index 3657dfd..01b52a4 100644
> --- a/src/conf/storage_conf.c
> +++ b/src/conf/storage_conf.c
> @@ -52,7 +52,7 @@ VIR_LOG_INIT("conf.storage_conf");
>   
>   VIR_ENUM_IMPL(virStorageVol,
>                 VIR_STORAGE_VOL_LAST,
> -              "file", "block", "dir", "network", "netdir")
> +              "file", "block", "dir", "network", "netdir", "ploop")
>   
>   VIR_ENUM_IMPL(virStoragePool,
>                 VIR_STORAGE_POOL_LAST,
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index 692c9ff..dd0d80e 100644
> --- a/src/storage/storage_backend_fs.c
> +++ b/src/storage/storage_backend_fs.c
> @@ -1085,6 +1085,8 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn ATTRIBUTE_UNUSED,
>   
>       if (vol->target.format == VIR_STORAGE_FILE_DIR)
>           vol->type = VIR_STORAGE_VOL_DIR;
> +    else if (vol->target.format == VIR_STORAGE_FILE_PLOOP)
> +        vol->type = VIR_STORAGE_VOL_PLOOP;
>       else
>           vol->type = VIR_STORAGE_VOL_FILE;
>   
> @@ -1243,6 +1245,7 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED,
>       switch ((virStorageVolType) vol->type) {
>       case VIR_STORAGE_VOL_FILE:
>       case VIR_STORAGE_VOL_DIR:
> +    case VIR_STORAGE_VOL_PLOOP:

since you delete this chunk in the third patch, I don't think it's 
necessary here
>           if (virFileRemove(vol->target.path, vol->target.perms->uid,
>                             vol->target.perms->gid) < 0) {
>               /* Silently ignore failures where the vol has already gone away */
> diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
> index 35f0cbd..1f4b6b6 100644
> --- a/tools/virsh-volume.c
> +++ b/tools/virsh-volume.c
> @@ -956,7 +956,8 @@ VIR_ENUM_IMPL(virshStorageVol,
>                 N_("block"),
>                 N_("dir"),
>                 N_("network"),
> -              N_("netdir"))
> +              N_("netdir"),
> +              N_("ploop"))
>   
>   static const char *
>   virshVolumeTypeToString(int type)




More information about the libvir-list mailing list