[Libosinfo] [PATCH v2 2/2] gconfig: API for SPICE image compression

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Thu Mar 14 13:52:41 UTC 2013


Errr. sent to wrong list. Sorry! Ignore this series of 2 patches.

On Thu, Mar 14, 2013 at 3:51 PM, Zeeshan Ali (Khattak)
<zeeshanak at gnome.org> wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>
> This patch adds API to set/get image compression configuration on
> domain/graphics[@type='spice'] nodes.
>
> Also included are simple tests for this API.
> ---
>  .../libvirt-gconfig-domain-graphics-spice.c        | 38 +++++++++++++++++++++-
>  .../libvirt-gconfig-domain-graphics-spice.h        | 19 ++++++++++-
>  libvirt-gconfig/libvirt-gconfig.sym                |  8 +++++
>  libvirt-gconfig/tests/test-domain-create.c         |  7 ++++
>  4 files changed, 70 insertions(+), 2 deletions(-)
>
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> index d090a3a..d17a394 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> @@ -17,7 +17,8 @@
>   * License along with this library; if not, write to the Free Software
>   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
>   *
> - * Author: Christophe Fergeau <cfergeau at gmail.com>
> + * Authors: Christophe Fergeau <cfergeau at gmail.com>
> + *          Zeeshan Ali (Khattak) <zeeshanak at gnome.org>
>   */
>
>  #include <config.h>
> @@ -122,3 +123,38 @@ void gvir_config_domain_graphics_spice_set_tls_port(GVirConfigDomainGraphicsSpic
>                                                 "tlsPort", G_TYPE_INT, port,
>                                                 NULL);
>  }
> +
> +/**
> + * gvir_config_domain_graphics_spice_get_image_compression:
> + * @graphics: a #GVirConfigDomainGraphicsSpice
> + *
> + * Returns: (type GVirConfigDomainGraphicsSpiceImageCompression): image
> + * compression configuration of @graphics
> + */
> +int
> +gvir_config_domain_graphics_spice_get_image_compression(GVirConfigDomainGraphicsSpice *graphics)
> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics),
> +                         GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_OFF);
> +
> +    return gvir_config_object_get_attribute_genum
> +        (GVIR_CONFIG_OBJECT(graphics),
> +         "image",
> +         "compression",
> +         GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION,
> +         GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_GLZ);
> +}
> +
> +void gvir_config_domain_graphics_spice_set_image_compression
> +    (GVirConfigDomainGraphicsSpice *graphics,
> +     GVirConfigDomainGraphicsSpiceImageCompression compression)
> +{
> +    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics));
> +
> +    gvir_config_object_replace_child_with_attribute_enum
> +       (GVIR_CONFIG_OBJECT(graphics),
> +        "image",
> +        "compression",
> +        GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION,
> +        compression);
> +}
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> index c82615b..7e70cd4 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> @@ -17,7 +17,8 @@
>   * License along with this library; if not, write to the Free Software
>   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
>   *
> - * Author: Christophe Fergeau <cfergeau at gmail.com>
> + * Authors: Christophe Fergeau <cfergeau at gmail.com>
> + *          Zeeshan Ali (Khattak) <zeeshanak at gnome.org>
>   */
>
>  #if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
> @@ -56,6 +57,15 @@ struct _GVirConfigDomainGraphicsSpiceClass
>      gpointer padding[20];
>  };
>
> +typedef enum {
> +    GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_GLZ, /*< nick=auto_glz >*/
> +    GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_LZ, /*< nick=auto_lz >*/
> +    GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_QUIC,
> +    GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_GLZ,
> +    GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_LZ,
> +    GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_OFF
> +} GVirConfigDomainGraphicsSpiceImageCompression;
> +
>  GType gvir_config_domain_graphics_spice_get_type(void);
>
>  GVirConfigDomainGraphicsSpice *gvir_config_domain_graphics_spice_new(void);
> @@ -75,6 +85,13 @@ void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice *g
>  void gvir_config_domain_graphics_spice_set_tls_port(GVirConfigDomainGraphicsSpice *graphics,
>                                                      int port);
>
> +void gvir_config_domain_graphics_spice_set_image_compression
> +                        (GVirConfigDomainGraphicsSpice *graphics,
> +                         GVirConfigDomainGraphicsSpiceImageCompression compression);
> +int
> +gvir_config_domain_graphics_spice_get_image_compression
> +                        (GVirConfigDomainGraphicsSpice *graphics);
> +
>  G_END_DECLS
>
>  #endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SPICE_H__ */
> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
> index d9cff90..a1b2cc1 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -504,4 +504,12 @@ LIBVIRT_GCONFIG_0.1.5 {
>         gvir_config_domain_smartcard_passthrough_set_source;
>  } LIBVIRT_GCONFIG_0.1.4;
>
> +LIBVIRT_GCONFIG_0.1.6 {
> +  global:
> +       gvir_config_domain_graphics_spice_get_image_compression;
> +       gvir_config_domain_graphics_spice_set_image_compression;
> +
> +       gvir_config_domain_graphics_spice_image_compression_get_type;
> +} LIBVIRT_GCONFIG_0.1.5;
> +
>  # .... define new API here using predicted next version number ....
> diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
> index 4c94b2a..20fedc5 100644
> --- a/libvirt-gconfig/tests/test-domain-create.c
> +++ b/libvirt-gconfig/tests/test-domain-create.c
> @@ -288,6 +288,13 @@ 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);
> +
> +    /* SPICE image compression configuration */
> +    gvir_config_domain_graphics_spice_set_image_compression
> +        (graphics, GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_LZ);
> +    g_assert(gvir_config_domain_graphics_spice_get_image_compression(graphics) ==
> +             GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_LZ);
> +
>      devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(graphics));
>
>      /* video node */
> --
> 1.8.1.4
>



-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124




More information about the Libosinfo mailing list