From nobody Thu Apr 25 10:56:45 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1619444955; cv=none; d=zohomail.com; s=zohoarc; b=Qy4ms26aYqKagEviJ1vjXVmQJy3AMkvhxJSrkiB6XM+sI8hmUvZTbpe7el4QXN7iCyETrtHZIXt1jpt0tmRJl9jQUO5r47CaWuNlUFCCVlFY2KyeyTj+sLGsUlcx+ZEqyoyUHO0wXaxoPOAyudPFtaN30OttUsS4VeYzrgtBQH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619444955; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=y2VhKkkE1Bk0Pe9baAUfOAv05aax1hpq201XZkn1xaE=; b=UMLEG5wsb13N3f+lo24f2VR9nTdHyfFKNCoDnVgMihS4an7e72kq4lsYk09amuEaHDSom3blShl18286DMpVhZUQ1KNIF0aNbKF1QrcF/fwBfKGlcrTVDLQ2MCbSoh7BUyNQV2lsT83wd88SOtT2Galk5Xqu23qV2c55XEUjMDc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail 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 16194449550891019.8395865567455; Mon, 26 Apr 2021 06:49:15 -0700 (PDT) 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-193-pAOACgviM4GOXEXpVfm8zQ-1; Mon, 26 Apr 2021 09:49:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C69D107ACC7; Mon, 26 Apr 2021 13:49:04 +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 9EE3B61177; Mon, 26 Apr 2021 13:49:00 +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 932F51806D1A; Mon, 26 Apr 2021 13:48:55 +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 13QDmrDu019686 for ; Mon, 26 Apr 2021 09:48:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 66C721111C83; Mon, 26 Apr 2021 13:48:53 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6270A1111C85 for ; Mon, 26 Apr 2021 13:48:50 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4700DA28805 for ; Mon, 26 Apr 2021 13:48:50 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-VPYvstNHNxGjjzl-K-gzwA-1; Mon, 26 Apr 2021 09:48:46 -0400 Received: from dggeml715-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FTQkf6h69zYb9g for ; Mon, 26 Apr 2021 21:30:34 +0800 (CST) Received: from dggema763-chm.china.huawei.com (10.1.198.205) by dggeml715-chm.china.huawei.com (10.3.17.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 26 Apr 2021 21:32:50 +0800 Received: from dggema769-chm.china.huawei.com (10.1.198.211) by dggema763-chm.china.huawei.com (10.1.198.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 26 Apr 2021 21:32:50 +0800 Received: from dggema769-chm.china.huawei.com ([10.9.128.71]) by dggema769-chm.china.huawei.com ([10.9.128.71]) with mapi id 15.01.2176.012; Mon, 26 Apr 2021 21:32:49 +0800 X-MC-Unique: pAOACgviM4GOXEXpVfm8zQ-1 X-MC-Unique: VPYvstNHNxGjjzl-K-gzwA-1 From: "Yanzheng (A)" To: "libvir-list@redhat.com" Subject: [libvirt] how about add a new API for set display parameters Thread-Topic: [libvirt] how about add a new API for set display parameters Thread-Index: Adc6n9VoxerJ97KpQXWkXYQfO/7BXg== Date: Mon, 26 Apr 2021 13:32:49 +0000 Message-ID: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.149.69] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: "Zhangbo \(Oscar\)" , "Wangxin \(Alexander\)" , "Wangjing \(Hogan, Cloud Infrastructure Service Product Dept.\)" , "hexiaoyu \(A\)" 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.12 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-Language: zh-CN Content-Type: multipart/alternative; boundary="_000_e848dc045eba4039ad34922cb55fb748huaweicom_" --_000_e848dc045eba4039ad34922cb55fb748huaweicom_ Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Hi team, struct _virHypervisorDriver now have more than 260 APIs to management vario= us hypervisor drivers, including hardware resources and lifecycle, etc. But, there is no API for (re)set display devices and its parameters. Take the following uses the QEMU driver as an example. To update the VNC TLS certificates without restart virtual machine, run the= following command: {"execute": "display-reload", "arguments":{"type": "vnc", "tls-certs": true= }} Refers: https://gitlab.com/qemu-project/qemu/-/commit/9cc07651655ee86eca410= 59f5ead8c4e5607c734 Can we add a new libvirt API to set the hypervisor driver display configura= tions ? If the committer team thinks it's worth doing, I can submit patches to impl= ement the function. e,g. The preceding QMP commands 'display-reload' can be encapsulated in this way: index 42c75f6cc5..ab5ae0a3e6 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -13218,3 +13218,16 @@ virDomainStartDirtyRateCalc(virDomainPtr domain, virDispatchError(conn); return -1; } + +int +virDomainSetDisplayParameters(virDomainPtr domain, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + ... + if (conn->driver->domainSetDisplayParameters) { + conn->driver->domainSetDisplayParameters(domain, params, nparams,= flags); + } + ... +} index d642af8a37..197da82556 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1410,6 +1410,12 @@ typedef int int seconds, unsigned int flags); +typedef int +(*virDrvDomainSetDisplayParameters)(virDomainPtr domain. + virTypedParameterPtr params, + int nparams, + unsigned int flags); + typedef struct _virHypervisorDriver virHypervisorDriver; /** @@ -1676,4 +1682,5 @@ struct _virHypervisorDriver { virDrvDomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet; virDrvDomainGetMessages domainGetMessages; virDrvDomainStartDirtyRateCalc domainStartDirtyRateCalc; + virDrvDomainSetDisplayParameters domainSetDisplayParameters; }; --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20454,6 +20454,21 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, return ret; } +static int +qemuDomainSetDisplayParameters(virDomainPtr domain, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + ... + if (params has 'display-reload') + virDomainQemuMonitorCommand(domain, strJsonCmd, &reply, + VIR_DOMAIN_QEMU_MONITOR_COMMAND_DEFAUL= T); + else if (...) { + /* other display parameters setting */ + } + ... +} static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, @@ -20698,6 +20713,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainAuthorizedSSHKeysSet =3D qemuDomainAuthorizedSSHKeysSet, /* 6.1= 0.0 */ .domainGetMessages =3D qemuDomainGetMessages, /* 7.1.0 */ .domainStartDirtyRateCalc =3D qemuDomainStartDirtyRateCalc, /* 7.2.0 */ + .domainSetDisplayParameters =3D qemuDomainSetDisplayParameters; /* 7.2= .0 */ }; Regards :) --_000_e848dc045eba4039ad34922cb55fb748huaweicom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi team,

 

struct _virHypervisorDriver now= have more than 260 APIs to management various hypervisor drivers,

including hardware resources an= d lifecycle, etc.

But, there is no API for (re)se= t display devices and its parameters.

 

Take the following uses the QEM= U driver as an example.

To update the VNC TLS certifica= tes without restart virtual machine, run the following command:<= /span>

{"execute": "dis= play-reload", "arguments":{"type": "vnc"= , "tls-certs": true}}

Refers: https://gitlab.com/qemu-project/qemu/-/commit/9cc07651655ee86eca41059f5ead8= c4e5607c734

 

Can we add a new libvirt API to= set the hypervisor driver display configurations ?

 

If the committer team thinks it= 's worth doing, I can submit patches to implement the function.<= /span>

 

e,g.

The preceding QMP commands R= 16;display-reload’ can be encapsulated in this way:=

 

index 42c75f6cc5..ab5ae0a3e6 10= 0644

--- a/src/libvirt-domain.c=

+++ b/src/libvirt-d= omain.c

@@ -13218,3 +13218,16 @@ vi= rDomainStartDirtyRateCalc(virDomainPtr domain,

     virDis= patchError(conn);

     return= -1;

}

+

+int

+virDomainSetDisplayParamet= ers(virDomainPtr domain,

+    &n= bsp;            = ;             v= irTypedParameterPtr params,

+    &n= bsp;            &nbs= p;            i= nt nparams,

+    &n= bsp;            = ;             u= nsigned int flags)

+{

+    ...

+    if (con= n->driver->domainSetDisplayParameters) {

+    &n= bsp;    conn->driver->domainSetDisplayParameters(domai= n, params, nparams, flags);

+    }<= /o:p>

+    ...

+}

 

index d642af8a37..197da82556 10= 0644

--- a/src/driver-hypervisor.h

+++ b/src/driver-hy= pervisor.h

@@ -1410,6 +1410,12 @@ type= def int

     &= nbsp;           &nbs= p;            &= nbsp;    int seconds,

     &= nbsp;           &nbs= p;            &= nbsp;    unsigned int flags);

