Commit Graph

3507 Commits

Author SHA1 Message Date
Fiona Ebner
cc4a8b81ce backup: implement restore for external providers
First, the provider is asked about what restore mechanism to use.
Currently, only 'qemu-img' is possible. Then the configuration files
are restored, the provider gives information about volumes contained
in the backup and finally the volumes are restored via
'qemu-img convert'.

The code for the restore_external_archive() function was copied and
adapted from the restore_proxmox_backup_archive() function. Together
with restore_vma_archive() it seems sensible to extract the common
parts and use a dedicated module for restore code.

The parse_restore_archive() helper was renamed, because it's not just
parsing.

While currently, the format for the source can only be raw, do an
untrusted check for the source for future-proofing. Still serves as a
basic sanity check currently.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
[WB: fix 'bwlimit' typo]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-18-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Fiona Ebner
ebaf90d61c image convert: allow caller to specify the format of the source path
In preparation for the restore API for backup providers that doesn't
want detection based on the file extension but always requires raw.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-17-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Fiona Ebner
d5d3501a0b image convert: collect options in hash argument
In preparation to add another option and to improve style for the
callers.

One of the test cases that specified $is_zero_initialized is for a
non-existent storage, so the option was not added there.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-16-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Fiona Ebner
2973783125 test: qemu img convert: add test cases for snapshots
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-15-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Fiona Ebner
98209f99a1 backup: implement backup for external providers
The state of the VM's disk images at the time the backup is started is
preserved via a snapshot-access block node. Old data is moved to the
fleecing image when new guest writes come in. The snapshot-access
block node, as well as the associated bitmap in case of incremental
backup, will be made available to the external provider. They are
exported via NBD and for 'nbd' mechanism, the NBD socket path is
passed to the provider, while for 'file-handle' mechanism, the NBD
export is made accessible via a file handle and the bitmap information
is made available via a $next_dirty_region->() function. For
'file-handle', the 'nbdinfo' and 'nbdfuse' binaries are required.

The provider can indicate that it wants to do an incremental backup by
returning the bitmap ID that was used for a previous backup and it
will then be told if the bitmap was newly created (either first backup
or old bitmap was invalid) or if the bitmap can be reused.

The provider then reads the parts of the NBD or virtual file it needs,
either the full disk for full backup, or the dirty parts according to
the bitmap for incremental backup. The bitmap has to be respected,
reads to other parts of the image will return an error. After backing
up each part of the disk, it should be discarded in the export to
avoid unnecessary space usage in the fleecing image (requires the
storage underlying the fleecing image to support discard too).

[WB: - instead of backup_vm_available_bitmaps call
       backup_vm_query_incremental, which provides a bitmap-mode
       instead, pass this along and use just the storage id as bitmap
       name]
[FE: Move construction of $devices parameter to after sizes are
     available. They were undef before.
     Adapt to changed backup-access QMP interface not requiring an
     explicit bitmap name anymore.]

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-14-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Fiona Ebner
2ba39f3251 backup: allow adding fleecing images also for EFI and TPM
For the external backup API, it will be necessary to add a fleecing
image even for small disks like EFI and TPM, because there is no other
place the old data could be copied to when a new guest write comes in.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-13-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Fiona Ebner
6c7e74c9d0 backup: fleecing: use exact size when allocating non-raw fleecing images
A non-1KiB aligned source image could cause issues when used with
qcow2 fleecing images, e.g. for an image with size 4.5 KiB:
> Size mismatch for 'drive-tpmstate0-backup-fleecing' - sector count 10 != 9

Raw images are attached to QEMU with an explicit 'size' argument, so
rounding up before allocation doesn't matter, but it does for qcow2.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-12-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Fiona Ebner
9891d05a97 backup: keep track of block-node size for fleecing
For fleecing, the size needs to match exactly what QEMU sees. In
particular, EFI disks might be attached with a 'size=' option, meaning
that size can be different from the volume's size. Commit 36377acf
("backup: disk info: also keep track of size") introduced size
tracking and it was used for fleecing since then, but the accurate
size information needs to be queried via QMP.

Should also help with the following issue reported in the community
forum:
https://forum.proxmox.com/threads/152202

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-11-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Thomas Lamprecht
f289e04cbf pve machine versions: unify information into single hash and rework use sites
It's a bit nicer to avoid multiple hashes, this keeps the information
also closer together, albeit that alone wasn't the reason for doing
this because this (hopefully) will never grow that big, rather it
should encourage adding changes entries until we test for that and it
also makes handling these entries a tiny bit more natural as no
wrapper counter for-loops doing integer string interpolation are
required.

