[libvirt] [PATCH libvirt-glib 0/5] Add virgl config support

A few fixes followed by spice gl and virtio-gpu config patches. (libvirt "spice gl" support is pending merge after the release) thanks Marc-André Lureau (5): build-sys: fix gir introspection warnings tests: fix potential crash config: add spice gl child config: add virtio video model config: add accel3d setter examples/config-demo.py | 4 +++- libvirt-gconfig/Makefile.am | 1 + .../libvirt-gconfig-domain-graphics-spice.c | 9 +++++++++ .../libvirt-gconfig-domain-graphics-spice.h | 3 +++ libvirt-gconfig/libvirt-gconfig-domain-video.c | 18 ++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-video.h | 5 ++++- libvirt-gconfig/libvirt-gconfig.sym | 5 +++++ libvirt-glib/Makefile.am | 1 + libvirt-gobject/Makefile.am | 1 + libvirt-gobject/libvirt-gobject-connection.c | 2 +- libvirt-gobject/libvirt-gobject-domain.c | 2 +- libvirt-gobject/libvirt-gobject-network.c | 1 - libvirt-gobject/libvirt-gobject-stream.c | 3 +-- tests/test-events.c | 8 +++++++- 14 files changed, 55 insertions(+), 8 deletions(-) -- 2.5.0