+typedef int

+(*virDrvDomainSetDisplayPa= rameters)(virDomainPtr domain.

+    &n= bsp;            = ;            &n= bsp;  virTypedParameterPtr params,

+    &n= bsp;            = ;            &n= bsp;  int nparams,

+    &n= bsp;            = ;            &n= bsp;  unsigned int flags);

+

typedef struct _virHypervisorDr= iver virHypervisorDriver;

 /**

@@ -1676,4 +1682,5 @@ struc= t _virHypervisorDriver {

     virDrv= DomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet;

     virDrv= DomainGetMessages domainGetMessages;

     virDrv= DomainStartDirtyRateCalc domainStartDirtyRateCalc;

+    virDrvD= omainSetDisplayParameters domainSetDisplayParameters;

};

 

--- a/src/qemu/qemu_driver.c

+++ b/src/qemu/qemu= _driver.c

@@ -20454,6 +20454,21 @@ qe= muDomainStartDirtyRateCalc(virDomainPtr dom,

     return= ret;

}

+static int

+qemuDomainSetDisplayParame= ters(virDomainPtr domain,

+    &n= bsp;            = ;            &n= bsp; virTypedParameterPtr params,

+    &n= bsp;            = ;            &n= bsp; int nparams,

+    &n= bsp;            = ;             &= nbsp;unsigned int flags)

+{

+    ...

+    if (par= ams has 'display-reload')

+     &= nbsp;  virDomainQemuMonitorCommand(domain, strJsonCmd, &reply= ,

+    &n= bsp;            = ;            &n= bsp;      VIR_DOMAIN_QEMU_MONITOR_COMMAND_DEFAULT)= ;

+    else if= (...) {

+    &n= bsp;   /* other display parameters setting */

+    }<= /o:p>

+    ...

+}

 static virHypervisorDrive= r qemuHypervisorDriver =3D {

     .name = =3D QEMU_DRIVER_NAME,

@@ -20698,6 +20713,7 @@ sta= tic virHypervisorDriver qemuHypervisorDriver =3D {

     .domai= nAuthorizedSSHKeysSet =3D qemuDomainAuthorizedSSHKeysSet, /* 6.10.0 */=

     .domai= nGetMessages =3D qemuDomainGetMessages, /* 7.1.0 */

     .domai= nStartDirtyRateCalc =3D qemuDomainStartDirtyRateCalc, /* 7.2.0 */

+    .domain= SetDisplayParameters =3D qemuDomainSetDisplayParameters; /* 7.2.0 */

};

 

Regards :)

--_000_e848dc045eba4039ad34922cb55fb748huaweicom_--