5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-08 21:18:03 +03:00
Commit Graph

3299 Commits

Author SHA1 Message Date
Alexandre Derumier
3f14f206a0 nic online bridge/vlan change: link disconnect/reconnect
We want to notify guest of the change, so it can resubmit dhcp request,
or send gratuitous arp,...

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-21 13:24:50 +01:00
Alexandre Derumier
e6e6c2934d nic hotplug: add_dhcp_mapping
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-21 13:24:48 +01:00
Alexandre Derumier
89229af914 vm_destroy: delete ip from ipam
Co-Authored-By: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-21 13:24:46 +01:00
Alexandre Derumier
ee8d2dea5c api2: create|restore|clone: add_free_ip
Co-Authored-by: Stefan Lendl <s.lendl@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-21 13:24:44 +01:00
Alexandre Derumier
6a6b668cf3 vm_start : vm-network-scripts: add_dhcp_reservation
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-21 13:24:43 +01:00
Alexandre Derumier
c944fef885 vmnic add|remove : add|del ip in ipam
Co-Authored-by: Stefan Lendl <s.lendl@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-21 13:24:41 +01: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
Markus Frank
bfd4595553 api: add clipboard variable to return at status/current
This can be used by noVNC to check if a clipboard is available.

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:20:26 +01:00
Markus Frank
b62997a171 config: enable VNC clipboard parameter in vga_fmt
add option to use the qemu vdagent implementation to enable the VNC
clipboard. When enabled with SPICE the spice-vdagent gets replaced
with the QEMU implementation.

