From nobody Sun Feb 8 13:53:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573823168; cv=none; d=zoho.com; s=zohoarc; b=MP0IO0p3tY/78+co+TRcA5spCIbP1AcG5UyaA9moUKlJMSUD8zdx7Zsx+WPIiNFmnQ+PbFra1DJwUguGG4Kb+dg/VoXRIGE5imuUyRFlolIz+OXTc6ctoA9KgJ55mFwVuLqWxYOtc6DP+paFA0feUxVr0OGLWR6n0uftHGGgBc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573823168; h=Content-Type:Content-Transfer-Encoding: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=Mt4llKDiQkTfBgbjgp8j9Ky11FrNXbf/uJYRHXqj1ho=; b=d8vSckOUb6XlGduzUykrDHDQbSmSNGYP9FCiYfbjjOt/bqr4ZXs+KNZHRFHXXX6D0UdAyzvbGic4sJ/m0pWRAsr/WtYg/0PE2PjscT+u6426TS11aZbl/TI5+0U53BhvJb/V1jNXMKu+IHbny1AzUZ352tj+yMKjWI7+plxtCuc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1573823168395716.5577250377241; Fri, 15 Nov 2019 05:06:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-gHBeVLceNuSBtV737eiQbg-1; Fri, 15 Nov 2019 08:06:05 -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 B88168C321E; Fri, 15 Nov 2019 13:06:00 +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 9B01E1036C8E; Fri, 15 Nov 2019 13:05:59 +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 43D731832E38; Fri, 15 Nov 2019 13:05:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFD5Wg5029698 for ; Fri, 15 Nov 2019 08:05:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id AD96610E51B0; Fri, 15 Nov 2019 13:05:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8B6D10E60F6 for ; Fri, 15 Nov 2019 13:05:30 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1778F900A82 for ; Fri, 15 Nov 2019 13:05:30 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-344-mnfLdSjXPlWmYnmXHgNbTw-1; Fri, 15 Nov 2019 08:05:27 -0500 Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id B80D0774B63A for ; Fri, 15 Nov 2019 14:05:25 +0100 (CET) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 78AXclgsYDi0; Fri, 15 Nov 2019 14:05:24 +0100 (CET) Received: from fixa.knut.univention.de (p5B21E335.dip0.t-ipconnect.de [91.33.227.53]) by solig.knut.univention.de (Postfix) with ESMTPSA id 574F0774B618; Fri, 15 Nov 2019 14:05:23 +0100 (CET) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id A2A3316184A; Fri, 15 Nov 2019 14:05:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573823167; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=Mt4llKDiQkTfBgbjgp8j9Ky11FrNXbf/uJYRHXqj1ho=; b=XhYXPuXVI3DbH65SLs8J72ns9BVwJ280ZjD+nSOFvM6feCdhPWv6LycKjV0Hc3G1aZwE14 T0LvA/a7qeYR4m0rDMpfTBuxwjiFcDbZtol64U5EeH9mi/F6bH6Kugz8Gc4rcJlhB5lHR2 Vqal+WB30w+jVBlD2JmCibxH7YICHno= X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 14:05:12 +0100 Message-Id: <4e1bfd831fcc676e1876ddd2741856b3997de5c0.1573821545.git.hahn@univention.de> In-Reply-To: References: MIME-Version: 1.0 X-MC-Unique: mnfLdSjXPlWmYnmXHgNbTw-1 X-MC-Unique: gHBeVLceNuSBtV737eiQbg-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xAFD5Wg5029698 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH console-proxy 1/6] Adapt to API change for dom.Devices.Graphics 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 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Follow > commit 4772b681e87a8d0dcee011b8e43813e851e4f934 > Author: Daniel P. Berrange > Date: Fri Nov 24 16:15:30 2017 +0000 > > Add remaining graphics configuration options Signed-off-by: Philipp Hahn --- cmd/virtconsoleresolveradm/cmd/enable.go | 6 ++---- pkg/resolver/server.go | 26 ++++++++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/cmd/virtconsoleresolveradm/cmd/enable.go b/cmd/virtconsolereso= lveradm/cmd/enable.go index 04ca80b..dd95e9e 100644 --- a/cmd/virtconsoleresolveradm/cmd/enable.go +++ b/cmd/virtconsoleresolveradm/cmd/enable.go @@ -164,15 +164,13 @@ func doEnable(cmd *cobra.Command, args []string) { meta =3D &resolver.ConsoleServerProxyMetadata{} =20 for _, graphics :=3D range domcfg.Devices.Graphics { - switch graphics.Type { - case "spice": + if graphics.Spice !=3D nil { meta.Consoles =3D append(meta.Consoles, createConsole("spice", 0, conn, domname, domuuid)) - case "vnc": + } else if graphics.VNC !=3D nil { meta.Consoles =3D append(meta.Consoles, createConsole("vnc", 0, conn, domname, domuuid)) } - } =20 for idx, chardev :=3D range domcfg.Devices.Serials { diff --git a/pkg/resolver/server.go b/pkg/resolver/server.go index 115d75d..eefdad7 100644 --- a/pkg/resolver/server.go +++ b/pkg/resolver/server.go @@ -86,13 +86,19 @@ type ConsoleServer struct { =20 const tokenpath =3D "/consoleresolver/token/" =20 +func isListenAddress(listen string) bool { + return listen !=3D "" && listen !=3D "0.0.0.0" && listen !=3D "::" +} + func getListener(dom libvirtxml.Domain, gtype string, insecure bool, conso= leHost, defaultHost string) (string, error) { if dom.Devices =3D=3D nil { return "", errors.New("No devices present") } =20 for _, graphics :=3D range dom.Devices.Graphics { - if graphics.Type !=3D gtype { + if gtype =3D=3D "vnc" && graphics.VNC !=3D nil { + } else if gtype =3D=3D "spice" && graphics.Spice !=3D nil { + } else { continue } =20 @@ -100,21 +106,25 @@ func getListener(dom libvirtxml.Domain, gtype string,= insecure bool, consoleHost if consoleHost !=3D "" { host =3D consoleHost } else { - if graphics.Listen !=3D "" && graphics.Listen !=3D "0.0.0.0" && graphic= s.Listen !=3D "::" { - host =3D graphics.Listen + if graphics.VNC !=3D nil && isListenAddress(graphics.VNC.Listen) { + host =3D graphics.VNC.Listen + } else if graphics.Spice !=3D nil && isListenAddress(graphics.Spice.Lis= ten) { + host =3D graphics.Spice.Listen } else { host =3D defaultHost } } =20 var port int - if graphics.Type =3D=3D "spice" && !insecure { - port =3D graphics.TLSPort - } else { - port =3D graphics.Port + if graphics.Spice !=3D nil && !insecure { + port =3D graphics.Spice.TLSPort + } else if graphics.Spice !=3D nil { + port =3D graphics.Spice.Port + } else if graphics.VNC !=3D nil { + port =3D graphics.VNC.Port } glog.V(1).Infof("Got port %d\n", port) - if graphics.Port =3D=3D 0 || graphics.Port =3D=3D -1 { + if port =3D=3D 0 || port =3D=3D -1 { return "", errors.New("Missing port for graphics") } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list