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

Re: [libvirt] Add virStorageVolResize()



On 01/27/2012 04:40 PM, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>
> 
> Add a new function to allow changing of capacity of storage volumes.
> ---
>  include/libvirt/libvirt.h.in     |    5 ++
>  src/driver.h                     |    5 ++
>  src/libvirt.c                    |   50 +++++++++++++++++++++++
>  src/libvirt_public.syms          |    1 +
>  src/remote/remote_driver.c       |    1 +
>  src/remote/remote_protocol.x     |    9 ++++-
>  src/remote_protocol-structs      |    6 +++
>  src/storage/storage_backend.h    |    6 +++
>  src/storage/storage_backend_fs.c |   59 ++++++++++++++++++++++++++++
>  src/storage/storage_driver.c     |   80 ++++++++++++++++++++++++++++++++++++++
>  src/util/storage_file.c          |   16 ++++++++
>  src/util/storage_file.h          |    2 +
>  tools/virsh.c                    |   53 +++++++++++++++++++++++++
>  13 files changed, 292 insertions(+), 1 deletions(-)

Part 2 of my review - the RPC implementation.

> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index f79f53e..2bb4cbf 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -4837,6 +4837,7 @@ static virStorageDriver storage_driver = {
>      .volGetInfo = remoteStorageVolGetInfo, /* 0.4.1 */
>      .volGetXMLDesc = remoteStorageVolGetXMLDesc, /* 0.4.1 */
>      .volGetPath = remoteStorageVolGetPath, /* 0.4.1 */
> +    .volResize = remoteStorageVolResize, /* 0.9.10 */
>      .poolIsActive = remoteStoragePoolIsActive, /* 0.7.3 */
>      .poolIsPersistent = remoteStoragePoolIsPersistent, /* 0.7.3 */
>  };
> diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
> index 0f354bb..29f98fc 100644
> --- a/src/remote/remote_protocol.x
> +++ b/src/remote/remote_protocol.x
> @@ -1676,6 +1676,12 @@ struct remote_storage_vol_get_path_ret {
>      remote_nonnull_string name;
>  };
>  
> +struct remote_storage_vol_resize_args {
> +    remote_nonnull_storage_vol vol;
> +    unsigned hyper capacity;

Based on my proposed API changes, this must be signed.

> +    unsigned int flags;
> +};
> +
>  /* Node driver calls: */
>  
>  struct remote_node_num_of_devices_args {
> @@ -2667,7 +2673,8 @@ enum remote_procedure {
>      REMOTE_PROC_DOMAIN_SET_INTERFACE_PARAMETERS = 256, /* autogen autogen */
>      REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS = 257, /* skipgen skipgen */
>      REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS = 258, /* autogen autogen */
> -    REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN = 259 /* autogen autogen */
> +    REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN = 259, /* autogen autogen */
> +    REMOTE_PROC_STORAGE_VOL_RESIZE = 300 /* autogen autogen */

Skipping is not allowed :)  260 is just fine.

>  
>      /*
>       * Notice how the entries are grouped in sets of 10 ?
> diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
> index de85862..9a60fc2 100644
> --- a/src/remote_protocol-structs
> +++ b/src/remote_protocol-structs
> @@ -1260,6 +1260,11 @@ struct remote_storage_vol_get_path_args {
>  struct remote_storage_vol_get_path_ret {
>          remote_nonnull_string      name;
>  };
> +struct remote_storage_vol_resize_args {
> +        remote_nonnull_storage_vol vol;
> +        uint64_t                   capacity;
> +        u_int                      flags;

And regenerating this picks up a tweak.

> +};
>  struct remote_node_num_of_devices_args {
>          remote_string              cap;
>          u_int                      flags;
> @@ -2101,4 +2106,5 @@ enum remote_procedure {
>          REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS = 257,
>          REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS = 258,
>          REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN = 259,
> +        REMOTE_PROC_STORAGE_VOL_RESIZE = 300,
>  };

The RPC stuff is pretty easy when it gets autogenerated :)

diff --git i/src/remote/remote_protocol.x w/src/remote/remote_protocol.x
index 29f98fc..7d104b2 100644
--- i/src/remote/remote_protocol.x
+++ w/src/remote/remote_protocol.x
@@ -1678,7 +1678,7 @@ struct remote_storage_vol_get_path_ret {

 struct remote_storage_vol_resize_args {
     remote_nonnull_storage_vol vol;
-    unsigned hyper capacity;
+    hyper capacity;
     unsigned int flags;
 };

@@ -2674,7 +2674,7 @@ enum remote_procedure {
     REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS = 257, /* skipgen
skipgen */
     REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS = 258, /* autogen autogen */
     REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN = 259, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_RESIZE = 300 /* autogen autogen */
+    REMOTE_PROC_STORAGE_VOL_RESIZE = 260 /* autogen autogen */

     /*
      * Notice how the entries are grouped in sets of 10 ?
diff --git i/src/remote_protocol-structs w/src/remote_protocol-structs
index de85862..70a69f6 100644
--- i/src/remote_protocol-structs
+++ w/src/remote_protocol-structs
@@ -1260,6 +1260,11 @@ struct remote_storage_vol_get_path_args {
 struct remote_storage_vol_get_path_ret {
         remote_nonnull_string      name;
 };
+struct remote_storage_vol_resize_args {
+        remote_nonnull_storage_vol vol;
+        int64_t                    capacity;
+        u_int                      flags;
+};
 struct remote_node_num_of_devices_args {
         remote_string              cap;
         u_int                      flags;
@@ -2101,4 +2106,5 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS = 257,
         REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS = 258,
         REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN = 259,
+        REMOTE_PROC_STORAGE_VOL_RESIZE = 260,
 };


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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