This patch does not solve #1406, but does allow copy and paste with a
running X-session, when spice-vdagent is installed on the guest.

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:20:08 +01:00
Thomas Lamprecht
011e9ffdbd d/control: wrap-and-sort -tkn
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-20 16:19:35 +01:00
Thomas Lamprecht
90341c0d7e d/control: depend on split-out edk2-firmware packages
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-20 16:19:23 +01:00
Thomas Lamprecht
414d4b8e50 gitignore: sort content
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-17 15:54:24 +01:00
Stefan Lendl
8bdcf8a32d gitignore: add build output and .vscode to ignored files
Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
 [ TL: extend subject and use more specific build-dir glob ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-17 15:43:53 +01:00
Thomas Lamprecht
feb51881d7 bump version to 8.0.8
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-12 18:55:41 +01:00
Fiona Ebner
dec371d96c vm start: add warning about deprecated machine version
While there already is a warning from QEMU proper, that one is not
visible as a task warning and it's not straightforward to make it be
one, because QEMU is started inside a run_fork(). It's also more
future-proof to have the detection explicit on our side and the
documentation can be referenced.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-12 18:48:01 +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
Fiona Ebner
da84155405 machine: get current: add flag if current machine is deprecated in list context
Will be used for a warning.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-12 18:48:01 +01:00
Fiona Ebner
be690b7a91 machine: get current: return early from loop if possible
No point iterating through the rest if we already got the current
machine.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-12 18:48:01 +01:00
Fiona Ebner
7d6a629269 machine: get current: make it clear that pve-version only exists for the current machine
by adding a comment and grouping the code better. See the PVE QEMU
patch "PVE: Allow version code in machine type" for reference. The way
the code was written previously made it look like a bug where
$pve_version might be overwritten multiple times.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-12 18:48:01 +01:00
Fiona Ebner
081eed3b79 machine: get current: improve naming and style
No functional change intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-12 18:48:01 +01:00
Thomas Lamprecht
c351659d87 add some comments for legacy 2MB OVMF image builds
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-11 15:09:42 +01:00
Alexandre Derumier
c2f4482053 migration: add missing eval on nbdstop with tunnel v2
It was already done in tunnel v1.

Avoid to avoid migration (and keep both source/targetvm locked) if
nbdstop error occur

2023-09-28 16:20:39 ERROR: error - tunnel command '{"cmd":"nbdstop"}' failed - failed to handle 'nbdstop' command - VM 140 qmp command 'nbd-server-stop' failed - got timeout
2023-09-28 16:20:39 ERROR: migration finished with problems (duration 00:01:42)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-06 19:46:43 +01:00
Alexandre Derumier
6cb2338f53 nbd-stop: increase timeout to 25s
This can seemingly need a bit longer than expected, and better than
erroring out on migration is to wait a bit longer.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-06 19:45:55 +01:00
Thomas Lamprecht
1dcbfc4661 d/control: record break of with older ha-manager
As the ha-manager accessed rather internal details before that
version, and the memory property changing to a format-string with sub
properties in 7f8c808 ("add memory parser") breaks that access, so
ensure the installed ha-manager is using the newer
get_derived_property method to access that information cleanly.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-06 10:28:55 +01:00
Alexandre Derumier
5bb8815a3f add|del_bridge_fdb: remove unused firewall param 2023-10-25 13:02:45 +02:00
Alexandre Derumier
d797bb62c3 cpu hotplug: cannot change feature online
The vCPUs are passed as devices with specific id only when CPU
hot-plug is enable at cold start.

So, we can't enable/disable allow-hotplug online as then vCPU hotplug
API will thrown errors not finding core id.

Not enforcing this could also lead to migration failure, as the QEMU
command line for the target VM could be made different than the one it
was actually running with, causing a crash of the target as Fiona
observed [0].

[0]: https://lists.proxmox.com/pipermail/pve-devel/2023-October/059434.html

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 [ TL: Reflowed & expanded commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-24 11:46:52 +02:00
Fiona Ebner
b7bbeff3f9 vzdump: assemble: improve error messages
by including the errno. Might make it clearer what the issue is in
cases like: https://forum.proxmox.com/threads/135261/

Also add the missing newlines, the missing "to" in the second message,
switch to the more common "or die" and avoid line bloat while at it.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-10-23 17:09:41 +02:00
Filip Schauer
6f0627d4bd backup, migrate: fix races with suspended VMs that can wake up
Fix races with ACPI-suspended VMs which could wake up during migration
or during a suspend-mode backup.

Revert prevention, of ACPI-suspended VMs automatically resuming after
migration, introduced by 7ba974a682. The commit introduced a
potential problem that causes a suspended VM that wakes up during
migration to remain paused after the migration finishes.

This can be fixed once QEMU preserves the 'suspended' runstate during
migration (current patch on the qemu-devel list [0]) by checking for
the 'suspended' runstate on the target after migration.

Furthermore the commit increased the race window during the
preparation of a suspend-mode backup, when a suspended VM wakes up
between the vm_is_paused check in PVE::VZDump::QemuServer::prepare and
PVE::VZDump::QemuServer::qga_fs_freeze. This causes the code to skip
fs-freeze even if the VM has woken up, potentially leaving the file
system in an inconsistent state.

To prevent this, do not treat the suspended runstate as paused when
migrating or archiving a VM.

[0]: https://lists.nongnu.org/archive/html/qemu-devel/2023-08/msg05260.html

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
 [ TL: massage in Fiona's extra info into commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-16 16:48:47 +02:00
Fiona Ebner
62c1904921 fix #4522: api: vncproxy: also set environment variable for ticket without websocket
Since commit 2dc0eb61 ("qm: assume correct VNC setup in 'vncproxy',
disallow passwordless"), 'qm vncproxy' will just fail when the
LC_PVE_TICKET environment variable is not set. Since it is not only
required in combination with websocket, drop that conditional.

For the non-serial case, this was the last remaining effect of the
'websocket' parameter, so update the parameter description.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-10-16 16:43:47 +02:00
Fiona Ebner
876d993886 api: vncproxy: update description of websocket parameter
Since commit 3e7567e0 ("do not use novnc wsproxy"), the websocket
upgrade is done via the HTTP server.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-10-16 16:43:47 +02:00
Thomas Lamprecht
263c803dd1 api: reduce overly lengthy comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-10 12:57:18 +02:00
Filip Schauer
7ba974a682 Fix ACPI-suspended VMs resuming after migration
Add checks for "suspended" and "prelaunch" runstates when checking
whether a VM is paused.

This fixes the following issues:
* ACPI-suspended VMs automatically resuming after migration
* Shutdown and reboot commands timing out instead of failing
  immediately on suspended VMs

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2023-10-10 09:27:18 +02:00
Friedrich Weber
95f1de689e vm start: set higher timeout if using PCI passthrough
The default VM startup timeout is `max(30, VM memory in GiB)` seconds.
Multiple reports in the forum [0] [1] and the bug tracker [2] suggest
this is too short when using PCI passthrough with a large amount of VM
memory, since QEMU needs to map the whole memory during startup (see
comment #2 in [2]). As a result, VM startup fails with "got timeout".

To work around this, set a larger default timeout if at least one PCI
device is passed through. The question remains how to choose an
appropriate timeout. Users reported the following startup times:

ref | RAM | time  | ratio (s/GiB)
---------------------------------
[1] | 60G |  135s |  2.25
[1] | 70G |  157s |  2.24
[1] | 80G |  277s |  3.46
[2] | 65G |  213s |  3.28
[2] | 96G | >290s | >3.02

The data does not really indicate any simple (e.g. linear)
relationship between RAM and startup time (even data from the same
source). However, to keep the heuristic simple, assume linear growth
and multiply the default timeout by 4 if at least one `hostpci[n]`
option is present, obtaining `4 * max(30, VM memory in GiB)`. This
covers all cases above, and should still leave some headroom.

[0]: https://forum.proxmox.com/threads/83765/post-552071
[1]: https://forum.proxmox.com/threads/126398/post-592826
[2]: https://bugzilla.proxmox.com/show_bug.cgi?id=3502

Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
2023-10-06 18:12:07 +02:00
Alexandre Derumier
7f8c808772 add memory parser
In preparation to add more properties to the memory configuration like
maximum hotpluggable memory and whether virtio-mem devices should be
used.

This also allows to get rid of the cyclic include of PVE::QemuServer
in the memory module.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
[FE: also convert new usage in get_derived_property
     remove cyclic include of PVE::QemuServer
     add commit message]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-18 17:08:48 +02:00
Fiona Ebner
87b0f305e7 introduce QMPHelpers module
moving qemu_{device,object}{add,del} helpers there for now.

In preparation to remove the cyclic include of PVE::QemuServer in the
memory module and generally for better modularity in the future.

No functional change intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-18 17:08:48 +02:00
Fiona Ebner
2951c45ec0 memory: replace deprecated check_running() call
PVE::QemuServer::check_running() does both
PVE::QemuConfig::assert_config_exists_on_node()
PVE::QemuServer::Helpers::vm_running_locally()

The former one isn't needed here when doing hotplug, because the API
already assert that the VM config exists. It also would introduce a
new cyclic dependency between PVE::QemuServer::Memory <->
PVE::QemuConfig with the proposed virtio-mem patch set.

In preparation to remove the cyclic include of PVE::QemuServer in the
memory module.

No functional change intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-18 17:08:48 +02:00
Fiona Ebner
0e32bf5bc2 move NUMA-related code into memory module
which is the only user of the parse_numa() helper. While at it, avoid
the duplication of MAX_NUMA.

In preparation to remove the cyclic include of PVE::QemuServer in the
memory module.

No functional change intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-18 17:08:48 +02:00
Fiona Ebner
261b67e4aa move parse_number_sets() helper to helpers module
In preparation to move parse_numa() to the memory module.

No functional change intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-18 17:08:48 +02:00
Fiona Ebner
61b172d806 restore vma: inline one timeout variable and move other closer to usage
No functional change intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-15 16:27:44 +02:00
Fiona Ebner
e003f28404 restore vma: add comment describing timeout
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-15 16:27:44 +02:00
Fiona Ebner
853757ccec fix #2816: restore: remove timeout when allocating disks
10 minutes is not long enough when disks are large and/or network
storages are used when preallocation is not disabled. The default is
metadata preallocation for qcow2, so there are still reports of the
issue [0][1]. If allocation really does not finish like the comment
describing the timeout feared, just let the user cancel it.

Also note that when restoring a PBS backup, there is no timeout for
disk allocation, and there don't seem to be any user complaints yet.

The 5 second timeout for receiving the config from vma is kept,
because certain corruptions in the VMA header can lead to the
operation hanging there.

There is no need for the $tmp variable before setting back the old
timeout, because that is at least one second, so we'll always be able
to set the $oldtimeout variable to undef in time in practice.
Currently, there shouldn't even be an outer timeout in the first
place, because the only call path leading to here is via the create
API (also used by qmrestore), both of which don't set a timeout.

[0]: https://forum.proxmox.com/threads/126825/
[1]: https://forum.proxmox.com/threads/128093/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-09-15 16:27:44 +02:00
Filip Schauer
6d1ac42b95 drive: Fix typo in description of efitype
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2023-09-06 11:55:11 +02:00
Alexandre Derumier
a132d50ea3 memory: use static_memory in foreach_dimm
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-09-01 12:46:02 +02:00
Fiona Ebner
c86d705295 bump version to 8.0.7
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-08-21 11:53:38 +02: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
Filip Schauer
a55d0f71b2 fix #3963: Skip TPM startup for template VMs
Skip the software TPM startup when starting a template VM for performing
a backup. This fixes an error that occurs when the TPM state disk is
write-protected.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2023-08-11 09:16:21 +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
0d4e8cbde0 migration: alloc nbd disks: fix fall-back for remote live migration
While the comment sated
>    # order of precedence, filtered by whether storage supports it:
>    # 1. explicit requested format
>    # 2. format of current volume
>    # 3. default format of storage

the code did not fall back to the default format in the case of remote
migration, because the format was already set and the code used
> $format //= $defFormat;

This made remote migration from dir with qcow2 to e.g. LVM-thin fail.

Move extracting the format from the volume name to the call side for
local migration. This allows the logic here to be much simpler.

Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-07-27 10:05:20 +02:00
Fiona Ebner
8056ee3030 migration: alloc nbd disks: base format hint off source storage
Previously, qemu_img_format() was called with the target storage's
$scfg and the source storage's volume name.

This mismatch should only be relevant for certain special kinds of
storage plugins:
- no path, but does support an additional QEMU image format besides
  'raw', in short NPAF.
- no path, volume name can match QEMU_FORMAT_RE, in short NPVM.

Note that all integrated plugins are neither NPAF nor NPVM.

Note that for NPAF plugins, qemu_img_format() already always returns
'raw' because there is no path. It's a bit unlikely such a plugin
exists, because there were no bug reports about qemu_img_format()
misbehaving there yet.

Let's go through the cases:
- If source and target storage both have or don't have a path,
  qemu_img_format($scfg, $volname) returns the same for both $scfg's.
- If source storage has a path, but target storage does not, the
  format hint was previously 'raw', but can only be more correct now
  (being what the source image actually is):
  - For non-NPAF targets, since we know there is no path, it follows
    that 'raw' is the only supported QEMU image format.
  - For NPAF targets, the format will be preserved now (if actually
    supported).
- If source storage does not have a path, but target storage does, the
  format hint will be 'raw' now.
  - For non-NPVM sources, QEMU_FORMAT_RE didn't match when
    qemu_img_format() was called with the target storage's $scfg, so
    the hint also was 'raw' before this commit.
  - For NPVM sources, qemu_img_format() might've guessed a format from
    the source volume name when called with the target's $scfg before
    this commit. If the target storage supports the previously guessed
    format, it was preserved before this commit, but will not be
    anymore. In theory, the guess might've also been wrong, and in
    this case, this commit avoids the wrong guess.

To summarize, there is only one edge case with an exotic kind of third
party storage plugin where format preservation would be lost and in
another edge case, format preservation is gained.

In preparation to simplify the format fallback logic implementation.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-07-27 10:05:20 +02:00