[libvirt] [PATCH 1/2] resize: add virStorageVolResize() API

Daniel P. Berrange berrange at redhat.com
Mon Jan 30 11:08:39 UTC 2012


On Fri, Jan 27, 2012 at 05:28:15PM -0700, Eric Blake wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> Add a new function to allow changing of capacity of storage volumes.
> Plan out several flags, even if not all of them will be implemented
> up front.
> 
> Expose the new command via 'virsh vol-resize'.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  include/libvirt/libvirt.h.in |   11 ++++++
>  python/generator.py          |    1 +
>  src/driver.h                 |    5 +++
>  src/libvirt.c                |   76 ++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms      |    1 +
>  tools/virsh.c                |   82 ++++++++++++++++++++++++++++++++++++++++++
>  tools/virsh.pod              |   11 ++++++
>  7 files changed, 187 insertions(+), 0 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index e99cd00..d26cbbd 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -2386,6 +2386,17 @@ char *                  virStorageVolGetXMLDesc         (virStorageVolPtr pool,
> 
>  char *                  virStorageVolGetPath            (virStorageVolPtr vol);
> 
> +typedef enum {
> +  VIR_STORAGE_VOL_RESIZE_ALLOCATE = 1 << 0, /* force allocation of new size */
> +  VIR_STORAGE_VOL_RESIZE_DELTA    = 1 << 1, /* size is relative to current */
> +  VIR_STORAGE_VOL_RESIZE_SHRINK   = 1 << 2, /* allow decrease in capacity */
> +} virStorageVolResizeFlags;
> +
> +int                     virStorageVolResize             (virStorageVolPtr vol,
> +                                                         long long capacity,
> +                                                         unsigned int flags);


Why has this changed from 'unsigned long long' to just 'long long'.

In virStorageVolInfo we use 'unsigned long long', and you can't ever
have a negative capacity, so I don't see why this should be signed.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list