From nobody Tue Feb 10 01:35:55 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=1652467176; cv=none; d=zohomail.com; s=zohoarc; b=IBilw6VBncwnw2UEAy4qqYjBSB/Oj2ElaCskFUZ74eorSQTSedEMK1f5ZXhZ9VZrhlK8LTCG+XOswaD36yHPtzPfwDs2NICK/Rqo+0tW5fqOXwXQGNRw+ew50DplrX90w4QHEJZu3s8Y2PV/f+BgBHp0QMfg9xH2vmpf4M95DWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652467176; 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=i+fNWMQhlk6ZKGGpG7MVmJr0pxvw3vRjkhMgEV6zd84=; b=dRVu8mN34DxTsl9sE7A8t2H+AZ7VBfn/V8PcM6dJvEEHXvB7bkDPLON7EM7EMBed6yTkmoDH5/KseqkmRWAs+odJapvQYJc0Gtx6YoHSc37xlF/EnUSDSxkVVDn6blDBjsPoht9UjX5upD9Iy1PJl2hyFPAkUhjwtgK/WzOQREM= 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 1652467176170148.13704445007613; Fri, 13 May 2022 11:39:36 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-286-oF4o8GI9NUWSgetnrRLW1Q-1; Fri, 13 May 2022 14:39:31 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F14A2919EBE; Fri, 13 May 2022 18:39:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 175BA403373; Fri, 13 May 2022 18:39:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C39C41932211; Fri, 13 May 2022 18:39:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A0BDB193210A for ; Fri, 13 May 2022 18:39:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 916FC43EA39; Fri, 13 May 2022 18:39:27 +0000 (UTC) Received: from localhost (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CFF1432110; Fri, 13 May 2022 18:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652467175; 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=i+fNWMQhlk6ZKGGpG7MVmJr0pxvw3vRjkhMgEV6zd84=; b=RcKfH46S0jRCAb2xHm/r6/1ggbkl+jbUng2TwbEdp5lBz7wtDC2rchmY2d+a1vI7RpCBf6 nR3Tk9MAHJm5O4CFevNwWDSiSHJ6Ws3kLlvs8XDVUbFGBYV9O7RE3LIIVlK3ivTa2eMo4J TTsVq1hbdxtNK90T1seSXM3jcE/DgSs= X-MC-Unique: oF4o8GI9NUWSgetnrRLW1Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Subject: [libvirt PATCH v4 05/11] virsh: report the D-Bus bus URI for domdisplay Date: Fri, 13 May 2022 20:38:14 +0200 Message-Id: <20220513183820.925602-6-marcandre.lureau@redhat.com> In-Reply-To: <20220513183820.925602-1-marcandre.lureau@redhat.com> References: <20220513183820.925602-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mprivozn@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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: 1652467177273100001 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 | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ba492e807e..bac4cc0fb6 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11675,7 +11675,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, @@ -11684,6 +11684,23 @@ static const vshCmdOptDef opts_domdisplay[] =3D { {.name =3D NULL} }; =20 +static char * +virshGetDBusDisplay(vshControl *ctl, xmlXPathContext *ctxt) +{ + 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")) { + return g_strdup_printf("dbus+unix://%s", addr + 10); + } + + vshError(ctl, _("'%s' D-Bus address is not handled"), addr); + return NULL; +} =20 static char * virshGetOneDisplay(vshControl *ctl, @@ -11704,6 +11721,9 @@ virshGetOneDisplay(vshControl *ctl, g_autofree char *sockpath =3D NULL; g_autofree char *passwd =3D NULL; =20 + if (STREQ(scheme, "dbus")) + return virshGetDBusDisplay(ctl, ctxt); + /* Attempt to get the port number for the current graphics scheme */ xpathPort =3D g_strdup_printf(xpath_fmt, scheme, "@port"); =20 @@ -11830,7 +11850,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) g_autoptr(xmlXPathContext) ctxt =3D NULL; g_autoptr(virshDomain) dom =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.36.1