Commit graph

3680 commits

Author SHA1 Message Date
Wolfgang Bumiller
6481e92e94 adapt to volume_support_qemu_snapshot -> volume_qemu_snapshot_method
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2025-07-16 15:34:31 +02:00
Wolfgang Bumiller
0e2b084e00 blockdev: pass correct parameters to generate_file_blockdev()
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2025-07-16 14:28:16 +02:00
Alexandre Derumier
2b41a4767f blockdev_external_snapshot: rework to avoid $running param
the new workflow is:

1)
PVE::Storage::volume_snapshot: rename the current to snap
                               + allocate the new current with snap backing

(the qemu process have still the inode opened)

2) replace the current to snap in the blockdev graph with reopen

3) add a new current blockdev

3) use block-snapshot to replace the active image with the new current blockdev
   with the qemu

also:

move PVE::Storage::volume_rename outside blockdev_replace,
and rename 'blockdev_rename()' to 'blockdev_replace()'.
as we only replace/reopen the blockdev nodes now.

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
2025-07-16 14:26:43 +02:00
Alexandre Derumier
7a87ec62ac generate_backing_blockdev: use current_sub for private recursive
Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
2025-07-16 14:26:41 +02:00
Alexandre Derumier
82822d100b blockdev_rename: remove old left-over rename()
Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
2025-07-16 14:26:38 +02:00
Alexandre Derumier
019f375de7 api2: move_disk: use parse_volname to find old volume format
Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
2025-07-16 14:26:21 +02:00
Alexandre Derumier
674d3c9464 tests: fix efi vm-disk-100-0.raw -> vm-100-disk-0.raw
not sure if it was an error, but it's failing now with new more
restricted volname parsing

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
2025-07-16 14:25:38 +02:00
Alexandre Derumier
d816c91299 qcow2: add external snapshot support
fixme:
 - add test for internal (was missing) && external qemu snapshots
 - is it possible to use blockjob transactions for commit && steam
   for atomatic disk commit ?

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
2025-07-16 14:25:35 +02:00
Alexandre Derumier
3af47a6add blockdev: add backing_chain support
We need to define name-nodes for all backing chain images,
to be able to live rename them with blockdev-reopen

For linked clone, we don't need to definebase image(s) chain.
They are auto added with #block nodename.

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
2025-07-16 14:25:33 +02:00
Alexandre Derumier
d7e26ecfac qemu_img convert : add external snapshot support
for external snapshot, we simply use snap volname as src.
don't use internal snapshot option in the command line.

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
2025-07-16 14:25:30 +02:00
Fiona Ebner
6223caf16f fix #6466: aarch64: pci: properly print higher-index PCI bridge addresses
For aarch64, the virt machine has an initial pcie.0 bus. The other pci
bridges that get added on top are called pci.N, see the relevant
section in config_to_command() which adds them.

In particular this fixes adding an RNG device, which is require for
OVMF PXE boot.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250618152009.120524-4-f.ebner@proxmox.com
2025-07-15 19:14:25 +02:00
Thomas Lamprecht
a8417c5611 d/control: require libpve-common-perl >= 9.0.3
To ensure the normalize_pci_id method from sysfs tools we now use is
available.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-07-10 13:25:32 +02:00
Dominik Csapak
6c0cce85ac fix #6400: pci: allow other pci domains than 0000 for NVIDIA vGPUs
when creating or cleaning up NVIDIA vGPUs, we mistakenly assumed a
PCI domain of 0000, but this might be different.

Use 'normalize_pci_id' from PVE::SysFSTools, which handles this already
correctly.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Link: https://lore.proxmox.com/20250704061852.251189-3-d.csapak@proxmox.com
2025-07-10 13:19:15 +02:00
Thomas Lamprecht
343e05f0ba re-tidy perl source code with correct perltidy version
had an older version installed on a dev VM that still had some issues
with not honoring the mft option correctly, resulting in multiple
params perl line even though the params got wrapped already.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-07-08 08:13:08 +02:00
Fabian Grünbichler
e72684d6c3 bump version to 9.0.1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-07-03 14:48:57 +02:00
Stefan Hanreich
bed6bf99ec net: use pve-firewall helper for deciding whether to create fw bridges
pve-firewall introduced a new helper for deciding whether to create a
firewall bridge for a given tap interface. In addition to checking for
nftables, it also checks for the type of the bridge. This fixes an
issue with OVS and the nftables firewall, where firewall bridges are
still required in order for the guest firewall to work and the new
helper in pve-firewall checks for that condition now.

Previously, only the vm network script checked the condition for
creating a firewall bridge properly, but not the function for
hotplugging VM network devices. This caused a firewall bridge to
always get created when hotplugging a network device. The additional
firewall bridge had no influence on the functionality of nftables, but
was unnecessary.

For that matter a helper in qemu-server is introduced that should be
used by all call sites.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
FG: adapted context slightly
FG: bump versioned dependency
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-07-03 14:48:57 +02:00
Fiona Ebner
e4af05c62a blockdev: pass along machine version to storage layer
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
f5fc943c07 partially fix #3227: ensure that target image for mirror has the same size for EFI disks
When the format is raw, the size can be explicitly passed. When the
format is a container format like qcow2, the image should already be
allocated with the correct virtual size.

