From nobody Tue Feb 10 17:30:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638455114; cv=none; d=zohomail.com; s=zohoarc; b=OvVeBiF10eK8j5hR5U5J8UL/mkZyT9MuL2emvv9MdNRO0OSECTmAYNtaZlCJV9Aux6kymhzjAt202AcEO0GdVa0pq02+qIUhbRir8HVibL3m09aS+IgMEHq1PzXFTpwCjn6lyLzOSOqyubGA1Xe1tjV5Vjb99vFYdgwGE5jGzI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638455114; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C1fT5IFPXXV/oTvIGVhD7Dc9B+IypDQhoPytG9EyGqU=; b=YopFzQDEVqVpYmQCmqehpS7kTRyzMcerRi3FP5KP+vqjdeunZhob63bVh66TkJ4KNku13BHvCpjwm4VUAPkhdBldUb57Kq7wNSq8cDvM8rlCdDzjK42RmfT+nNVrctDccsxBMJtIIcJqRhemtG3297dW67Q6xjE5iYlskVVAmX4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638455114245246.58619136700213; Thu, 2 Dec 2021 06:25:14 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-288-XNxeuaj2O7qF0XEKZMLgew-1; Thu, 02 Dec 2021 09:25:09 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E07464143; Thu, 2 Dec 2021 14:25:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A98110023AA; Thu, 2 Dec 2021 14:25:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3B9501806D2B; Thu, 2 Dec 2021 14:25:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B2EP02F027310 for ; Thu, 2 Dec 2021 09:25:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7A5FD196F8; Thu, 2 Dec 2021 14:25:00 +0000 (UTC) Received: from localhost (unknown [10.2.14.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43BCD196F2; Thu, 2 Dec 2021 14:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638455113; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=C1fT5IFPXXV/oTvIGVhD7Dc9B+IypDQhoPytG9EyGqU=; b=OzuujFNv5vnXwhqWGxwKwbcWW2POu5rGY8YjDu4KbAqbzlILY0PpVhXb4uhNsO9OXfBA9a HFAdLBVuEW6V634arIyVaRmRxomjcjqP24m38X1mDxI64vZlbaO4xO2W/6bGa3EMMd3ZZT 2CO/advkKGt9UilpAcnumj3aFhVd/38= X-MC-Unique: XNxeuaj2O7qF0XEKZMLgew-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH v2 07/15] virsh: report the D-Bus bus URI for domdisplay Date: Thu, 2 Dec 2021 18:24:03 +0400 Message-Id: <20211202142411.1718032-8-marcandre.lureau@redhat.com> In-Reply-To: <20211202142411.1718032-1-marcandre.lureau@redhat.com> References: <20211202142411.1718032-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638455115392100001 From: Marc-Andr=C3=A9 Lureau This implementation reports only Unix bus address using the URI format proposed in https://gitlab.freedesktop.org/dbus/dbus/-/issues/348. We prefer a URI form over the D-Bus address form, since all other display protocols use a URI, allowing to distinguish between protocols and making client implementation simpler. Other transports (for example TCP) are not yet handled. The client is assumed to know what to lookup on the bus (the bus name, path & interface of the VM, eventually matching its UUID) P2P mode doesn't report any available URI. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tools/virsh-domain.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index fbe8ec3ea782..89a9546c4a74 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11431,7 +11431,7 @@ static const vshCmdOptDef opts_domdisplay[] =3D { {.name =3D "type", .type =3D VSH_OT_STRING, .help =3D N_("select particular graphical display " - "(e.g. \"vnc\", \"spice\", \"rdp\")") + "(e.g. \"vnc\", \"spice\", \"rdp\", \"dbus\")") }, {.name =3D "all", .type =3D VSH_OT_BOOL, @@ -11440,6 +11440,26 @@ static const vshCmdOptDef opts_domdisplay[] =3D { {.name =3D NULL} }; =20 +static bool +cmdDomDisplayDBus(vshControl *ctl, xmlXPathContext *ctxt, virBuffer *buf) +{ + g_autofree char *addr =3D NULL; + const char *xpath =3D "string(/domain/devices/graphics[@type=3D'dbus']= /@address)"; + + addr =3D virXPathString(xpath, ctxt); + if (!addr) + return false; + + if (STRPREFIX(addr, "unix:path=3D")) { + virBufferAsprintf(buf, "dbus+unix://%s", addr + 10); + } else { + vshError(ctl, _("'%s' D-Bus address is not handled"), addr); + return false; + } + + return true; +} + static bool cmdDomDisplayScheme(vshControl *ctl, const char *scheme, xmlXPathContext *ctxt, virBuffer *buf) @@ -11455,6 +11475,9 @@ cmdDomDisplayScheme(vshControl *ctl, const char *sc= heme, bool params =3D false; int tmp; =20 + if (STREQ(scheme, "dbus")) + return cmdDomDisplayDBus(ctl, ctxt, buf); + /* Create our XPATH lookup for the current display's port */ xpath =3D g_strdup_printf(xpath_fmt, scheme, "@port"); =20 @@ -11615,7 +11638,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; g_autofree char *output =3D NULL; bool ret =3D false; - const char *scheme[] =3D { "vnc", "spice", "rdp", NULL }; + const char *scheme[] =3D { "vnc", "spice", "rdp", "dbus", NULL }; const char *type =3D NULL; int iter =3D 0; int flags =3D 0; --=20 2.34.1.8.g35151cf07204