From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 39A8561771
 for <pve-devel@pve.proxmox.com>; Thu,  9 Jul 2020 14:30:13 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 27CD512425
 for <pve-devel@pve.proxmox.com>; Thu,  9 Jul 2020 14:29:43 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 52A3F12418
 for <pve-devel@pve.proxmox.com>; Thu,  9 Jul 2020 14:29:40 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1FCA042F94
 for <pve-devel@pve.proxmox.com>; Thu,  9 Jul 2020 14:29:40 +0200 (CEST)
To: PVE development discussion <pve-devel@pve.proxmox.com>,
 Stefan Reiter <s.reiter@proxmox.com>
References: <20200625113541.16684-1-s.reiter@proxmox.com>
 <20200625113541.16684-4-s.reiter@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
Message-ID: <9f2416b1-ab1b-5c42-db06-7abf5ee07a3a@proxmox.com>
Date: Thu, 9 Jul 2020 14:29:38 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.0
MIME-Version: 1.0
In-Reply-To: <20200625113541.16684-4-s.reiter@proxmox.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.000 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 WEIRD_PORT              0.001 Uses non-standard port number for HTTP
Subject: Re: [pve-devel] [PATCH v3 qemu-server 3/3] fix #2671: include CPU
 format in man page again
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 09 Jul 2020 12:30:13 -0000

On 25.06.20 13:35, Stefan Reiter wrote:
> Use the new register_format(3) call to use a validator (instead of a
> parser) for 'pve-(vm-)?cpu-conf'. This way the $cpu_fmt hash can be used for
> generating the documentation, while still applying the same verification
> rules as before.
> 
> Since the function no longer parses but only verifies, the parsing in
> print_cpu_device/get_cpu_options has to go via JSONSchema directly.
> 
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
>  PVE/QemuServer/CPUConfig.pm | 56 ++++++++++++-------------------------
>  1 file changed, 18 insertions(+), 38 deletions(-)
> 
> diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
> index 6250591..8ed898c 100644
> --- a/PVE/QemuServer/CPUConfig.pm
> +++ b/PVE/QemuServer/CPUConfig.pm
> @@ -153,6 +153,7 @@ my $cpu_fmt = {
>      'phys-bits' => {
>  	type => 'string',
>  	format => 'pve-phys-bits',
> +	format_description => '8-64|host',
>  	description => "The physical memory address bits that are reported to"
>  		     . " the guest OS. Should be smaller or equal to the host's."
>  		     . " Set to 'host' to use value from host CPU, but note that"
> @@ -182,57 +183,36 @@ sub parse_phys_bits {
>  
>  # $cpu_fmt describes both the CPU config passed as part of a VM config, as well
>  # as the definition of a custom CPU model. There are some slight differences
> -# though, which we catch in the custom verification function below.
> -PVE::JSONSchema::register_format('pve-cpu-conf', \&parse_cpu_conf_basic);
> -sub parse_cpu_conf_basic {

This method is still used in PVE/QemuMigrate.pm:236 and breaks live-migration with
cpu type = host..