From nobody Sat Apr 27 19:39:46 2024 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 From nobody Sat Apr 27 19:39:46 2024 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 1613499069372407.6413514360761; Tue, 16 Feb 2021 10:11:09 -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-364-H0XA9xD_NWy69KK7ij5Ocw-1; Tue, 16 Feb 2021 13:11:03 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 78C8D1020C21; Tue, 16 Feb 2021 18:10:56 +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 21CC95D9D3; Tue, 16 Feb 2021 18:10:55 +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 7395E18095CD; Tue, 16 Feb 2021 18:10:54 +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 11GIAqsw016518 for ; Tue, 16 Feb 2021 13:10:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id B560510016FD; Tue, 16 Feb 2021 18:10:52 +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 26E1710016DB; Tue, 16 Feb 2021 18:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613499067; 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=E92ngC59tTGw3U8uQqkhVPCk/tWc4thM350ozT+TfwQ=; b=dvg1se1ie9xFEtdsG7awJIT5jzNoQ/bZxt5BYsx2RAT+oGmSTExv+DBShFRa3upcyuiXKe FpL6ghYir5Gn+7KFVqWnimVLc+IOweZIsSBSfJhNZRnojKI4ViRK1/ux6jpGbbK8BbFOEx fSN7tRaLN3PsHtMhv5PW8fyQfmg2vlo= X-MC-Unique: H0XA9xD_NWy69KK7ij5Ocw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/3] qemu: probe for -vnc power-control option support Date: Tue, 16 Feb 2021 18:10:30 +0000 Message-Id: <20210216181031.516668-3-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.79 on 10.5.11.14 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" Signed-off-by: Daniel P. Berrang=C3=A9 --- 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 Sat Apr 27 19:39:46 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1613499088; cv=none; d=zohomail.com; s=zohoarc; b=QeoK7JQ6hOiUdDUH9pSX2HWDM9pCQr0JCJRRT33TLRBbkwvs5w8nHem0S2no5Ih7plXoOlQu6tvotC0OybZwc8iRxljjNha4lz+cHUaZTpqPw2jOwK203TVic9IzqeU8NIsWLyTadOIAWlW3E4+hRuGGW+n9uY7e23+Q8haLo3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613499088; 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=6anynCdMcZLFq2vKh/Mj0bg6sYSNXZdISklUfCuS5mI=; b=EhOSq+LDCoFGHrs+u0agf1X4OdA+tO6RUDcbbk24YG3FEcZde+WadmFXkl3MuJOSrvtZcw/qAdWCo0ilL/2I24McPNlLx+WfzXn21Q3mU+J0flBOcFrb/TSLpQou/u4Wx/bSsmjrE9Qu4+U9ae11T29PPRPzKYi2TzDBQKAoyUM= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= 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 1613499088536667.0222344941923; Tue, 16 Feb 2021 10:11:28 -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-484-X1Me6UTCNOmOCqE1QPOndA-1; Tue, 16 Feb 2021 13:11:22 -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 B26A91E561; Tue, 16 Feb 2021 18:11:16 +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 88E9210023AB; Tue, 16 Feb 2021 18:11:16 +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 ED00C1809C8F; Tue, 16 Feb 2021 18:11:15 +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 11GIB0PZ016555 for ; Tue, 16 Feb 2021 13:11:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id CC42410023AD; Tue, 16 Feb 2021 18:11: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 1020D10016DB; Tue, 16 Feb 2021 18:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613499087; 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=6anynCdMcZLFq2vKh/Mj0bg6sYSNXZdISklUfCuS5mI=; b=LWCacqdp43Y8sjWTqtMVSsUNaCL1SndNUwUyJP14EbHs4G+QTgq5WGByplYyg3o44XCCb1 fzd6PlPp5BnBqxAAcVHFENUZCfyH9E1Q/pXvnIgmLb8lapx8gP1JfoS02PV3w0Acj8jWyp abBavUMEnsHG5kzpBMzoo/ItogkAC3w= X-MC-Unique: X1Me6UTCNOmOCqE1QPOndA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 3/3] qemu: wire up support for VNC power control options Date: Tue, 16 Feb 2021 18:10:31 +0000 Message-Id: <20210216181031.516668-4-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.22 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" 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 | 6 +++ src/qemu/qemu_validate.c | 21 ++++++++++ .../graphics-vnc-power.x86_64-latest.args | 40 +++++++++++++++++++ tests/qemuxml2argvdata/graphics-vnc-power.xml | 36 +++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 5 files changed, 104 insertions(+) create mode 100644 tests/qemuxml2argvdata/graphics-vnc-power.x86_64-latest= .args create mode 100644 tests/qemuxml2argvdata/graphics-vnc-power.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d801018aa2..7597ffafd1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7700,6 +7700,12 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigP= tr cfg, /* TODO: Support ACLs later */ } =20 + if (graphics->data.vnc.powerControl !=3D VIR_TRISTATE_BOOL_ABSENT) { + virBufferAsprintf(&opt, ",power-control=3D%s", + graphics->data.vnc.powerControl =3D=3D VIR_TRIST= ATE_BOOL_YES ? + "on" : "off"); + } + virCommandAddArg(cmd, "-vnc"); virCommandAddArgBuffer(cmd, &opt); if (graphics->data.vnc.keymap) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 2541ae856a..2f98209470 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3939,7 +3939,22 @@ qemuValidateDomainDeviceDefSPICEGraphics(const virDo= mainGraphicsDef *graphics, return 0; } =20 +static int +qemuValidateDomainDeviceDefVNCGraphics(const virDomainGraphicsDef *graphic= s, + virQEMUDriverPtr driver, + virQEMUCapsPtr qemuCaps) +{ + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + + if (graphics->data.vnc.powerControl !=3D VIR_TRISTATE_BOOL_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_POWER_CONTROL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VNC power control is not available")); + return -1; + } =20 + return 0; +} static int qemuValidateDomainDeviceDefGraphics(const virDomainGraphicsDef *graphics, const virDomainDef *def, @@ -4023,6 +4038,12 @@ qemuValidateDomainDeviceDefGraphics(const virDomainG= raphicsDef *graphics, break; =20 case VIR_DOMAIN_GRAPHICS_TYPE_VNC: + if (qemuValidateDomainDeviceDefVNCGraphics(graphics, driver, + qemuCaps) < 0) + return -1; + + break; + case VIR_DOMAIN_GRAPHICS_TYPE_RDP: case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: case VIR_DOMAIN_GRAPHICS_TYPE_LAST: diff --git a/tests/qemuxml2argvdata/graphics-vnc-power.x86_64-latest.args b= /tests/qemuxml2argvdata/graphics-vnc-power.x86_64-latest.args new file mode 100644 index 0000000000..7ef6f7f4e6 --- /dev/null +++ b/tests/qemuxml2argvdata/graphics-vnc-power.x86_64-latest.args @@ -0,0 +1,40 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dp= c.ram \ +-cpu qemu64 \ +-m 214 \ +-object memory-backend-ram,id=3Dpc.ram,size=3D224395264 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1",\ +"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ",\ +"file":"libvirt-1-storage"}' \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-1-format,id=3Dide0-0-0= ,bootindex=3D1 \ +-vnc '[::]:59630,power-control=3Don' \ +-device cirrus-vga,id=3Dvideo0,bus=3Dpci.0,addr=3D0x2 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/graphics-vnc-power.xml b/tests/qemuxml2= argvdata/graphics-vnc-power.xml new file mode 100644 index 0000000000..00f0a215a5 --- /dev/null +++ b/tests/qemuxml2argvdata/graphics-vnc-power.xml @@ -0,0 +1,36 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index db438c5466..682b7d52d2 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1365,6 +1365,7 @@ mymain(void) QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA); + DO_TEST_CAPS_LATEST("graphics-vnc-power"); DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("graphics-vnc-remove-generated-socket", QEMU_CAPS_VNC, --=20 2.29.2