While at it expand the comment, might be even a tad to verbose now,
and add a new helper to get these per-machine revisions.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:11:21 +02:00
Thomas Lamprecht
e0095011a7 api: machine versions: avoid pushing to array if new one is created anyway
Avoid pushing our array of downstream revisions to the array of
upstream machines if we create completely new array on return anyway,
just let sort iterate over both arrays instead.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:09:40 +02:00
Thomas Lamprecht
cc5dc71a7a api: machine versions: rename description property to changes
Should better denote what this is about, the schema description called
it that already anyway. Avoid using a pve specific property name in
case we add some changes for the upstream revisions in the future.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Dominik Csapak
9c419d83dd api: qemu machine capabilities: add description for pveX variants
and retroactively add descriptions for previous bumps.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Link: https://lore.proxmox.com/20250404125345.3244659-9-d.csapak@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Dominik Csapak
71f2307eaf api: qemu machine capabilities: add custom pveX versions
Add the pveX variants (where X > 0) to the list too, so one knows they
exits. Also this allows them to be shown and chosen in the UI.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Link: https://lore.proxmox.com/20250404125345.3244659-8-d.csapak@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Dominik Csapak
57db7085b8 machine: bump pve machine version and reverse the s3/s4 defaults
So new guests, or guests with the 'latest' machine type, have that
setting automatically disabled.

The previous default (enabling S3/S4), does not make too much sense in
a virtual environment, and sometimes makes problems, e.g. Windows
defaults to using 'hybrid shutdown' and 'fast startup' when S4 is
enabled, which leads to NVIDIA vGPU being broken on the boot after
that.

Since the tests don't pin the pve version themselves, we have to
update all the ones where the machine versions are derived from the
installed QEMU version.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Link: https://lore.proxmox.com/20250404125345.3244659-7-d.csapak@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Dominik Csapak
80ddee39a5 config: add S3/S4 power state properties to machine option
So users can disable them, as they're enabled by default in QEMU.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Link: https://lore.proxmox.com/20250404125345.3244659-6-d.csapak@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Dominik Csapak
1d4da507b3 machine: incorporate pve machine version when pinning windows guests
When creating or updating guests with OS type windows, we want to pin
the machine version to a specific one. Since introduction of that
feature, we never bumped the pve machine version, so this was missing.

Append the pve machine version only if it's not 0 so we don't add that
unnecessarily.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Link: https://lore.proxmox.com/20250404125345.3244659-5-d.csapak@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Dominik Csapak
3f589e8c7e machine: correctly select pve machine version for non pinned windows guests
When we don't have a specific machine version on a windows guest, we
use the creation meta info to pin the machine version. Currently we
always append the pve machine version from the current installed KVM
version, which is not necessarily the version we pinned the guest to.

Instead, use the same mechanism as for normal version pinned machines,
which use 'pve0'.

For non-windows machines, we use the current QEMU machine version so
we should use the pve machine version from that too, so that stays the
same.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Link: https://lore.proxmox.com/20250404125345.3244659-4-d.csapak@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Dominik Csapak
bafc9f4187 config to command: get rid of globalFlags
We only have one place where we use it, so add the global flag inline,
instead of collecting and doing it at the end. This makes it
consistent with our other places where we need '-global' flags.

Adapt the tests, since that global flag changes place, the resulting
qemu hardware should be identical, since qemu handles all global flags
at the same time.

Tested live migration of a VM with such a flag from a node running the
old code to a node node running this new one and it worked without
problems.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Link: https://lore.proxmox.com/20250404125345.3244659-3-d.csapak@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Dominik Csapak
7e01d6cf70 tests: cfg2cmd: add test for windows machine pinning from meta info
so we test that logic at least once.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Link: https://lore.proxmox.com/all/20250404125345.3244659-2-d.csapak@proxmox.com/
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 19:08:31 +02:00
Friedrich Weber
481eca69dc api: require explicit media=cdrom for drives with attached ISO image
When starting a VM, drives with an attached ISO image require an
explicit `media` parameter. Setting `media=disk` on such drives makes
them writable. This breaks the user expectation that ISO images are
immutable.

Hence, require an explicit `media=cdrom` parameter on VM updates via
the API for drives that have a volume with type `iso` attached. If
some users rely on the ability to set `media=disk` on such drives, we
may make this available in the future (and require high privileges).
Until then, affected users can manually edit the VM config.

Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2025-04-04 15:41:54 +02:00
Friedrich Weber
2e2f8cb7a3 print drive commandline: die if drive with ISO sets no explicit media
The `media` option defaults to `disk` if not present, which attaches
the drive read-write. This can be unexpected for ISO volumes. Hence,
when constructing the QEMU command line, require that drives with ISO
volumes explicitly set `media` and die if this is not the case.

