From: Visarion Alexandru <viorel.visar...@gmail.com> Learn to set the address that spice is listening on.
We first remove the 'listen' attribute to avoid inconsistencies checks between the 'listen' attribute and the 'address' attribute of the 'listen' node. --- .../libvirt-gconfig-domain-graphics-spice.c | 28 ++++++++++++++++++++++ .../libvirt-gconfig-domain-graphics-spice.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 1 + 3 files changed, 32 insertions(+) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c index 079ea27..4219ff0 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c @@ -157,6 +157,34 @@ void gvir_config_domain_graphics_spice_set_image_compression compression); } +/** + * gvir_config_domain_graphics_spice_set_listen_address: + * @graphics: a #GVirConfigDomainGraphicsSpice + * @listens: (in) (element-type LibvirtGConfig.DomainGraphicsListen): + * + * This method is used to set the various listen nodes a #GVirConfigDomainGraphicsSpice + * device can handle. +*/ +void gvir_config_domain_graphics_spice_set_listen_address(GVirConfigDomainGraphicsSpice *graphics, + GList *listens) +{ + GList *it; + + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics)); + + gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics), + "listen"); + gvir_config_object_delete_children (GVIR_CONFIG_OBJECT (graphics), + "listen", NULL); + + for (it = listens; it != NULL; it = it->next) { + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN(it->data)); + + gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics), + GVIR_CONFIG_OBJECT(it->data)); + } +} + void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *graphics, gboolean gl) { diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h index 25c132e..03abe5b 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h @@ -95,6 +95,9 @@ gvir_config_domain_graphics_spice_get_image_compression void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *graphics, gboolean gl); +void gvir_config_domain_graphics_spice_set_listen_address(GVirConfigDomainGraphicsSpice *graphics, + GList *listens); + 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 117a648..73fd977 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -769,6 +769,7 @@ global: gvir_config_domain_graphics_listen_address_new; gvir_config_domain_graphics_listen_address_new_from_xml; gvir_config_domain_graphics_vnc_set_listen_address; + gvir_config_domain_graphics_spice_set_listen_address; } LIBVIRT_GCONFIG_0.2.2; # .... define new API here using predicted next version number .... -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list