It is not possible to resize a disk with an explicit 'size' set, so
only set this for EFI disks.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
82391f066b test: migration: update running machine to 10.0
In particular, this also means that (mocked) blockdev_mirror() will be
used.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
aaf48d8e5a command line: switch to blockdev starting with machine version 10.0
Co-developed-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
b2f9e75bf9 live import/restore: use Blockdev::detach helper
Which also catches scenarios where the block node is already gone,
which can happen with -blockdev.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
6f167d5cfc live import/restore: query which node to use for operation
In preparation for the switch to -blockdev.

Otherwise, there would be an error:
> An error occurred during live-restore: VM 103 qmp command
> 'block-stream' failed - Permission conflict on node
> 'a25d9b2028b5a364dddbb033603b68c': permissions 'write' are both
> required by node 'drive-ide0' (uses node
> 'a25d9b2028b5a364dddbb033603b68c' as 'file' child) and unshared
> by stream job 'restore-drive-ide0' (uses node
> 'a25d9b2028b5a364dddbb033603b68c' as 'intermediate node' child).

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
5a7fc4409d live import: also record volid information
Will be required for generating the blockdev starting with machine
version 10.0.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
3f8c946b38 blockdev: support alloc-track driver for live-{import, restore}
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
418e5524a1 blockdev: add helper to generate PBS block device for live restore
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
3fee3186a2 blockdev: add support for NBD paths
Co-developed-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
1ffedb2cc0 print drive device: don't reference any drive for 'none' starting with machine version 10.0
There will be no block node for 'none' after switching to '-blockdev'.

[FE: split out from larger patch
     do it also for non-SCSI cases]

Co-developed-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
87861034db clone disk: skip check for aio=default (io_uring) compatibility starting with machine version 10.0
With blockdev-mirror, it is possible to change the aio setting on the
fly and this is useful for migrations between storages where one wants
to use io_uring by default and the other doesn't.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
0b6229f5cd blockdev: move helper for configuring throttle limits to module
Replace the deprecated check_running() call while at it.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
5344463c59 blockdev: add blockdev_change_medium() helper
The new helper will be used after the switch to blockdev starting with
machine version 10.0.

Co-developed-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
59e01f1d44 blockdev: add change_medium() helper
There is a slight change in behavior for cloud-init disks, when the
file for the new cloud-init disk is 'none'. Previously, the current
drive would not be ejected, now it is. Not sure if that edge case can
even happen in practice and it is more correct, becuase the config was
already updated.

Co-developed-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
1da911757c block job: add blockdev mirror
With blockdev-mirror, it is possible to change the aio setting on the
fly and this is useful for migrations between storages where one wants
to use io_uring by default and the other doesn't.

The node below the top throttle node needs to be replaced so that the
limits stay intact and that the top node still has the drive ID as the
node name. That node is not necessarily a format node. For example, it
could also be a zeroinit node from an earlier mirror operation. So
query QEMU itself.

QEMU automatically drops nodes after mirror only if they were
implicitly added, i.e. not explicitly added via blockdev-add. Since a
previous mirror target is explicitly added (and not just implicitly as
the child of a top throttle node), it is necessary to detach the
appropriate block node after mirror.

Already mock blockdev_mirror in the tests.

Co-developed-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
404c0860a1 block job: allow specifying a block node that should be detached upon completion
In preparation for blockdev-mirror, where the node that is not used
anymore (either source when switching to target, or otherwise target)
needs to be detached.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
41077113cc blockdev: add 'no-throttle' option to skip generationg throttle top node
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
8c627ccdc8 blockdev: make some functions private
Callers outside the module should only use generate_drive_blockdev()
and specific functionality should be controlled via the $options
parameter.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
39867932ec blockdev: support using zeroinit filter
The zeroinit filter is used for cloning/mirroring and importing with
target volumes that are known to produce zeros when reading parts that
were not written before and can be helpful for performance.

Since it is the target of the mirror, it won't have a 'throttle' node
associated with it, but be added as a top node itself. Therefore, it
requires an explicit node-name.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
d8de36c992 blockdev: resize: query and use node name for resize operation
This also works for -blockdev, which will be used instead of -drive
starting with machine version 10.0.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
d2efc5074c blockdev: add helper to get node below throttle node
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
61efcc5556 blockdev: move helper for resize into module
And replace the deprecated check_running() call while at it.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
384edceb02 blockdev: introduce and use get_block_info() helper
When querying the block info, with -blockdev, it is necessary to look
at the 'qdev' property of the QMP result, because the 'device'
property is not initialized. See also commit 9af3ef69 ("vm devices
list: prepare querying block device names for -blockdev").

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
fb7d2c5509 blockdev: introduce qdev_id_to_drive_id() helper
To be re-used by users of the query-block QMP command. With -blockdev,
the 'device' property is not initialized. See also commit 9af3ef69
("vm devices list: prepare querying block device names for -blockdev")
for context.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
439f6e2a1d backup: use blockdev for TPM state file
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
f92c1fa0f3 backup: use blockdev for fleecing images
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
faecc35136 blockdev: add missing include for JSON module
Fixes: f2f2edcd ("blockdev: add workaround for issue #3229")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
f31d954df1 blockdev: add helpers for attaching and detaching block devices
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
0077e5b85d blockdev: introduce top_node_name() and parse_top_node_name() helpers
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
4039276389 blockdev: add and use throttle_group_id() helper
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
3cc4d826a0 drive: drop invalid export of get_scsi_devicetype
The function is called 'get_scsi_device_type' and all callers already
use the full package prefix to call it.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
e2dea8ee27 drive: add helper to parse drive interface
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00
Fiona Ebner
f3a3e0e75f test: collect mocked functions for QemuServer module
Also order them alphabetically.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-07-03 10:46:44 +02:00