9 Commits
Author SHA1 Message Date
dualfroz b7d36d0eca Describe this repository 2026-10-22 21:06:24 +02:00
dualfroz b77120f913 fix #6184: import: ovf: add CD drives
The OVF parser only looks at disk drives, so the CD drives of a guest
are dropped on import. Appliances shipped as OVA sometimes come with
an ISO image in a CD drive, for example to install the guest on first
boot. Such a guest then does not boot after the import, and the user
is not told about the image at all.

Add the CD drives of the manifest as empty drives on their controller,
after the disks in the boot order, like the ESXi import does. As CD
images cannot be imported, report a referenced image with the existing
'cdrom-image-ignored' warning, so that the import wizard tells the user
to configure the drive in the 'Advanced' tab.

As the address only takes the position on the controller into account,
a CD drive can end up with the address of a disk, for example with a
disk on the first IDE controller and the CD drive on the second one.
Such a CD drive gets the next free address on its bus.

Signed-off-by: Michal Fox <me@dualfroz.com>
2026-10-03 02:00:08 +02:00
dualfroz ab149ea5d1 fix #6405: disks: smart: parse ATA attributes with additional flags
In its brief output format, smartctl prints the attribute flags as six
characters, followed by a seventh one which is a '+' if any other flag
bits are set and a space otherwise, for example:

  5 Reallocated_Sector_Ct   ------+  100   100   050    -    0

The regex for the ATA attributes only accepted exactly six non-space
characters for the flags, so such attribute lines were skipped. For
drives that set those other bits on all attributes, like the SATA SSD
from the bug report, no SMART attributes showed up at all and the
wearout could not be determined either.

Accept an optional '+' after the flags and add the output from the
bug report as test case.

Signed-off-by: Michal Fox <me@dualfroz.com>
2026-10-02 16:56:44 +02:00
dualfroz dc7402d9ff fix #6441: btrfs: fix cloning templates with non-raw disk images
Cloning a template with a disk image that is neither raw nor a
subvolume, for example a qcow2 image, failed on a BTRFS storage with:

  clone failed: Undefined subroutine &PVE::Storage::DirPlugin::clone_image called

For such images, the BTRFS plugin forwards the call to the DirPlugin.
But the DirPlugin does not implement clone_image itself, it inherits it
from the base plugin, and calling it as a plain function does not go
through the inheritance.

Call the implementation of the base plugin directly instead, like it is
already done for create_base.

Fixes: af50c2e ("add BTRFS storage plugin")
Signed-off-by: Michal Fox <me@dualfroz.com>
2026-10-02 16:30:32 +02:00
dualfroz 467e6d641e fix #6389: api: disks: zfs: parse the message of hot spares in use
Hot spares have no error counters in the output of 'zpool status', so a
spare that is in use only has a message after its state:

  nvme10n1      INUSE     currently in use

The parser took the three words of that message as READ, WRITE and
CKSUM counters, so the API returned zero for all of them and lost the
message, while logging warnings like:

  Argument "currently" isn't numeric in addition (+)

As 'zpool status' is called with '-p', the counters are always plain
numbers, so only accept digits for them. This way, the message of a
spare in use ends up in 'msg', like for any other vdev.

Signed-off-by: Michal Fox <me@dualfroz.com>
2026-10-02 16:17:54 +02:00
dualfroz 6320a3a111 fix #6640, #6938: api: disks: zfs: return exact error counters
Without '-p', 'zpool status' shortens the READ, WRITE and CKSUM counters
of a vdev to a value with a unit suffix once they reach 1024, for
example 1130 read errors are shown as '1.10K'. The parser just adds
zero to those values, so the API returned 1.1 read errors in that case
and logged a warning like:

  Argument "1.10K" isn't numeric in addition (+)

Request exact values with '-p'. For the non-JSON output of 'zpool
status' it only affects those counters, the sizes in the scan line stay
human readable.

Signed-off-by: Michal Fox <me@dualfroz.com>
2026-10-02 16:15:39 +02:00
dualfroz ab748c8530 test: add tests for zpool status parsing of the ZFS disk API
The detail call of the ZFS disk API parses the output of 'zpool status'
into the vdev tree of a pool. Add a test for it, which mocks the zpool
command and checks the result for a healthy pool with log, cache and
spare devices, so that fixes for the parser can extend it with their
cases.

Signed-off-by: Michal Fox <me@dualfroz.com>
2026-10-02 16:14:52 +02:00
dualfroz 9f20cd4f75 fix #5998: import: avoid duplicate disk keys with multiple controllers
The disk key is built from the controller type and the address of the
disk on that controller. The address is only unique per controller, so
with more than one controller of the same type, like a VM with more than
16 disks spread over two SCSI controllers, several disks got the same
key. 'qm importovf' then failed with "cowardly refusing to overwrite
existing entry: scsi0", and the import wizard silently dropped all but
one of those disks, as they are stored in a hash by key.

Keep the address for the first disk using it and move any further disk
with the same address to the lowest address of that bus that is not
used by any other disk.

Add a test manifest with a second SCSI controller.

Signed-off-by: Michal Fox <me@dualfroz.com>
2026-09-25 11:38:19 +02:00
dualfroz 43d4bbbdb2 fix #6969: plugin: keep content directory when freeing its last file
After removing a volume, free_image tries to remove the parent
directory, so that no empty per-guest directories are left behind once
all images of a guest are gone. This was done unconditionally, so
deleting the last ISO, container template, snippet or import file also
removed the shared content directory like 'snippets' or 'template/iso'.

The directory gets re-created shortly after by pvestatd, but as
root:root with default permissions, losing any ownership or mode that
the admin set up, for example to allow a non-root user to upload
snippets.

Only clean up the parent directory for guest images, which are the only
volumes stored in per-guest directories.

Signed-off-by: Michal Fox <me@dualfroz.com>
2026-09-25 11:30:43 +02:00