From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id EEA4C1FF176
	for <inbox@lore.proxmox.com>; Fri,  7 Mar 2025 10:59:07 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 48FA617B47;
	Fri,  7 Mar 2025 10:59:01 +0100 (CET)
Message-ID: <b10238dc-987d-4986-8ec2-ca662a91b47c@proxmox.com>
Date: Fri, 7 Mar 2025 10:58:58 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
To: Fiona Ebner <f.ebner@proxmox.com>,
 Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20250306104459.1272297-1-d.csapak@proxmox.com>
 <20250306104459.1272297-6-d.csapak@proxmox.com>
 <66d13c58-cc00-4559-ad78-c37a595f91cc@proxmox.com>
Content-Language: en-US
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <66d13c58-cc00-4559-ad78-c37a595f91cc@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.022 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [machine.pm]
Subject: Re: [pve-devel] [PATCH qemu-server 5/8] machine: incorporate pve
 machine version when pinning windows guests
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>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

On 3/6/25 15:32, Fiona Ebner wrote:
> Am 06.03.25 um 11:44 schrieb Dominik Csapak:
>> When creating or updating guests with ostype windows, we want to pin the
>> machine version to a specific one. Since introduction of that feature,
>> we never bumped the pve machine version, so this was missing.
>>
>> Append the pve machine version if it's not 0 so we don't add that
>> unnecessarily.
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>>   PVE/QemuServer/Machine.pm | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
>> index e3da8e21..ebaf2dcc 100644
>> --- a/PVE/QemuServer/Machine.pm
>> +++ b/PVE/QemuServer/Machine.pm
>> @@ -274,7 +274,17 @@ sub check_and_pin_machine_string {
>>       if (!$machine || $machine =~ m/^(?:pc|q35|virt)$/) {
>>   	# always pin Windows' machine version on create, they get confused too easily
>>   	if (PVE::QemuServer::Helpers::windows_version($ostype)) {
>> -	    $machine_conf->{type} = windows_get_pinned_machine_version($machine);
>> +	    my $kvmversion = PVE::QemuServer::Helpers::kvm_user_version();
>> +	    my $pin_version = get_installed_machine_version($kvmversion);
> 
> Nit: I'd call this $base_version like the argument it's passed-in as.
> It's not necessarily the version that is going to be pinned.

sure>
>> +
>> +	    # pin to the current pveX version to make use of most current features if > 0
>> +	    my $pvever = get_pve_version($kvmversion);
>> +	    if ($pvever > 0) {
>> +		$pin_version .= "+pve$pvever";
>> +	    }
> 
> I feel this logic should go into windows_get_pinned_machine_version()
> itself.
> 

if we'd do that, we'd automatically get the newest pve version for the windows workaround in
get_vm_machine, which is the reverse you suggested IIUC ? (e.g. use pve0 in that case)
and using a parameter to control that seem weird for this one call...

>> +
>> +	    $machine_conf->{type} = windows_get_pinned_machine_version($machine, $pin_version, $kvmversion);
>> +
>>   	    print "pinning machine type to '$machine_conf->{type}' for Windows guest OS\n";
>>   	}
>>       }
> 



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel