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

Re: [libvirt] [libvirt-glib 4/4] config: Add a few GVirConfigDomainGraphicsSpice getters



On 12.09.2012 15:55, Christophe Fergeau wrote:
> ---
>  libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 16 ++++++++++++++++
>  libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h |  2 ++
>  libvirt-gconfig/libvirt-gconfig.sym                     |  2 ++
>  libvirt-gconfig/tests/test-domain-create.c              |  2 ++
>  4 files changed, 22 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> index 3aef0aa..8426f4a 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> @@ -94,6 +94,14 @@ void gvir_config_domain_graphics_spice_set_password(GVirConfigDomainGraphicsSpic
>                                       NULL);
>  }
>  
> +const char *gvir_config_domain_graphics_spice_get_listen(GVirConfigDomainGraphicsSpice *graphics)
> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics), NULL);
> +
> +    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(graphics),
> +                                            NULL, "listen");
> +}
> +
>  void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice *graphics,
>                                                    const char *listen_ip)
>  {
> @@ -104,6 +112,14 @@ void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice
>                                       NULL);
>  }
>  
> +int gvir_config_domain_graphics_spice_get_port(GVirConfigDomainGraphicsSpice *graphics)
> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics), 0);
> +
> +    return gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics),
> +                                                   NULL, "port", 0);
> +}
> +
>  void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice *graphics,
>                                                  int port)
>  {
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> index bcaf04e..2fec9d8 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> @@ -68,9 +68,11 @@ void gvir_config_domain_graphics_spice_set_autoport(GVirConfigDomainGraphicsSpic
>  void gvir_config_domain_graphics_spice_set_password(GVirConfigDomainGraphicsSpice *graphics,
>                                                      const char *password);
>  
> +const char *gvir_config_domain_graphics_spice_get_listen(GVirConfigDomainGraphicsSpice *graphics);
>  void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice *graphics,
>                                                    const char *listen_ip);
>  
> +int gvir_config_domain_graphics_spice_get_port(GVirConfigDomainGraphicsSpice *graphics);
>  void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice *graphics,
>                                                  int port);
>  
> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
> index b66b28e..5b2ebf4 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -465,7 +465,9 @@ LIBVIRT_GCONFIG_0.1.3 {
>  	gvir_config_domain_get_current_memory;
>  	gvir_config_domain_set_current_memory;
>  
> +	gvir_config_domain_graphics_spice_get_listen;
>  	gvir_config_domain_graphics_spice_set_listen;
> +	gvir_config_domain_graphics_spice_get_port;
>  
>  	gvir_config_domain_graphics_vnc_get_listen;
>  	gvir_config_domain_graphics_vnc_set_listen;
> diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
> index 903281d..5b64459 100644
> --- a/libvirt-gconfig/tests/test-domain-create.c
> +++ b/libvirt-gconfig/tests/test-domain-create.c
> @@ -287,7 +287,9 @@ int main(int argc, char **argv)
>  
>      graphics = gvir_config_domain_graphics_spice_new();
>      gvir_config_domain_graphics_spice_set_port(graphics, 1234);
> +    g_assert(gvir_config_domain_graphics_spice_get_port(graphics) == 1234);
>      gvir_config_domain_graphics_spice_set_listen(graphics, "127.0.0.1");
> +    g_str_const_check(gvir_config_domain_graphics_spice_get_listen(graphics), "127.0.0.1");
>      devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(graphics));
>  
>      /* video node */
> 

And again. ACK once we agreed on _listen() func name.

Overall, I'm giving ACK to whole patch set. I think it's worth renaming
_listen() funcs to _listen_ip() to denote IP address is set. On the
other hand, if we ever invent listening on network, we can stick to
_listen_network(). So if you prefer the sorter name I can live with that
and you can go ahead and push as is. If you don't mind doing a little of
substitution, then do and push afterwards. Or third option is to get
another opinion if somebody wants to chime in ...

Michal


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