Enable GIR warnings and fix them, since they are all useful. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- libvirt-gconfig/Makefile.am | 1 + libvirt-glib/Makefile.am | 1 + libvirt-gobject/Makefile.am | 1 + libvirt-gobject/libvirt-gobject-connection.c | 2 +- libvirt-gobject/libvirt-gobject-domain.c | 2 +- libvirt-gobject/libvirt-gobject-network.c | 1 - libvirt-gobject/libvirt-gobject-stream.c | 3 +-- 7 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 77b2032..f308539 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -263,6 +263,7 @@ LibvirtGConfig_1_0_gir_SCANNERFLAGS = \ --identifier-prefix=GVirConfig \ --symbol-prefix=gvir_config \ --c-include="libvirt-gconfig/libvirt-gconfig.h" \ + --warn-all \ $(NULL) INTROSPECTION_GIRS += LibvirtGConfig-1.0.gir diff --git a/libvirt-glib/Makefile.am b/libvirt-glib/Makefile.am index a48cfbb..12a390f 100644 --- a/libvirt-glib/Makefile.am +++ b/libvirt-glib/Makefile.am @@ -67,6 +67,7 @@ LibvirtGLib_1_0_gir_SCANNERFLAGS = \ --identifier-prefix=GVir \ --symbol-prefix=gvir \ --c-include="libvirt-glib/libvirt-glib.h" \ + --warn-all \ $(NULL) INTROSPECTION_GIRS += LibvirtGLib-1.0.gir diff --git a/libvirt-gobject/Makefile.am b/libvirt-gobject/Makefile.am index 8464f04..5e130ee 100644 --- a/libvirt-gobject/Makefile.am +++ b/libvirt-gobject/Makefile.am @@ -160,6 +160,7 @@ LibvirtGObject_1_0_gir_SCANNERFLAGS = \ --c-include="libvirt-gobject/libvirt-gobject.h" \ --include-uninstalled $(top_builddir)/libvirt-glib/LibvirtGLib-1.0.gir \ --include-uninstalled $(top_builddir)/libvirt-gconfig/LibvirtGConfig-1.0.gir \ + --warn-all \ $(NULL) INTROSPECTION_GIRS += LibvirtGObject-1.0.gir INTROSPECTION_COMPILER_ARGS = \ diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c index 61ae364..00d5eda 100644 --- a/libvirt-gobject/libvirt-gobject-connection.c +++ b/libvirt-gobject/libvirt-gobject-connection.c @@ -1681,7 +1681,7 @@ GVirInterface *gvir_connection_get_interface(GVirConnection *conn, /** * gvir_connection_find_interface_by_mac: * @conn: a #GVirConnection - * @mac: MAC address to lookup + * @macaddr: MAC address to lookup * * Get a particular interface which has MAC address @mac. * diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c index 7bb3b13..7be936d 100644 --- a/libvirt-gobject/libvirt-gobject-domain.c +++ b/libvirt-gobject/libvirt-gobject-domain.c @@ -1824,7 +1824,7 @@ gboolean gvir_domain_get_has_current_snapshot(GVirDomain *dom, * @dom: the domain * @date_time: (allow-none)(transfer none): the time to set as #GDateTime. * @flags: Unused, pass 0. - * @error: (allow-none): Place-holder for error or %NULL + * @err: (allow-none): Place-holder for error or %NULL * * This function tries to set guest time to the given value. The passed * time must in UTC. diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c index 0dd80a5..0129a73 100644 --- a/libvirt-gobject/libvirt-gobject-network.c +++ b/libvirt-gobject/libvirt-gobject-network.c @@ -229,7 +229,6 @@ GVirConfigNetwork *gvir_network_get_config(GVirNetwork *network, * @network: the network * @mac: (allow-none): The optional ASCII formatted MAC address of an interface * @flags: placeholder for flags, must be 0 - * * @err: Place-holder for possible errors * * This function fetches leases info of guests in the specified network. If the diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c index 03a0308..a518a19 100644 --- a/libvirt-gobject/libvirt-gobject-stream.c +++ b/libvirt-gobject/libvirt-gobject-stream.c @@ -679,7 +679,7 @@ guint gvir_stream_add_watch(GVirStream *stream, } /** - * gvir_stream_add_watch_full: + * gvir_stream_add_watch_full: (rename-to gvir_stream_add_watch) * @stream: the stream * @priority: the priority of the #GVirStream source * @cond: the conditions to watch for (bitfield of #GVirStreamIOCondition) @@ -690,7 +690,6 @@ guint gvir_stream_add_watch(GVirStream *stream, * Adds a watch for @stream to the mainloop * * Returns: the event source id - * Rename to: gvir_stream_add_watch */ guint gvir_stream_add_watch_full(GVirStream *stream, gint priority, -- 2.5.0

On Fri, Feb 26, 2016 at 12:37:08PM +0100, Marc-André Lureau wrote:
Enable GIR warnings and fix them, since they are all useful.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- libvirt-gconfig/Makefile.am | 1 + libvirt-glib/Makefile.am | 1 + libvirt-gobject/Makefile.am | 1 + libvirt-gobject/libvirt-gobject-connection.c | 2 +- libvirt-gobject/libvirt-gobject-domain.c | 2 +- libvirt-gobject/libvirt-gobject-network.c | 1 - libvirt-gobject/libvirt-gobject-stream.c | 3 +-- 7 files changed, 6 insertions(+), 5 deletions(-)
ACK Regards, 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 :|

The idle source is not always removed and may crash next tests Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- tests/test-events.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test-events.c b/tests/test-events.c index 8afb557..0c0e929 100644 --- a/tests/test-events.c +++ b/tests/test-events.c @@ -65,6 +65,12 @@ static void watch_cb(int watch, int fd, int events, void *opaque G_GNUC_UNUSED) g_message("got event(s) %x on fd %d (watch %d)", events, fd, watch); } +static gboolean idle_quit_cb(gpointer user_data G_GNUC_UNUSED) +{ + g_main_loop_quit(main_loop); + + return G_SOURCE_REMOVE; +} static gboolean test_watch(gpointer user_data G_GNUC_UNUSED) { @@ -81,7 +87,7 @@ static gboolean test_watch(gpointer user_data G_GNUC_UNUSED) g_assert_cmpint(removal_status, ==, -1); g_idle_add_full(G_PRIORITY_LOW, check_destroyed, &watch_id, NULL); g_idle_add_full(G_PRIORITY_LOW, - (GSourceFunc)g_main_loop_quit, + idle_quit_cb, main_loop, NULL); -- 2.5.0

On Fri, Feb 26, 2016 at 12:37:09PM +0100, Marc-André Lureau wrote:
The idle source is not always removed and may crash next tests
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- tests/test-events.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
ACK Regards, 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 :|

Learn to set "gl" on spice (to have -spice gl=on on qemu) Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- examples/config-demo.py | 1 + libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 9 +++++++++ libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/examples/config-demo.py b/examples/config-demo.py index c28d8b9..952640a 100644 --- a/examples/config-demo.py +++ b/examples/config-demo.py @@ -58,6 +58,7 @@ domain.add_device(input) graphics = LibvirtGConfig.DomainGraphicsSpice.new() graphics.set_port(1234) +graphics.set_gl(True) domain.add_device(graphics) video = LibvirtGConfig.DomainVideo.new() diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c index c8b45d6..079ea27 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c @@ -156,3 +156,12 @@ void gvir_config_domain_graphics_spice_set_image_compression GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION, compression); } + +void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *graphics, + gboolean gl) +{ + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics)); + + gvir_config_object_replace_child_with_attribute_enum + (GVIR_CONFIG_OBJECT(graphics), "gl", "enable", G_TYPE_BOOLEAN, gl); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h index 1410c22..25c132e 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h @@ -92,6 +92,9 @@ int gvir_config_domain_graphics_spice_get_image_compression (GVirConfigDomainGraphicsSpice *graphics); +void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *graphics, + gboolean gl); + 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 89dd589..b8c600e 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -733,4 +733,8 @@ global: gvir_config_domain_video_set_vgamem; } LIBVIRT_GCONFIG_0.2.1; +LIBVIRT_GCONFIG_0.2.4 { + gvir_config_domain_graphics_spice_set_gl; +} LIBVIRT_GCONFIG_0.2.2; + # .... define new API here using predicted next version number .... -- 2.5.0

