From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 9AA2F1FF0B4 for ; Fri, 27 Nov 2026 14:47:11 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B01E3217A3; Fri, 27 Nov 2026 14:46:46 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH-SERIES qemu-server 00/10] restore: check permissions up-front Date: Fri, 27 Nov 2026 14:45:24 +0100 Message-ID: <20261127134637.140854-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795787200444 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.245 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) 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 Message-ID-Hash: UOZKPMH76JQPYB4XQYXLODKEPRWL6DCG X-Message-ID-Hash: UOZKPMH76JQPYB4XQYXLODKEPRWL6DCG X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Patch 01/10 is a code cleanup. Patch 02/10 is a small improvement, skipping all non-main config sections. Patches 03/10 to 07/10 create the restore module and move functions to it. Patches 08/10 to 10/10 move the permission checks up to the beginning of the restore. There is already an early permission check with the extracted configuration, but that is marked as "best-effort" and can race with something modifies the configuration in the meantime. Check for the configuration actually used by restore if the user has the necessary permissions before destroying the old configuration and restoring all drives which might take a long time. I had forgotten that we also have the early check, so this is less relevant than I initially thought, but I still think it's nice to have. Improves modularity and shaves off 230 lines of QemuServer.pm. Allows extracting a common helper for preparing the new configuration to avoid some duplication. It cannot be moved into the new Restore module, since it depends on parse_vm_config(). qemu-server: Fiona Ebner (10): restore: vma: rename variable for storage configuration restore: skip non-main config sections restore: introduce dedicated module restore: move helper for cleaning up target to module restore: move helper for parsing backup device hints to module restore: move helpers to deactivate and destroy volumes to module restore: move helpers to check identity and write config to module restore: check permissions up-front restore: extract common helper for preparing new configuration restore: prepare new config before modifying the target src/PVE/API2/Qemu.pm | 5 +- src/PVE/QemuServer.pm | 442 ++++++---------------- src/PVE/QemuServer/Makefile | 1 + src/PVE/QemuServer/Restore.pm | 247 ++++++++++++ src/test/restore-config-expected/160.conf | 6 +- src/test/restore-config-input/160.conf | 2 +- src/test/run_qemu_restore_config_tests.pl | 70 +++- 7 files changed, 415 insertions(+), 358 deletions(-) create mode 100644 src/PVE/QemuServer/Restore.pm Summary over all repositories: 7 files changed, 415 insertions(+), 358 deletions(-) -- Generated by git-murpp 0.5.0