From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 76BB31FF190 for ; Fri, 10 Jan 2025 18:06:28 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4DA77549; Fri, 10 Jan 2025 18:06:12 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Date: Fri, 10 Jan 2025 18:05:32 +0100 Message-Id: <20250110170532.204262-1-d.kral@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.011 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 Subject: [pve-devel] [PATCH qemu-server] api: create disks: also convert tpmstate and efidisk to base image for templates X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" The commit 37a1f42a introduced a conversion step for newly allocated volume disks to base volumes for VM templates. This wrongly excluded efidisk and tmpstate volumes from this conversion, even though those should be converted to base volumes too. Therefore, include efidisks and tpmstate volumes to be converted to base volumes when newly allocating them. Suggested-by: Fiona Ebner Fixes: 37a1f42a ("fix #5301: convert added volume disks to base images for templates") Signed-off-by: Daniel Kral --- I tested these changes in the same way as the patch, which introduced this behavior [0] with the small obvious change, that efidisk0 and tpmstate0 should now be converted to base volume images instead as well: ``` 55,56c55,56 < test_qmset "efidisk0" "$TEST_STORAGE:1,efitype=4m,pre-enrolled-keys=1" "base" < test_qmset "tpmstate0" "$TEST_STORAGE:1,version=v2.0" "base" --- > test_qmset "efidisk0" "$TEST_STORAGE:1,efitype=4m,pre-enrolled-keys=1" "vm" > test_qmset "tpmstate0" "$TEST_STORAGE:1,version=v2.0" "vm" ``` [0] https://lore.proxmox.com/pve-devel/20241017115124.75539-3-d.kral@proxmox.com/ PVE/API2/Qemu.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index db356b7e..8392400e 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -554,11 +554,12 @@ my sub create_disks : prototype($$$$$$$$$$$) { $volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, "raw", undef, $size); } else { $volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $fmt, undef, $size); - - # change created disk to a base volume in case the VM is a template - $volid = PVE::Storage::vdisk_create_base($storecfg, $volid) - if PVE::QemuConfig->is_template($conf); } + + # change created disk to a base volume in case the VM is a template + $volid = PVE::Storage::vdisk_create_base($storecfg, $volid) + if PVE::QemuConfig->is_template($conf); + push @$vollist, $volid; $disk->{file} = $volid; $disk->{size} = PVE::Tools::convert_size($size, 'kb' => 'b'); -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel