From nobody Wed May 1 23:48:46 2024 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 From nobody Wed May 1 23:48:46 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1613484558; cv=none; d=zohomail.com; s=zohoarc; b=cmUfOKRIenYmsq96o29dYM1GmkpmoFD/uxIDIr0QIIFQY1lMYHtudgIEbCvRKt0ukC/EGv/hYnFwfLPReDlu/3ibAiZqZ3+wOSNTdVxYJu02zaIHwpu+0tOhMuvax1I2NhbXqNIrOOmr6zDfwdsBvPKv/0bkxkdRzC4prgvobGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613484558; 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=Z3bVxA2AN/FDtK8c+0NhC4Nk3BLG1ELmkL+fhGU5sJI=; b=eIdXemE0NQhcgprTnDu0gHUjzPrvD5CyLZVm/cal7nuGr9g7fdXGamFjo9bCTLOA65R1pLEsJvQSw2DVEaZMR+kUHRQhbOmGEzf9Rfbt9b4cWREejwQ6i9fjfl2XG9HV/DF9fkUhuRmUt6eDqK7fVWV01JcqxkVbL8w+Nmt28Wg= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= 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 1613484557918464.89892391532794; 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-593-3SfqzF45OsWLPr-JDec-9g-1; Tue, 16 Feb 2021 09:09:14 -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 DC1B4C73A9; Tue, 16 Feb 2021 14:09:07 +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 A38222C01F; Tue, 16 Feb 2021 14:09:07 +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 3CA4D18095CB; Tue, 16 Feb 2021 14:09:07 +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 11GE924W011097 for ; Tue, 16 Feb 2021 09:09:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id 159ED60C15; Tue, 16 Feb 2021 14:09:02 +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 0D6FA60C62; Tue, 16 Feb 2021 14:09:00 +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=Z3bVxA2AN/FDtK8c+0NhC4Nk3BLG1ELmkL+fhGU5sJI=; b=D/6ZmSS3olYh590UtH5kLM3msmx8QQsNAnutUBHmatnOCmE7JR/kelSUZabTWGNwgt7wAC xhTsqFOOHQAyRl6+w6xl/s5Gcbh/K3fMpZ4srIiRa8iAzpE8fpY0KNNgpHMb/q0t8i+zmu XSU6ROx+sWkUGQf2lZzlOtpv9inmGb8= X-MC-Unique: 3SfqzF45OsWLPr-JDec-9g-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] qemu: probe for -vnc power-control option support Date: Tue, 16 Feb 2021 14:08:51 +0000 Message-Id: <20210216140852.364500-3-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) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 + 3 files changed, 4 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 3f8593a9e5..8fa23f14be 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -617,6 +617,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "cpu-max", "memory-backend-file.x-use-canonical-path-for-ramblock-id", "vnc-opts", + "vnc-power-control", ); =20 =20 @@ -3297,6 +3298,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCaps= CommandLine[] =3D { { "fw_cfg", "file", QEMU_CAPS_FW_CFG }, { "fsdev", "fmode", QEMU_CAPS_FSDEV_CREATEMODE }, /* Could have also c= hecked fsdev->dmode */ { "vnc", "display", QEMU_CAPS_VNC_OPTS }, + { "vnc", "power-control", QEMU_CAPS_VNC_POWER_CONTROL }, }; =20 static int diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 38574eef16..e327db0148 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -597,6 +597,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_CPU_MAX, /* -cpu max */ QEMU_CAPS_X_USE_CANONICAL_PATH_FOR_RAMBLOCK_ID, /* -object memory-back= end-file,x-use-canonical-path-for-ramblock-id=3D */ QEMU_CAPS_VNC_OPTS, /* -vnc uses QemuOpts parser instead of custom cod= e */ + QEMU_CAPS_VNC_POWER_CONTROL, /* -vnc power-control option */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.0.0.x86_64.xml index 23fb5b7393..3ef05ec94e 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml @@ -256,6 +256,7 @@ + 5002050 0 43100242 --=20 2.29.2 From nobody Wed May 1 23:48:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1613484571; cv=none; d=zohomail.com; s=zohoarc; b=agQ8kc3uVvCJYFsWXQ0ek3tQllhIiy+ppSveeATeJS9MmtRZph8gQzqH6WdvUBBZVr3a+QLJqS2PStP0IjlD6RI3tMnnZAgUXP/K4ziQkL6FhRszucrbB9HsECHZ0cZ3RzlN7YgZPULBfuRlexKknkt0SmZh7vCEM3wIadAjJww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613484571; 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=Q0tLcoSlz/dUGpbpXPi8Z6Jb02umTCTDHcpZVHvDXA0=; b=SOlBxCwCd9KiKmguNyxUl3FmSmqgmNrC2jyLOqEmQ1dZjDDSSN18HhGe5ICBuHHuhhhaF/Z7ZaezOTodlKD2TWCF/nncV7Atrqui+rkn1oeQb0o8Ed/m9fncRGGuf/mtJPWChk6EF6icfd1+TyoRE4a3zPqqKeyeJTSnHvQzXus= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613484571252158.3178803884755; Tue, 16 Feb 2021 06:09:31 -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-244-pHxSi_QfPE2uR5r0_w1TJw-1; Tue, 16 Feb 2021 09:09:27 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E808D106BB3B; Tue, 16 Feb 2021 14:09:21 +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 C0DE160CFC; Tue, 16 Feb 2021 14:09:21 +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 72F2718095CE; Tue, 16 Feb 2021 14:09:21 +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 11GE93bs011110 for ; Tue, 16 Feb 2021 09:09:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id AEAE560C62; Tue, 16 Feb 2021 14:09:03 +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 90CA260C15; Tue, 16 Feb 2021 14:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613484570; 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=Q0tLcoSlz/dUGpbpXPi8Z6Jb02umTCTDHcpZVHvDXA0=; b=aLpp9KYFA1Ep0gzWO8Uez/Abe/S9cXR9SQhA17VAB/yAZZyfg6PHRl3ZtRV3RHxiMMZqya 0PvTp97OAiM4bh5PGJHbbHodOR4hZmbb6QRXxQKvXUzYAMWCsAX9PQa1JAQ1EdmMh3HmIF ufBg7z+oIysr5/vWZKqQAAXZktjkNVg= X-MC-Unique: pHxSi_QfPE2uR5r0_w1TJw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] qemu: wire up support for VNC power control options Date: Tue, 16 Feb 2021 14:08:52 +0000 Message-Id: <20210216140852.364500-4-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.13 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) This allows the VNC client user to perform a shutdown, reboot and reset of the VM from the host side. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_command.c | 9 +++++++++ tests/qemuxml2argvdata/graphics-vnc-policy.args | 2 +- tests/qemuxml2argvdata/graphics-vnc-policy.xml | 2 +- tests/qemuxml2argvtest.c | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d801018aa2..266cf7332e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7700,6 +7700,15 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigP= tr cfg, /* TODO: Support ACLs later */ } =20 + if (graphics->data.vnc.powerControl) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_POWER_CONTROL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VNC power control is not available")); + return -1; + } + virBufferAddLit(&opt, ",power-control=3Don"); + } + virCommandAddArg(cmd, "-vnc"); virCommandAddArgBuffer(cmd, &opt); if (graphics->data.vnc.keymap) diff --git a/tests/qemuxml2argvdata/graphics-vnc-policy.args b/tests/qemuxm= l2argvdata/graphics-vnc-policy.args index 85b7d722e0..d3a8d66161 100644 --- a/tests/qemuxml2argvdata/graphics-vnc-policy.args +++ b/tests/qemuxml2argvdata/graphics-vnc-policy.args @@ -26,5 +26,5 @@ server=3Don,wait=3Doff \ -usb \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ --vnc '[::]:59630,share=3Dallow-exclusive' \ +-vnc '[::]:59630,share=3Dallow-exclusive,power-control=3Don' \ -vga cirrus diff --git a/tests/qemuxml2argvdata/graphics-vnc-policy.xml b/tests/qemuxml= 2argvdata/graphics-vnc-policy.xml index 344f019079..4bee773438 100644 --- a/tests/qemuxml2argvdata/graphics-vnc-policy.xml +++ b/tests/qemuxml2argvdata/graphics-vnc-policy.xml @@ -25,7 +25,7 @@ - +