Re: [PATCH v2 4/9] Wire protocol format and dispatcher for virDomainGetState

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

 



On Tue, May 10, 2011 at 03:39:06PM +0200, Jiri Denemark wrote:
> ---
> Notes:
>     Version 2:
>     - rebased
>     - unsigned int flags
> 
>  daemon/remote.c              |   33 +++++++++++++++++++++++++++++++++
>  daemon/remote_generator.pl   |    3 ++-
>  src/remote/remote_protocol.x |   13 ++++++++++++-
>  src/remote_protocol-structs  |    8 ++++++++
>  4 files changed, 55 insertions(+), 2 deletions(-)
> 
> diff --git a/daemon/remote.c b/daemon/remote.c
> index 2220655..598862a 100644
> --- a/daemon/remote.c
> +++ b/daemon/remote.c
> @@ -2816,6 +2816,39 @@ cleanup:
>  }
>  
>  static int
> +remoteDispatchDomainGetState(struct qemud_server *server ATTRIBUTE_UNUSED,
> +                             struct qemud_client *client ATTRIBUTE_UNUSED,
> +                             virConnectPtr conn,
> +                             remote_message_header *hdr ATTRIBUTE_UNUSED,
> +                             remote_error *rerr,
> +                             remote_domain_get_state_args *args,
> +                             remote_domain_get_state_ret *ret)
> +{
> +    virDomainPtr dom = NULL;
> +    int rv = -1;
> +
> +    if (!conn) {
> +        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
> +        goto cleanup;
> +    }
> +
> +    if (!(dom = get_nonnull_domain(conn, args->dom)))
> +        goto cleanup;
> +
> +    if (virDomainGetState(dom, &ret->state, &ret->reason, args->flags) < 0)
> +        goto cleanup;
> +
> +    rv = 0;
> +
> +cleanup:
> +    if (rv < 0)
> +        remoteDispatchError(rerr);
> +    if (dom)
> +        virDomainFree(dom);
> +    return rv;
> +}
> +
> +static int
>  remoteDispatchDomainEventsRegisterAny(struct qemud_server *server ATTRIBUTE_UNUSED,
>                                        struct qemud_client *client ATTRIBUTE_UNUSED,
>                                        virConnectPtr conn,
> diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
> index 062ccc1..ff279d5 100755
> --- a/daemon/remote_generator.pl
> +++ b/daemon/remote_generator.pl
> @@ -278,7 +278,8 @@ elsif ($opt_b) {
>                            "GetType",
>                            "NodeDeviceGetParent",
>                            "NodeGetSecurityModel",
> -                          "SecretGetValue");
> +                          "SecretGetValue",
> +                          "DomainGetState");
>      } elsif ($structprefix eq "qemu") {
>          @ungeneratable = ("MonitorCommand");
>      }

Needs rebasing

> diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
> index c706c36..078d7ed 100644
> --- a/src/remote/remote_protocol.x
> +++ b/src/remote/remote_protocol.x
> @@ -1940,6 +1940,16 @@ struct remote_storage_vol_download_args {
>      unsigned int flags;
>  };
>  
> +struct remote_domain_get_state_args {
> +    remote_nonnull_domain dom;
> +    unsigned int flags;
> +};
> +
> +struct remote_domain_get_state_ret {
> +    int state;
> +    int reason;
> +};
> +
>  
>  /*----- Protocol. -----*/
>  
> @@ -2176,7 +2186,8 @@ enum remote_procedure {
>      REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206,
>      REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
>      REMOTE_PROC_STORAGE_VOL_UPLOAD = 208,
> -    REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209
> +    REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209,
> +    REMOTE_PROC_DOMAIN_GET_STATE = 210

Need to add annotations here.

>  
>      /*
>       * Notice how the entries are grouped in sets of 10 ?
> diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
> index f904c4d..ca1294f 100644
> --- a/src/remote_protocol-structs
> +++ b/src/remote_protocol-structs
> @@ -1427,6 +1427,14 @@ struct remote_storage_vol_download_args {
>          uint64_t                   length;
>          u_int                      flags;
>  };
> +struct remote_domain_get_state_args {
> +        remote_nonnull_domain      dom;
> +        u_int                      flags;
> +};
> +struct remote_domain_get_state_ret {
> +        int                        state;
> +        int                        reason;
> +};
>  struct remote_message_header {
>          u_int                      prog;
>          u_int                      vers;


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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]