5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-04-16 18:50:13 +03:00

196 Commits

Author SHA1 Message Date
Markus Frank
7bfffaee5f migration: check_local_resources for virtiofs
add dir mapping checks to check_local_resources

Since the VM needs to be powered off for migration, migration should
work with a directory on shared storage with all caching settings.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
Link: https://lore.proxmox.com/20250407134950.265270-5-m.frank@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07 22:31:04 +02:00
Thomas Lamprecht
a9a5d37bc6 tests: fix config to command expected outputs
This should have been in the patch doing the change :(

Fixes: 65b2041 ("vm-network-scripts: move scripts to /usr/libexec")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07 17:30:16 +02:00
Thomas Lamprecht
5f8a64ae59 Merge patch series "more robust handling of fleecing images"
Fiona Ebner <f.ebner@proxmox.com> says:

Record the created fleecing images in the VM configuration to be able
to remove left-overs after hard failures.

Adds a new special configuration section 'fleecing', making special
section handling more generic as preparation, as well as fixing some
corner cases in configuration parsing and adding tests.

Fiona Ebner (16):
  migration: remove unused variable
  test: avoid duplicate mock module in restore config test
  test: add parse config tests
  parse config: be precise about section type checks
  test: add test case exposing issue with unknown sections
  parse config: skip unknown sections and warn about their presence
  vzdump: anchor matches for pending and special sections
  vzdump: skip all special sections
  config: make special section handling generic
  test: parse config: test config with duplicate sections
  parse config: warn about duplicate sections
  check type: require schema as an argument
  config: add fleecing section
  fix #5440: vzdump: better cleanup fleecing images after hard errors
  migration: attempt to clean up potential left-over fleecing images
  destroy vm: clean up potential left-over fleecing images

Link: https://lore.proxmox.com/20250127112923.31703-1-f.ebner@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07 14:13:56 +02:00
Fiona Ebner
a82c4555e3 config: add fleecing section
Will be used for improved cleanup of fleecing images.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250127112923.31703-14-f.ebner@proxmox.com
2025-04-07 14:13:01 +02:00
Fiona Ebner
68eabc42c1 parse config: warn about duplicate sections
Currently, a duplicate section will quietly override the previous
instance of the section with the same identifier. Keep the current
behavior of preferring later entries, but issue a warning or die when
parsing strictly.

The entry for 'pending' in the result needs to start out as undefined
for the check to also work in presence of empty sections. Avoid
changing the returned value itself, by making sure to initialize the
entry before returning.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250127112923.31703-12-f.ebner@proxmox.com
2025-04-07 14:13:01 +02:00
Fiona Ebner
90ae915305 test: parse config: test config with duplicate sections
Add a test case to witness how duplicate sections are handled.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250127112923.31703-11-f.ebner@proxmox.com
2025-04-07 14:13:01 +02:00
Fiona Ebner
248349f25e parse config: skip unknown sections and warn about their presence
Currently, keys in an unknown section will be interpreted as still
belonging to the last section and might erroneously overwrite values
in that way. Explicitly ignore unknown sections to avoid this while
warning the user.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250127112923.31703-7-f.ebner@proxmox.com
2025-04-07 14:13:01 +02:00
Fiona Ebner
c80f968cc1 test: add test case exposing issue with unknown sections
While unknown sections do lead to an error in strict mode, in
non-strict mode the line is just skipped, meaning that key-value
pairs from the unknown section will override the key-value pairs from
the previous section.

Fixed by the next commit.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250127112923.31703-6-f.ebner@proxmox.com
2025-04-07 14:13:01 +02:00
Fiona Ebner
df6d255b0f parse config: be precise about section type checks
There are checks for custom parsing behavior inside certain sections
relying only on the section name. While the name 'pending' cannot be
used by snapshots, the name 'cloudinit' can. Introduce an associated
section type to make the checks precise.

The test was not added in a separate commit, because it would fail
when writing the config before the fix, and failure in writing is
never expected by the test script. So there is no easy way to
highlight just the difference in behavior together with the fix and
the git history should stay bisectable.

Compare with the verify-snapshot.conf testcase without the actual fix
applied to see the difference.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250127112923.31703-5-f.ebner@proxmox.com
2025-04-07 14:13:01 +02:00
Fiona Ebner
60b9ff0fd9 test: add parse config tests
Tests for parsing and writing VM configuration files. The parsing part
is already covered by the config2command test too, but that only
focuses on the main section, not other section types and does not also
test parsing in strict mode.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250127112923.31703-4-f.ebner@proxmox.com
2025-04-07 14:13:01 +02:00
Fiona Ebner
27f38b00f3 test: avoid duplicate mock module in restore config test
The duplication is there, because two independet fixes for a test
failure where applied, namely commits:
75c430ce ("test: unbreak restore_config_test")
cc1cdadb ("test: fix restore config test as unprivileged user")

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250127112923.31703-3-f.ebner@proxmox.com
2025-04-07 14:13:01 +02:00
Fiona Ebner
16d840e8d1 cfg2cmd: replace deprecated 'reconnect' option with 'reconnect-ms'
The 'reconnect' option was replaced by 'reconnect-ms' in QEMU commit
c8e2b6b4d7 ("chardev: introduce 'reconnect-ms' and deprecate
'reconnect'").

Makes qemu-server build-depend on QEMU 9.2 for the tests.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250407073256.8889-2-f.ebner@proxmox.com
2025-04-07 09:45:56 +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
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
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
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
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
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
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
Daniel Kral
295d0be11c test: cfg2cmd: expect error for invalid volume's storage content type
Tests whether when running `config_to_command` it will correctly fail
with an error message that a volume cannot be used if the underlying
storage does not support its content type.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
[FE: add 'content' key to storage hash to be slightly more realistic]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-02-20 14:35:30 +01:00
Fiona Ebner
1715febd33 move kvm_user_version() function to helpers module
Add an export, since the function is rather commonly used (in
particular inlined in function calls, where prefixing with the module
name would hurt readability) and there won't be much potential for
confusion name-wise.

This was the only user of stat(), so remove the File::stat include.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-01-17 19:24:02 +01:00
Fiona Ebner
9f887d3738 cfg2cmd: print drive commandline: improve format detection
For a Proxmox VE managed volume, prefer the format from the storage
layer rather than the 'format' option set on the drive. Fail if there
is a mismatch between the detected and configured format, because this
is not expected for managed volumes. Having this early hard failure
protects against undesirable issues with live migration and reboot
where the format of a drive would suddenly be different.

For a not Proxmox VE managed volume, use the same logic as before,
i.e. use the 'format' option for the drive with 'raw' as a fallback:
Only root can configure such devices.

Both also apply to the case where the 'cdrom' flag is set to avoid
autodetection by QEMU.

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
FG: typo fix in comment
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-12-09 09:07:08 +01:00
Thomas Lamprecht
375dda9457 cfg2cmd tests: various typo fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-12-05 12:20:54 +01:00
Fiona Ebner
2dc870b627 test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests
Since there are certain checks that depend on the QEMU binary version,
tests with a fixed QEMU binary version make it less likely to catch
issues on current setups, because for those, the QEMU binary version
will always be higher than in the tests.

Some of the affected tests explicitly mention the version, so set the
machine version for those. For the others, there's no real requirement
to test for a specific machine version either, so just use the latest.

This completes the transition for using machine version for tests
instead of QEMU binary version. The three remaining tests that set the
binary version explicitly want to test for it.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
2024-12-05 12:13:20 +01:00
Fiona Ebner
ac7c615b50 test: cfg2cmd: don't use QEMU binary version less than 7.0 for tests
Since there are certain checks that depend on the QEMU binary version,
tests with a fixed QEMU binary version make it less likely to catch
issues on current setups, because for those, the QEMU binary version
will always be higher than in the tests.

Two of the affected tests explicitly mention the version, so set the
machine version for those. For the other two, there's no real
requirement to test for a specific machine version either, so just use
the latest.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
2024-12-05 12:13:20 +01:00
Fiona Ebner
193a5cd770 test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests
Since there are certain checks that depend on the QEMU binary version,
tests with a fixed QEMU binary version make it less likely to catch
issues on current setups, because for those, the QEMU binary version
will always be higher than in the tests.

For all but one of the affected tests, there's no real requirement to
test for a specific machine version either, so just use the latest.
The exception is the 'netdev' test, because it should stay distinct
from the 'netdev-7.1' test.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
2024-12-05 12:13:20 +01:00
Fiona Ebner
86b1f1c24c cfg2cmd: require at least QEMU binary version 5.0
The minimum supported version for a Proxmox VE 8 node is QEMU 8.0.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
2024-12-05 12:13:20 +01:00
Fiona Ebner
eb88d96432 test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests
Since there are certain checks that depend on the QEMU binary version,
tests with a fixed QEMU binary version make it less likely to catch
issues on current setups, because for those, the QEMU binary version
will always be higher than in the tests.

Set the machine version, because these tests depend on that. The machine
version is what should actually be tested for rather than an old QEMU
binary version.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
2024-12-05 12:13:20 +01:00
Fiona Ebner
2263b8548d cfg2cmd: require at least QEMU binary version 4.0
The minimum supported version for a Proxmox VE 8 node is QEMU 8.0.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
2024-12-05 12:13:20 +01:00
Fiona Ebner
83f18ac089 test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests
Since there are certain checks that depend on the QEMU binary version,
tests with a fixed QEMU binary version make it less likely to catch
issues on current setups, because for those, the QEMU binary version
will always be higher than in the tests.

For the affected tests, there's no real requirement to test for a
specific machine version either, so just use the latest.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
2024-12-05 12:13:20 +01:00
Fiona Ebner
417005925f test: bump QEMU version in tests for too new machine type and pve version
This is necessary to bump the minimum required version in
config_to_command() beyond 4.1.1, because otherwise there will be an
error message mismatch making the test fail.

Bump the tests all the way to 9.0.0, because that is the current version
and because then the test doesn't have to be touched again too soon
(only when wishing to bump the minimum required version beyond 9.0.0
in config_to_command()).

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
2024-12-05 12:13:20 +01:00
Dominik Csapak
8b158859bd use OVF from Storage
and delete it here (incl tests; they live in pve-storage now).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-11-18 18:55:54 +01:00
Dominik Csapak
48ada6982f pci: mdev: adapt to NVIDIA's modern interface with kernel >= 6.8
Since kernel 6.8, NVIDIAs vGPU driver does not use the generic mdev
interface anymore, since they relied on a feature there which is not
available anymore. IIUC the kernel [0] recommends drivers to implement
their own device specific features since putting all in the generic one
does not make sense.

They now have an 'nvidia' folder in the device sysfs path, which
contains the files `creatable_vgpu_types`/`current_vgpu_type` to
control the virtual functions model, and then the whole virtual function
has to be passed through (although without resetting and changing to the
vfio-pci driver).

This patch implements changes so that from a config perspective, it
still is an mediated device, and we map the functionality iff the device
has no mediated devices but the new NVIDIAs sysfsapi and the model name
is 'nvidia-<..>'

It behaves a bit different than mdevs and normal pci passthrough, as we
have to choose the correct device immediately since it's bound to the
pciid, but we must not bind the device to vfio-pci as the NVIDIA driver
implements this functionality itself.

When cleaning up, we iterate over all reserved devices (since for a
mapping we can't know at this point which was chosen besides looking at
the reservations) and reset the vgpu model to '0', so it frees up the
reservation from NVIDIAs side. (We also do that in a loop, since it's
not always immediately ready after QEMU closes)

A general problem (but that was previously also the case) is that a
showcmd (for a not running guest) reserves the pciids, which might block
an execution of a different real vm. This is now a bit more problematic
as we (temporarily) set the vgpu type then.

0: https://docs.kernel.org/driver-api/vfio-pci-device-specific-driver-acceptance.html

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-24 18:43:52 +02:00
Dominik Csapak
fc23c72a42 pci: device selection: don't reserve PCI IDs when VM is already running
Since the only way this could happen is when we're being called
from 'qm showcmd' and there we don't want to reserve or create anything.

In case the VM was not running, we actually reserve the devices, so we
want to call 'cleanup_pci_devices' after to remove those again. This
minimizes the timespan where those devices are not available for real vm
starts.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-24 18:39:37 +02:00
Fiona Ebner
84b4bc9ab1 move helper to check running QEMU version out of the 'Machine' module
The version of the running QEMU binary is not related to the machine
version and so it's a bit confusing to have the helper in the
'Machine' module. It cannot live in the 'Helpers' module, because that
would lead to a cyclic inclusion Helpers <-> Monitor. Thus,
'QMPHelpers' is chosen as the new home.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-07-30 21:19:51 +02:00
Fiona Ebner
60e1b142fb migration: avoid crash with heavy IO on local VM disk
There is a possibility that the drive-mirror job is not yet done when
the migration wants to inactivate the source's blockdrives:

> bdrv_co_write_req_prepare: Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed.

This can be prevented by using the 'write-blocking' copy mode (also
called active mode) for the mirror. However, with active mode, the
guest write speed is limited by the synchronous writes to the mirror
target. For this reason, a way to start out in the faster 'background'
mode and later switch to active mode was introduced in QEMU 8.2.

The switch is done once the mirror job for all drives is ready to be
completed to reduce the time spent where guest IO is limited.

The loop waiting for actively-synced to become true is not an endless
loop: Once the remaining dirty parts have been mirrored by the
background iteration, the actively-synced flag will be set. Because
the 'block-job-change' QMP command already succeeded, new writes will
be done synchronously to the target and thus not lead to new dirty
parts. If the job fails or vanishes (shouldn't actually happen,
because auto-dismiss is false), the loop will be exited and the error
propagated.

Reported rarely, but steadily over the years:
https://forum.proxmox.com/threads/78954/post-353651
https://forum.proxmox.com/threads/78954/post-380015
https://forum.proxmox.com/threads/100020/post-431660
https://forum.proxmox.com/threads/111831/post-482425
https://forum.proxmox.com/threads/111831/post-499807
https://forum.proxmox.com/threads/137849/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-07-30 21:19:51 +02:00
Dominik Csapak
3ab3dd55c4 fix #3352: templates: minimize config when starting templates
templates can only be started in context of a pbs backup, and there we
don't need or want to use most of the config, since they cannot be
started normally anyway.

We minimize the config by copying some specific relevant options (see
the comments for why the options were chosen) and all disk
configurations.

Since we change the qemu commandline for templates, we now have to adapt
the tests involving templates.

Without this, users can get into a situation where the template cannot
be backed up when there are some resources not available (such as cpu
cores, kvm, pci devices, etc.) even if the backup process does not need
them.

This change has some nice side effects, such as we don't need to
allocate the full amount of memory anymore for templates that have a
hostpci device configured, the configured bridges don't have to exist,
etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-07-01 10:48:27 +02:00
Dominik Csapak
89ca39266d tests: cfg2cmd: add test for templates with more options
during pbs backups, we need to start templates, so add a test for that.
We already have some tests for templates, but none with hostpci,tpm,
etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-07-01 10:48:27 +02:00
Markus Frank
2db4c27283 fix #3784: config: Parameter for guest vIOMMU + test-cases
vIOMMU enables the option to passthrough pci devices to L2 VMs in L1
VMs via Nested Virtualisation and adds an extra isolation.

Uses the new property-string from the "config: define machine schema
as property-string"-commit to add the viommu option to the machine
parameter.

Currently there are two vIOMMU implementation in QEMU to choose:
intel or virtio

Virtio-iommu is more recent but less used in production than intel-iommu.

The assert_valid_machine_property function prevents using intel-iommu with
i440fx.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
 [ TL: tiny coding style fix to extract variable inside if expr ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-11 16:40:17 +02:00
Thomas Lamprecht
2c651d846f tests: cfg2cmd: rename vnc-clipboard to lower-case and add description
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-20 16:36:51 +01:00
Markus Frank
3c4716a6b9 tests: add cases for clipboard with spice & std display
add one test case for a spice display and one for std

Signed-off-by: Markus Frank <m.frank@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
2023-11-20 16:21:00 +01:00
Fiona Ebner
e13a66c8f7 test: migration: mock get_current_qemu_machine
by remembering the 'forcemachine' parameter that's passed along when
starting the target instance.

In preparation to introduce a call to get_current_qemu_machine after
starting a VM to check for machine version deprecation.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-12 18:48:01 +01:00
Markus Frank
d6989068fa tests: use valid machine types for snapshot tests
In preparation to turn the 'machine' parameter into a property string.

parse_property_string checks for the regex, therefore the test-cases
with 'somemachine' and 'someothermachine' would fail.

To avoid that, replace 'somemachine' and 'someothermachine' with 'q35'
and 'pc' with sed:

sed -i 's/somemachine/q35/g'
sed -i 's/someothermachine/pc/g'

Signed-off-by: Markus Frank <m.frank@proxmox.com>
[FE: improve wording in commit message]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-08-17 13:37:57 +02:00
Fiona Ebner
089aed811d cfg2cmd: netdev: fix value for tx_queue_size
Quoting from QEMU commit 4271f40383 ("virtio-net: correctly report
maximum tx_queue_size value"):

> Maximum value for tx_queue_size depends on the backend type.
> 1024 for vDPA/vhost-user, 256 for all the others.

> So the parameter is silently ignored and ethtool reports a different
> value than the one provided by the user.

Indeed, for a non-vDPA/vhost-user netdev, the guest will see TX: 256
instead of the specified 1024 here. With the mentioned QEMU commit (in
master and will be part of 8.1), using 1024 will be a hard error:

> Invalid tx_queue_size (= 1024), must be a power of 2 between 256 and 256

Since neither vhost-user, nor vhost-vdpa netdev types are exposed by
Proxmox VE, just changing the limit to the correct 256 should be fine.
No obvious issue during live-migration found.

Fixes: 620d6b32 ("virtio-net: increase defaults rx|tx-queue-size to 1024")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-07-27 13:14:12 +02:00
Fiona Ebner
b155086bd8 fix #4620: cfg2cmd: drive device: correctly handle IDE for q35
Only unit 0 for IDE is supported with machine type q35. Currently,
QEMU will fail startup with machine type q35 with an error like
> Can't create IDE unit 1, bus supports only 1 units
when ide1 or ide3 is configured.

Make sure to keep backwards compat form migration by leaving ide0 and
ide2 fixed. Since starting with ide1 or ide3 never worked, they can be
moved to a controller with a higher ID without issue.

Reported in the community forum:
https://forum.proxmox.com/threads/124615/post-543127
https://forum.proxmox.com/threads/130815/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-07-20 12:20:25 +02:00
Fiona Ebner
d859bc0248 test: add tests with multiple IDE CD-ROM drives
None of the configured test storages support the content type iso
right now, just add it to cifs-store.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-07-20 12:20:25 +02:00
Aaron Lauterer
ee2febbaa0 tests: add migration alias check
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2023-06-21 12:48:11 +02:00