public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH qemu-server v2 0/3] refactor of volume_id classification
@ 2026-08-05  8:21 Thomas Ellmenreich
  2026-08-05  8:21 ` [PATCH qemu-server v2 1/3] move verify_volume_id_or_* format registrations into Drive submodule Thomas Ellmenreich
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Ellmenreich @ 2026-08-05  8:21 UTC (permalink / raw)
  To: pve-devel; +Cc: Thomas Ellmenreich

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-05  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05  8:21 [PATCH qemu-server v2 0/3] refactor of volume_id classification Thomas Ellmenreich
2026-08-05  8:21 ` [PATCH qemu-server v2 1/3] move verify_volume_id_or_* format registrations into Drive submodule Thomas Ellmenreich
2026-08-05  8:21 ` [PATCH qemu-server v2 2/3] add new classify_drive_file utility Thomas Ellmenreich
2026-08-05  8:21 ` [PATCH qemu-server v2 3/3] removed some unnecessary undef checks Thomas Ellmenreich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal