summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy2022-04-01 16:39:35 +0200
committerGerd Hoffmann2022-04-27 07:51:01 +0200
commitabea19468e94821d098e546f0cafc9da759bc929 (patch)
tree4e896db7c8df22c6e9c42b142985354d55bd332e /ui
parentui/vnc: refactor arrays of addresses to SocketAddressList (diff)
downloadqemu-abea19468e94821d098e546f0cafc9da759bc929.tar.gz
qemu-abea19468e94821d098e546f0cafc9da759bc929.tar.xz
qemu-abea19468e94821d098e546f0cafc9da759bc929.zip
qapi/ui: add 'display-update' command for changing listen address
Add possibility to change addresses where VNC server listens for new connections. Prior to 6.0 this functionality was available through 'change' qmp command which was deleted. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220401143936.356460-3-vsementsov@openvz.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/vnc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index 77a660fccb..b02cb3f405 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3981,6 +3981,29 @@ static int vnc_display_listen(VncDisplay *vd,
return 0;
}
+bool vnc_display_update(DisplayUpdateOptionsVNC *arg, Error **errp)
+{
+ VncDisplay *vd = vnc_display_find(NULL);
+
+ if (!vd) {
+ error_setg(errp, "Can not find vnc display");
+ return false;
+ }
+
+ if (arg->has_addresses) {
+ if (vd->listener) {
+ qio_net_listener_disconnect(vd->listener);
+ object_unref(OBJECT(vd->listener));
+ vd->listener = NULL;
+ }
+
+ if (vnc_display_listen(vd, arg->addresses, NULL, errp) < 0) {
+ return false;
+ }
+ }
+
+ return true;
+}
void vnc_display_open(const char *id, Error **errp)
{