From nobody Mon Feb 9 23:38:14 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 205.139.111.44 is neither permitted nor denied by domain of listman.redhat.com) client-ip=205.139.111.44; envelope-from=libvir-list-bounces@listman.redhat.com; helo=us-smtp-delivery-44.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=none (zohomail.com: 205.139.111.44 is neither permitted nor denied by domain of listman.redhat.com) smtp.mailfrom=libvir-list-bounces@listman.redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) by mx.zohomail.com with SMTPS id 1613499082848210.93280929295383; Tue, 16 Feb 2021 10:11:22 -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-412-IzX7MR5HNCiu83JsuEEc8g-1; Tue, 16 Feb 2021 13:11:16 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 225421846096; Tue, 16 Feb 2021 18:11:10 +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 E02BE19D9F; Tue, 16 Feb 2021 18:11:09 +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 8628F1809C92; Tue, 16 Feb 2021 18:11:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11GIAlxO016499 for ; Tue, 16 Feb 2021 13:10:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9BB9510016FD; Tue, 16 Feb 2021 18:10:47 +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 56D0110023AB; Tue, 16 Feb 2021 18:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613499081; 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=aONY4QfILcsIfANjkJpOSQSlaMgM0O09WM8jPKLSJ1c=; b=HgInuw7zMh8f89R04mhqkm+URX30eecJLLQFXx4u8lIFqwczVwF4XdaWWsvzDBlnz+LQJw 1Up08jei9E/YYP3bHKPnhT6pAeqzOLg56yl7pZH5nYQzeP8aua2SFSh5Tof/II0+/kL1rg /l1sHP6Q+Pj99wrz54s4KUEAxMMjDm0= X-MC-Unique: IzX7MR5HNCiu83JsuEEc8g-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/3] conf: add support for VNC power control setting Date: Tue, 16 Feb 2021 18:10:29 +0000 Message-Id: <20210216181031.516668-2-berrange@redhat.com> In-Reply-To: <20210216181031.516668-1-berrange@redhat.com> References: <20210216181031.516668-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@listman.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@listman.redhat.com Errors-To: libvir-list-bounces@listman.redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@listman.redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: listman.redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 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 | 15 +++++++++++++++ src/conf/domain_conf.h | 1 + 4 files changed, 26 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..5e15d394c4 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,16 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsD= efPtr def, } } =20 + if (powerControl) { + int powerControlVal =3D virTristateBoolTypeFromString(powerControl= ); + if (powerControlVal < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse vnc power control '%s'"), power= Control); + return -1; + } + def->data.vnc.powerControl =3D powerControlVal; + } + def->data.vnc.keymap =3D virXMLPropString(node, "keymap"); =20 if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth, @@ -27148,6 +27159,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virDomainGraphicsVNCSharePolicyTypeToString( def->data.vnc.sharePolicy)); =20 + if (def->data.vnc.powerControl) + virBufferAsprintf(buf, " powerControl=3D'%s'", + virTristateBoolTypeToString(def->data.vnc.po= werControl)); + 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..881d64bae9 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; + virTristateBool powerControl; } vnc; struct { char *display; --=20 2.29.2