[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Implement LVM volume resize via lvresize



On Wed, Aug 30, 2017 at 20:23:30 +0300, apolyakov beget ru wrote:
> From: Alexander Polyakov <apolyakov beget com>

Commit message is missing (and required). Please describe your change.

> 
> Signed-off-by: Alexander Polyakov <apolyakov beget com>
> ---
>  m4/virt-storage-lvm.m4                |  4 ++++
>  src/storage/storage_backend_logical.c | 22 ++++++++++++++++++++++
>  2 files changed, 26 insertions(+)

[...]

> diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
> index 67f70e551..810e4ee88 100644
> --- a/src/storage/storage_backend_logical.c
> +++ b/src/storage/storage_backend_logical.c
> @@ -1072,6 +1072,27 @@ virStorageBackendLogicalVolWipe(virConnectPtr conn,
>      return -1;
>  }
>  
> +static int
> +virStorageBackendLogicalResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
> +                                   virStoragePoolObjPtr pool,
> +                                   virStorageVolDefPtr vol,
> +                                   unsigned long long capacity,
> +                                   unsigned int flags)
> +{
> +
> +    virCheckFlags(0, -1);

This won't allow shrinking of the volume. Also VIR_STORAGE_VOL_RESIZE_DELTA
looks simple enough to implement.

> +
> +    (void)pool;

Use ATTRIBUTE_UNUSED for the parameter.

> +    virCommandPtr cmd = virCommandNewArgList(LVRESIZE, "-L", NULL);
> +    virCommandAddArgFormat(cmd, "%lluK", VIR_DIV_UP(capacity, 1024));

Why don't you pass this through in bytes?

> +    virCommandAddArgFormat(cmd, "%s", vol->target.path);
> +    int ret = virCommandRun(cmd, NULL);

rest looks fine.

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]