This breaks VM start and live-migration if such a drive is present,
and hotplug for such drives. Users can fix this by editing the VM
config to set `media` explicitly.

Also add a cfg2cmd test for the error.

Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2025-04-04 15:41:54 +02:00
Filip Schauer
6a956f8604 allow non-root users to set /dev/hwrng as an RNG source
Allow users with the Mapping.Use privilege on the /mapping/hwrng path to
configure /dev/hwrng as an entropy source for VirtIO RNG devices.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2025-04-04 10:25:33 +02:00
Filip Schauer
b2a0b6b1f0 allow non-root users to set /dev/u?random as an RNG source
Allow non-root users with the VM.Config.HWType privilege to configure
/dev/urandom & /dev/random as an entropy source for a VirtIO RNG device.
/dev/hwrng remains restricted to the root user.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2025-04-04 10:25:33 +02:00
Filip Schauer
4040caa8f3 refactor: check_mapping_access: move root user check to the top
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2025-04-04 10:25:33 +02:00
Filip Schauer
6b192cb536 add helpers for VirtIO RNG command line arguments
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2025-04-04 10:25:33 +02:00
Filip Schauer
18fc321ef3 refactor: move rng related code into its own module
Move code related to VirtIO RNG configuration for a VM to its own
module.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2025-04-04 10:25:33 +02:00
Filip Schauer
83cf49aa36 remove outdated /dev/random entropy-starvation warnings
Remove mentions about entropy-starvation, when using /dev/random as the
entropy source, from the descriptions of the rng parameters. This
concern no longer applies since the removal of the blocking entropy pool
in kernel version 5.6. [1] [2]

[1] https://git.kernel.org/torvalds/c/acd77500aa8a337baa6d853568c4b55aca48e20f
[2] https://lwn.net/Articles/808575/

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2025-04-04 10:20:55 +02:00
Thomas Lamprecht
96b35eadac tests: cfg2cmd: add very basic SEV tests
Might be good if the configs would get some variation, but should be
better than nothing.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 21:44:15 +02:00
Thomas Lamprecht
35c43e84a9 tests: cfg2cmd: mock get_hw_capabilities to allow testing SEV
Allow tests to declare either a raw HW capabilities string as our
minitool produces or refer to a predefined CPU series, for now that's
only 'amd-turin-9005' which I pulled of a modern AMD EPYC 9475F based
host.

If nothing is set then default to a very barebones HW capability set.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 21:41:43 +02:00
Thomas Lamprecht
e47cc3b935 d/control: bump versioned dependency for pve-edk2-firmware-ovmf
To ensure the new Confidential VM (CVM) images that got the Secure
Management Mode (SMM) disabled are available.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 21:23:20 +02:00
Thomas Lamprecht
57bc05f7df cpu config: sev type: small code style fix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 20:55:12 +02:00
Thomas Lamprecht
b6d98e13f5 vm start: log task warning if both SEV-SNP and efidisk are configured
Make it more noticeable if a efidisk will be ignored, as this means
one changed a existing VM that already had a efidisk entry to SEV-SNP,
as adding an efidisk for such VMs with SEV-SNP enabled is blocked.

While at it fix indentation and drop the duplicated $arch variable,
that's already declared as required here at the top of the method.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 20:51:27 +02:00
Thomas Lamprecht
d4c0d1e768 ovmf: style nit for SEV error with OVMF pflash
s/flash/pflash/ and separate by an empty line for readability.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 20:47:57 +02:00
Philipp Giersfeld
135270e7e7 config: add AMD SEV-SNP support.
This patch is for enabling AMD SEV-SNP support.

Where applicable, it extends support for existing SEV(-ES) variables
to SEV-SNP. This means that it retains no-debug and kernel-hashes
options, but the no-key-sharing option is removed.

The default policy value is identical to QEMU’s, and the therefore
required option has been added to configure SMT support.

The code was tested by running a VM without SEV, with SEV, SEV-ES,
SEV-SNP. Each configuration was tested with and without an EFI disk
attached. For SEV-enabled configurations it was also verified that the
kernel actually used the respective feature.

Signed-off-by: Philipp Giersfeld <philipp.giersfeld@canarybit.eu>
Tested-by: Markus Frank <m.frank@proxmox.com>
Reviewed-by: Markus Frank <m.frank@proxmox.com>
2025-04-03 20:31:37 +02:00
Philipp Giersfeld
d8594cf594 Convert policy calculation
Convert policy calculation to use shift operators and OR operation
instead of binary numbers and addition.

