ui/dbus: add p2p=on/off option

Add an option to use direct connections instead of via the bus. Clients
are accepted with QMP add_client.

This allows to provide the D-Bus display without a bus. It also
simplifies the testing setup (some CI have issues to setup a D-Bus bus
in a container).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Marc-André Lureau
2021-10-10 00:16:57 +04:00
parent 142ca628a7
commit 99997823bb
13 changed files with 203 additions and 12 deletions

View File

@ -24,6 +24,7 @@
#include "chardev/char.h"
#include "ui/qemu-spice.h"
#include "ui/console.h"
#include "ui/dbus-display.h"
#include "sysemu/kvm.h"
#include "sysemu/runstate.h"
#include "sysemu/runstate-action.h"
@ -285,6 +286,18 @@ void qmp_add_client(const char *protocol, const char *fdname,
skipauth = has_skipauth ? skipauth : false;
vnc_display_add_client(NULL, fd, skipauth);
return;
#endif
#ifdef CONFIG_DBUS_DISPLAY
} else if (strcmp(protocol, "@dbus-display") == 0) {
if (!qemu_using_dbus_display(errp)) {
close(fd);
return;
}
if (!qemu_dbus_display.add_client(fd, errp)) {
close(fd);
return;
}
return;
#endif
} else if ((s = qemu_chr_find(protocol)) != NULL) {
if (qemu_chr_add_client(s, fd) < 0) {