From nobody Sun Feb 8 05:07:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613484557820538.5634627775264; Tue, 16 Feb 2021 06:09:17 -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-537-FOVbEy69Ny2jG84zgvT5Yw-1; Tue, 16 Feb 2021 09:09:13 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4628C73A4; Tue, 16 Feb 2021 14:09:05 +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 9E4ED1981B; Tue, 16 Feb 2021 14:09:04 +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 52A7457DFA; Tue, 16 Feb 2021 14:09:02 +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 11GE90xo011091 for ; Tue, 16 Feb 2021 09:09:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8552660C61; Tue, 16 Feb 2021 14:09:00 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-215.ams2.redhat.com [10.36.112.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id 095F060C15; Tue, 16 Feb 2021 14:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613484556; 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=eTs3os8WOEtOhkg9Oe973kpTGYcA9WsNxyyLgHiSa/o=; b=g2NA9XH9liv5l6g9A/CccjOvaEx63VO9x7JQy7U8NwjjBWZ9C0fARq/q7EHFeKUZaoHuZd PJvoh7LcOpCr3p8ZksWr0nNjDnUDtTqiCzqTj0hHIygQOVQj10+4EVVshV78nLWF8yf/Ii 9gZMyUhjGll/FGCsyZ+MpQBrNRM9rws= X-MC-Unique: FOVbEy69Ny2jG84zgvT5Yw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] conf: add support for VNC power control setting Date: Tue, 16 Feb 2021 14:08:50 +0000 Message-Id: <20210216140852.364500-2-berrange@redhat.com> In-Reply-To: <20210216140852.364500-1-berrange@redhat.com> References: <20210216140852.364500-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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.11 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) The option instructs the VNC server to enable an extension that lets the client perform a graceful shutdown, reboot and hard reset. This is enabled by default since it cannot be assumed that the VNC client user has administrator rights over the guest OS. In the case where the VNC user is a guest administrator though, it is reasonable to allow direct power control host side too. Signed-off-by: Daniel P. Berrang=C3=A9 --- docs/formatdomain.rst | 5 +++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 12 ++++++++++++ src/conf/domain_conf.h | 1 + 4 files changed, 23 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index eafd6b3396..580319365c 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -5791,6 +5791,11 @@ interaction with the admin. ``autoport`` having no effect due to security reasons) :since:`Since 1.0.6` . =20 + For VNC, the ``powerControl`` attribute can be used to enable VM shu= tdown, + reboot and reset power control features for the VNC client. This is + appropriate if the authenticated VNC client user already has adminis= trator + privileges in the guest :since:`Since 7.1.0`. + Although VNC doesn't support OpenGL natively, it can be paired with graphics type ``egl-headless`` (see below) which will instruct QEMU = to open and use drm nodes for OpenGL rendering. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e6de934456..49dc4b5130 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3663,6 +3663,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b731744f04..91933bf292 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13150,6 +13150,7 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDe= fPtr def, g_autofree char *websocketGenerated =3D virXMLPropString(node, "websoc= ketGenerated"); g_autofree char *sharePolicy =3D virXMLPropString(node, "sharePolicy"); g_autofree char *autoport =3D virXMLPropString(node, "autoport"); + g_autofree char *powerControl =3D virXMLPropString(node, "powerControl= "); =20 if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0) return -1; @@ -13206,6 +13207,13 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsD= efPtr def, } } =20 + if (powerControl && + virStringParseYesNo(powerControl, &def->data.vnc.powerControl) < 0= ) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse vnc power control '%s'"), powerCont= rol); + return -1; + } + def->data.vnc.keymap =3D virXMLPropString(node, "keymap"); =20 if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth, @@ -27148,6 +27156,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virDomainGraphicsVNCSharePolicyTypeToString( def->data.vnc.sharePolicy)); =20 + if (def->data.vnc.powerControl) + virBufferAsprintf(buf, " powerControl=3D'%s'", + def->data.vnc.powerControl ? "yes" : "no"); + virDomainGraphicsAuthDefFormatAttr(buf, &def->data.vnc.auth, flags= ); break; =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 930eed60de..544ec1b2fa 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1712,6 +1712,7 @@ struct _virDomainGraphicsDef { char *keymap; virDomainGraphicsAuthDef auth; int sharePolicy; + bool powerControl; } vnc; struct { char *display; --=20 2.29.2