Signed-off-by: Philipp Giersfeld <philipp.giersfeld@canarybit.eu>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Markus Frank <m.frank@proxmox.com>
Reviewed-by: Markus Frank <m.frank@proxmox.com>
2025-04-03 20:31:37 +02:00
Fiona Ebner
b2aa996f43 drive: remove ancient 'cow' from formats
The format was dropped in QEMU binary version 2.2 with commit
550830f935 ("block: delete cow block driver").

Very old backups might still include this format as a hint (the data
in the backup is present in raw/chunk format in any case), but that is
not an issue. Restore already checks that the target storage supports
a given format and defaults to the default format of the storage if
the hint does not apply.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-04-03 18:41:17 +02:00
Thomas Lamprecht
c86b598198 bump version to 8.3.9
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 17:46:10 +02:00
Thomas Lamprecht
6bfe9a74c5 d/control: bump versioned dependency for libpve-guest-common-perl
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 17:32:55 +02:00
Dominik Csapak
abdc7cdd89 migrate: add transfer summary
Showing a final transfer log line helps with identifying what was
actually transferred. E.g., it could happen that the VFIO state was
only transferred in the last iteration. In such a case we would not
see that information at all.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 16:40:59 +02:00
Dominik Csapak
09f8d3f19e migrate: show vfio state transferred too
Show the transferred VFIO state (when there is one), but since there
is no total here, so we can't show that, just what was transferred up
until now.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 16:40:59 +02:00
Dominik Csapak
8aeaad24ab api: migrate preconditions: include not mapped resources for running VMs
So that we can show a proper warning in the migrate dialog and check it
in the bulk migrate precondition check.

The returned 'unavailable_storages' and 'unavailable-resources' should
be the same as before, but we now always return (not_)allowed_nodes
too.

To make the code a bit easier to read, reorganize how we construct the
(not_)allowed_nodes properties.

Also add a note that we want to redesign the return values here for a
easier to consume interface.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 16:40:59 +02:00
Dominik Csapak
b86d32dcb2 pci passthrough: enable live-migration for capable mapped-devices
Set the 'enable-migration' QEMU command-line flag to on for
live-migration marked mapped devices, as the default is 'auto', but
for those which are marked as capable for live-migration, we want to
explicitly enable that, so that we get an early error on start if the
driver does not support live-migration.

With that we can drop such devices from being a migration blocker.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [TL: squash and re-order similar changes together]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 16:38:36 +02:00
Thomas Lamprecht
0f55e8be84 api: migration preconditions: return detailed info for mapped-resources
Switch the underlying check_local_resource method to return a hash and
adapt call sites to that change. Return that new hash in the API as
new return property for the frontend to have more info to check.

This is in preparation for enabling live-migration for VMs with
mappings that declare being capable of them.

Originally-by: Dominik Csapak <d.csapak@proxmox.com>
 [TL: split out from unrelated changes and fix return schema]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 16:38:36 +02:00
Dominik Csapak
8c6b0569ea migration blockers: allow mapped devices for *offline* migration
Do not mark mapped devices as local resources for the offline
migration case, there it's only relevant that they have a mapping
configured on the target node, which is a different check.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 16:38:36 +02:00
Dominik Csapak
4a9d773711 pci: mapping: check mdev config against hardware
By passing the mapping config to assert_valid, not only the specific
mapping.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 16:38:36 +02:00
Dominik Csapak
b204fad0b4 tests: cfg2cmd: fix mdev tests
This will fail with the new checks for mdev when we don't have the
correct config, as a device that has mediated devices, should have
'mdev' set in the mapping config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 16:38:36 +02:00
Dominik Csapak
5b0f9cc848 api: create disks: only log cleanup if it's actually done
we cleaned up extracted images, but logged it even for non extracted
ones. Only log this when we actually cleaned anything up.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2025-03-13 10:29:52 +01:00
Dominik Csapak
dfc47f7da2 migrate: call vm_stop_cleanup after stopping in phase3_cleanup
we currently only call deactivate_volumes, but we actually want to call
the whole vm_stop_cleanup, since that is not invoked by the vm_stop
above (we cannot parse the config anymore) and might do other cleanups
we also want to do (like mdev cleanup).

For this to work properly we have to clone the original config at the
beginning, since we might modify the volids.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2025-03-06 16:33:14 +01:00
Dominik Csapak
21cacf5c92 vm stop-cleanup: allow callers to decide error behavior
and keep it the same for all current callers as before by setting the
additional 'noerr' parameter to '1'.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2025-03-06 16:33:14 +01:00
Dominik Csapak
45f67709ea api: termproxy/vncproxy: fix 'use of uninitialized value' when checking vga type
in our schema for 'vga' the type is optional, so a config like

 vga: memory=64

is valid. When checking the type we have to check if the type is defined
before accessing it.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
[FE: add 'termproxy/vncproxy' prefix to commit title]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-03-05 14:42:42 +01:00