From nobody Mon Feb 9 19:37:43 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=1640202352; cv=none; d=zohomail.com; s=zohoarc; b=d+WsWogUHVjmrsM8FMtH1m1Ii20NVnaXPqhJuCsm3+mJzQqZOzBLVvtzeD8B8V+bx0hOjLDAG+qH91rFSR5maizxb8rose/hgkswrwcIL94uL5ohkSsyL14eydmd/1bj+wpYjd0uIQv40PUqhhJQaR0+ptVV4C0sbRD898KaLv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640202352; 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=oW9sAs9OGhRiUer1Wd4Ig5t2mtCMY64PjYrGehHflbM=; b=jGO/jShD6Z0qSZ2XsD8rR16Tw4PPB9g41zaLHn3cJoACHVZAZSdmB4lUPoDKkEQy5Uafh4litxC7w8BLtafvNkEnNkkkwwpCSqtploXhXSF6FbpI/LxDoOMljMziUEGxhaHFP71ROSDy4p4QnxlZypiWeO2vnbFP9kxANYrAU54= 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 1640202351992648.3482229009879; Wed, 22 Dec 2021 11:45:51 -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-576-DKRuZRcrPdaerh0q0VHZqw-1; Wed, 22 Dec 2021 14:45:48 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C51551006AC0; Wed, 22 Dec 2021 19:45:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A734D6BC7D; Wed, 22 Dec 2021 19:45:43 +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 7AFB14A700; Wed, 22 Dec 2021 19:45:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BMJjgC6019114 for ; Wed, 22 Dec 2021 14:45:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2B7FC6BC7D; Wed, 22 Dec 2021 19:45:42 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2514F6BC9A; Wed, 22 Dec 2021 19:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640202351; 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=oW9sAs9OGhRiUer1Wd4Ig5t2mtCMY64PjYrGehHflbM=; b=LMv6DuBghiOAtx8/BI2v3gCpMqUcky+iUjAfT4yS9AP5WCZIwCK7bYOL3Q8QW15f9ZNaDQ R7zisW5f6zG5a2Ohpia6CzY/ekhP8A7gS9/kBqTa6XE98J+k3CKeM/AJAwW/5fBDq3W2LJ Gd1G2FpkUM9mTTcWgsOgZOBrxgUgPtg= X-MC-Unique: DKRuZRcrPdaerh0q0VHZqw-1 From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH v3 08/16] virsh: report the D-Bus bus URI for domdisplay Date: Wed, 22 Dec 2021 23:43:37 +0400 Message-Id: <20211222194345.766352-9-marcandre.lureau@redhat.com> In-Reply-To: <20211222194345.766352-1-marcandre.lureau@redhat.com> References: <20211222194345.766352-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.79 on 10.5.11.12 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: 1640202352489100001 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 002cfc4be6af..00ed07a02cb4 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11497,7 +11497,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, @@ -11506,6 +11506,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) @@ -11521,6 +11541,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 @@ -11681,7 +11704,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