On Fri, Feb 26, 2016 at 12:37:10PM +0100, Marc-André Lureau wrote:
Learn to set "gl" on spice (to have -spice gl=on on qemu)
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- examples/config-demo.py | 1 + libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 9 +++++++++ libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 4 ++++ 4 files changed, 17 insertions(+)
ACK Regards, 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 :|

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- examples/config-demo.py | 2 +- libvirt-gconfig/libvirt-gconfig-domain-video.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/config-demo.py b/examples/config-demo.py index 952640a..3fdc367 100644 --- a/examples/config-demo.py +++ b/examples/config-demo.py @@ -62,7 +62,7 @@ graphics.set_gl(True) domain.add_device(graphics) video = LibvirtGConfig.DomainVideo.new() -video.set_model(LibvirtGConfig.DomainVideoModel.QXL) +video.set_model(LibvirtGConfig.DomainVideoModel.VIRTIO) domain.add_device(video) console = LibvirtGConfig.DomainConsole.new() diff --git a/libvirt-gconfig/libvirt-gconfig-domain-video.h b/libvirt-gconfig/libvirt-gconfig-domain-video.h index a87ec4f..d162b8f 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-video.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-video.h @@ -62,7 +62,8 @@ typedef enum { GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VMVGA, GVIR_CONFIG_DOMAIN_VIDEO_MODEL_XEN, GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VBOX, - GVIR_CONFIG_DOMAIN_VIDEO_MODEL_QXL + GVIR_CONFIG_DOMAIN_VIDEO_MODEL_QXL, + GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VIRTIO } GVirConfigDomainVideoModel; GType gvir_config_domain_video_get_type(void); -- 2.5.0

On Fri, Feb 26, 2016 at 12:37:11PM +0100, Marc-André Lureau wrote:
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- examples/config-demo.py | 2 +- libvirt-gconfig/libvirt-gconfig-domain-video.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
ACK Regards, 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 :|

