From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 82B101FF12C for ; Wed, 05 Aug 2026 10:22:02 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 403D521833; Wed, 05 Aug 2026 10:21:42 +0200 (CEST) From: Thomas Ellmenreich To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 0/3] refactor of volume_id classification Date: Wed, 5 Aug 2026 10:21:19 +0200 Message-ID: <20260805082122.43184-1-t.ellmenreich@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: 1785918082984 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.332 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_ASCII_DIVIDERS 0.8 Email that uses ascii formatting dividers and possible spam tricks KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low 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: PIMLGGJTI47TG4MNUQANON4XYG3NREMT X-Message-ID-Hash: PIMLGGJTI47TG4MNUQANON4XYG3NREMT X-MailFrom: t.ellmenreich@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 CC: Thomas Ellmenreich X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Refactor of volume_id classification ==================================== While developing this: [0] patch series, I refactored all the checks for disk files as absolute paths into their own subroutine. The original series was then dropped in favour of a quicker fix: [1]. This series revives the refactor without the fix and, unlike the original series creates a new classify_drive_file subroutine, as @Fiona Ebener mentioned here: [2]. Overview -------- As previously mentioned, a new classify_drive_file subroutine has been introduced, which can then be used to determine the type of disk file. This type can be one of: > 'none', 'cdrom', 'absolute', 'volume' and in the case of > classification failure: 'unknown' Other Small changes ------------------- In the light of this small refactoring, 2 other small changes crept in. (1) First, one to move the definitions and registration of 2 drive related subroutines to the QemuServer::Drive submodule. Then (2), the removal of a couple of undef checks for volids which are no longer necessary. These changes have been placed in their own patches to be easily reverted. Changes since v1 (thanks @Elias) -------------------------------- - Instead of mixing double quotes (") and single quotes (') the 'classify_drive_file' function now only uses single quotes. - Since returning undef for 'classify_drive_file' could lead to unnessesary undef checking when comparing to expected values to avoid warnings, the subroutine now returns 'unknown' in the case of a failed classification. Changes since RFC (thanks @Max, @Fiona) --------------------------------------- - moved the classification subroutine out of PVE::Storage and into PVE::QemuServer::Drive - Rewrite of the subroutine with the following changes: - does not throw errors anymore, only returns undef if classification fails - renamed to 'classify_drive_file' - before, undef led to it being classified as 'none' which now also just returns undef - moved the registration of 'verify_volume_id_or_(absolute_path/qm_path)' from QemuServer to QemuServer::Drive - reintroduced the removal of some unnecessary undef checks as a separate patch [0]: https://lore.proxmox.com/pve-devel/20260722095251.89606-1-t.ellmenreich@proxmox.com/T/#t [1]: https://lore.proxmox.com/pve-devel/20260724081611.11254-1-f.ebner@proxmox.com/ [2]: https://lore.proxmox.com/pve-devel/0b4272e1-3634-4fdd-b79f-6b077dd387d5@proxmox.com/ qemu-manager: Thomas Ellmenreich (3): move verify_volume_id_or_* format registrations into Drive submodule add new classify_drive_file utility removed some unnecessary undef checks. src/PVE/QemuServer.pm | 63 +++++++++++-------------------------- src/PVE/QemuServer/Drive.pm | 53 +++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 44 deletions(-) Summary over all repositories: 2 files changed, 72 insertions(+), 44 deletions(-) -- Generated by murpp 0.12.0