Learn to set the accel3d attribute on video model. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- examples/config-demo.py | 1 + libvirt-gconfig/libvirt-gconfig-domain-video.c | 18 ++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-video.h | 2 ++ libvirt-gconfig/libvirt-gconfig.sym | 1 + 4 files changed, 22 insertions(+) diff --git a/examples/config-demo.py b/examples/config-demo.py index 3fdc367..e92aa43 100644 --- a/examples/config-demo.py +++ b/examples/config-demo.py @@ -63,6 +63,7 @@ domain.add_device(graphics) video = LibvirtGConfig.DomainVideo.new() video.set_model(LibvirtGConfig.DomainVideoModel.VIRTIO) +video.set_accel3d(True) domain.add_device(video) console = LibvirtGConfig.DomainConsole.new() diff --git a/libvirt-gconfig/libvirt-gconfig-domain-video.c b/libvirt-gconfig/libvirt-gconfig-domain-video.c index ba03c5a..64353bd 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-video.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-video.c @@ -136,3 +136,21 @@ void gvir_config_domain_video_set_heads(GVirConfigDomainVideo *video, NULL); g_object_unref(G_OBJECT(node)); } + +void gvir_config_domain_video_set_accel3d(GVirConfigDomainVideo *video, + gboolean accel3d) +{ + GVirConfigObject *model, *accel; + + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_VIDEO(video)); + model = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(video), "model"); + g_return_if_fail(GVIR_CONFIG_IS_OBJECT(model)); + accel = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(model), "acceleration"); + g_return_if_fail(GVIR_CONFIG_IS_OBJECT(accel)); + + gvir_config_object_set_attribute_with_type(accel, "accel3d", + G_TYPE_BOOLEAN, accel3d, + NULL); + g_object_unref(G_OBJECT(model)); + g_object_unref(G_OBJECT(accel)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-video.h b/libvirt-gconfig/libvirt-gconfig-domain-video.h index d162b8f..9fb8e4d 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-video.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-video.h @@ -82,6 +82,8 @@ void gvir_config_domain_video_set_vgamem(GVirConfigDomainVideo *video, guint kbytes); void gvir_config_domain_video_set_heads(GVirConfigDomainVideo *video, guint head_count); +void gvir_config_domain_video_set_accel3d(GVirConfigDomainVideo *video, + gboolean accel3d); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index b8c600e..f11f97a 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -735,6 +735,7 @@ global: LIBVIRT_GCONFIG_0.2.4 { gvir_config_domain_graphics_spice_set_gl; + gvir_config_domain_video_set_accel3d; } LIBVIRT_GCONFIG_0.2.2; # .... define new API here using predicted next version number .... -- 2.5.0

On Fri, Feb 26, 2016 at 12:37:12PM +0100, Marc-André Lureau wrote:
Learn to set the accel3d attribute on video model.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- examples/config-demo.py | 1 + libvirt-gconfig/libvirt-gconfig-domain-video.c | 18 ++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-video.h | 2 ++ libvirt-gconfig/libvirt-gconfig.sym | 1 + 4 files changed, 22 insertions(+)
ACK Regards, 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 :|

On Fri, Feb 26, 2016 at 12:37:12PM +0100, Marc-André Lureau wrote:
Learn to set the accel3d attribute on video model.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> --- examples/config-demo.py | 1 +
diff --git a/examples/config-demo.py b/examples/config-demo.py index 3fdc367..e92aa43 100644 --- a/examples/config-demo.py +++ b/examples/config-demo.py @@ -63,6 +63,7 @@ domain.add_device(graphics)
video = LibvirtGConfig.DomainVideo.new() video.set_model(LibvirtGConfig.DomainVideoModel.VIRTIO) +video.set_accel3d(True) domain.add_device(video)
console = LibvirtGConfig.DomainConsole.new()
For what it's worth, there is tests/test-gconfig.c which tries to test that libvirt-gconfig setters/getters are consistent, and which checks that the generated XML is the expected one. This is probably a better place than config-demo.py to add some test code in the future. Christophe
participants (3)
-
Christophe Fergeau
-
Daniel P. Berrange
-
Marc-André Lureau