]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
11 months agobuildsys: ignore failure to include doc-gen file, drop useless export
Thomas Lamprecht [Fri, 19 May 2023 10:43:15 +0000 (12:43 +0200)]
buildsys: ignore failure to include doc-gen file, drop useless export

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: add sbuild target for convenience
Fiona Ebner [Fri, 19 May 2023 07:05:48 +0000 (09:05 +0200)]
buildsys: add sbuild target for convenience

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: create build directory atomically
Fiona Ebner [Fri, 19 May 2023 09:55:37 +0000 (11:55 +0200)]
buildsys: create build directory atomically

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agomakefile: convert to simple parentheses for variables
Fiona Ebner [Fri, 19 May 2023 08:03:35 +0000 (10:03 +0200)]
makefile: convert to simple parentheses for variables

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: fix build-depends-on-1-revision lintian warning
Fiona Ebner [Fri, 19 May 2023 07:35:39 +0000 (09:35 +0200)]
d/control: fix build-depends-on-1-revision lintian warning

It's sufficient to depend on the version without the revision, because
4.1-1 is the first version of the package satisfying >= 4.1.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: expand clean target
Fiona Ebner [Fri, 19 May 2023 07:44:37 +0000 (09:44 +0200)]
buildsys: expand clean target

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: define compat level via build-depends and raise to 13
Fiona Ebner [Fri, 19 May 2023 07:26:12 +0000 (09:26 +0200)]
d/control: define compat level via build-depends and raise to 13

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: derive upload dist automatically
Fiona Ebner [Fri, 19 May 2023 07:24:46 +0000 (09:24 +0200)]
buildsys: derive upload dist automatically

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agotest: mock calls that can fail in a chroot environment
Fiona Ebner [Fri, 19 May 2023 09:49:15 +0000 (11:49 +0200)]
test: mock calls that can fail in a chroot environment

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agodisable SMM check: always return false for virt machine type
Fiona Ebner [Thu, 11 May 2023 11:43:17 +0000 (13:43 +0200)]
disable SMM check: always return false for virt machine type

There is no 'smm' flag for the 'virt' machine type.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
13 months agobump version to 7.4-3
Thomas Lamprecht [Mon, 27 Mar 2023 09:17:32 +0000 (11:17 +0200)]
bump version to 7.4-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agobackup: prepare: improve error messages
Fiona Ebner [Mon, 27 Mar 2023 09:01:06 +0000 (11:01 +0200)]
backup: prepare: improve error messages

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agobackup: prepare: fix format detection for disks without storage ID
Fiona Ebner [Mon, 27 Mar 2023 09:01:05 +0000 (11:01 +0200)]
backup: prepare: fix format detection for disks without storage ID

which is the case for passed-through disks. The qemu_img_format()
function cannot correctly handle those, and it's not safe to assume
they are raw (it's most likely, but not guaranteed), so just use the
storage method for the format like it was done before commit
efa3aa24 ("avoid list context for volume_size_info calls"). This will
use 'qemu-img info' to get the actual format.

Reported in the community forum:
https://forum.proxmox.com/threads/124794/
https://forum.proxmox.com/threads/124823/
https://forum.proxmox.com/threads/124818/

Fixes: efa3aa24 ("avoid list context for volume_size_info calls")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agobump version to 7.4-2
Thomas Lamprecht [Tue, 21 Mar 2023 15:51:04 +0000 (16:51 +0100)]
bump version to 7.4-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agoavoid list context for volume_size_info calls
Fiona Ebner [Tue, 21 Mar 2023 09:17:58 +0000 (10:17 +0100)]
avoid list context for volume_size_info calls

With the recent pve-storage commit d70d814 ("api: fix get content call response
type for RBD/ZFS/iSCSI volumes"), the volume_size_info call for RBD in
list context is much slower than before (from a quick test, about twice as long
without snapshots, even longer with snapshots and untested, but when using an
external cluster with image not having the fast-diff feature, it should be worse
still) and thus increases the likelihood to run into timeouts here.

None of the callers here actually need the more expensive call, so just
avoid calling in list context.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
13 months agobump version to 7.4-1
Thomas Lamprecht [Mon, 20 Mar 2023 16:24:49 +0000 (17:24 +0100)]
bump version to 7.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agomemory: hotplug: sort by numerical ID rather than slot when unplugging
Fiona Ebner [Thu, 16 Mar 2023 09:31:59 +0000 (10:31 +0100)]
memory: hotplug: sort by numerical ID rather than slot when unplugging

While, usually, the slot should match the ID, it's not explicitly
guaranteed and relies on QEMU internals. Using the numerical ID is
more future-proof and more consistent with plugging, where no slot
information (except the maximum limit) is relied upon.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
14 months agomemory: don't use foreach_reversedimm for unplug
Alexandre Derumier [Fri, 24 Feb 2023 12:09:05 +0000 (13:09 +0100)]
memory: don't use foreach_reversedimm for unplug

simple use dimm_list() returned by qemu

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
14 months agomemory: rename qemu_dimm_list to qemu_memdevices_list
Alexandre Derumier [Fri, 24 Feb 2023 12:09:04 +0000 (13:09 +0100)]
memory: rename qemu_dimm_list to qemu_memdevices_list

current qemu_dimm_list can return any kind of memory devices.

make it more generic, with an optionnal type device

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
14 months agopci: workaround nvidia driver issue on mdev cleanup
Dominik Csapak [Fri, 24 Feb 2023 13:04:31 +0000 (14:04 +0100)]
pci: workaround nvidia driver issue on mdev cleanup

in some nvidia grid drivers (e.g. 14.4 and 15.x), their kernel module
tries to clean up the mdev device when the vm is shutdown and if it
cannot do that (e.g. becaues we already cleaned it up), their removal
process cancels with an error such that the vgpu does still exist inside
their book-keeping, but can't be used/recreated/freed until a reboot.

since there seems no obvious way to detect if thats the case besides
either parsing dmesg (which is racy), or the nvidia kernel module
version(which i'd rather not do), we simply test the pci device vendor
for nvidia and add a 10s sleep. that should give the driver enough time
to clean up and we will not find the path anymore and skip the cleanup.

This way, it works with both the newer and older versions of the driver
(some of the older drivers are LTS releases, so they're still
supported).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agofix #4553: nvidia vgpu: reuse smbios uuid for '-uuid' parameter
Dominik Csapak [Mon, 27 Feb 2023 15:34:27 +0000 (16:34 +0100)]
fix #4553: nvidia vgpu: reuse smbios uuid for '-uuid' parameter

instead of using the mdev uuid. The nvidia driver does not actually care
that it's the same as the mdev, and in qemu the uuid parameter
overwrites the smbios1 uuid internally, so we should have been reusing
that in the first place.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agoclone: remove outdated TODO about bandwidth limit
Fiona Ebner [Fri, 24 Feb 2023 07:37:39 +0000 (08:37 +0100)]
clone: remove outdated TODO about bandwidth limit

Respecting bandwidth limit for offline clone was implemented by commit
56d16f16 ("fix #4249: make image clone or conversion respect bandwidth
limit"). It's still not respected for EFI disks, but those are small,
so just ignore it.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
14 months agobump version to 7.3-4
Thomas Lamprecht [Thu, 23 Feb 2023 16:16:12 +0000 (17:16 +0100)]
bump version to 7.3-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agofix #4249: make image clone or conversion respect bandwidth limit
Leo Nunner [Thu, 17 Nov 2022 13:18:27 +0000 (14:18 +0100)]
fix #4249: make image clone or conversion respect bandwidth limit

Previously, cloning a stopped VM didn't respect bwlimit. Passing the -r
(ratelimit) parameter to qemu-img convert fixes this issue.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
 [ T: reword subject line slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoupdate network dev: MTU is not hot-pluggable
Alexandre Derumier [Sat, 26 Nov 2022 07:20:25 +0000 (08:20 +0100)]
update network dev: MTU is not hot-pluggable

Avoid pretending that a MTU change on a existing network device gets
applied live to a running VM.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 [ T: reworded and expanded commit message slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agovzdump: Add VM QGA option to skip fs-freeze/-thaw on backup
Christoph Heiss [Thu, 23 Feb 2023 14:18:03 +0000 (15:18 +0100)]
vzdump: Add VM QGA option to skip fs-freeze/-thaw on backup

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
14 months agoovmf efi disk: ignore `efitype` parameter for ARM VMs
Matthias Heiserer [Mon, 30 Jan 2023 12:57:51 +0000 (13:57 +0100)]
ovmf efi disk: ignore `efitype` parameter for ARM VMs

Required because there's one single efi for ARM, and the 2m/4m
difference doesn't seem to apply.

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
 [ T: move description to format and reword subject ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoswtpm: use start time as prefix for logging
Fiona Ebner [Wed, 18 Jan 2023 12:21:09 +0000 (13:21 +0100)]
swtpm: use start time as prefix for logging

to be able to distinguish different invocations.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
14 months agoswtpm: enable logging
Fiona Ebner [Wed, 18 Jan 2023 12:21:08 +0000 (13:21 +0100)]
swtpm: enable logging

AFAICT, previously, errors from swtpm would not show up in any logs,
because they were just printed to the stderr of the daemonized
invocation here.

The 'truncate' option is not used, so that the log is not immediately
lost when a new instance is started. This increases the chance that
the relevant errors are still present when requesting the log from a
user.

Log level 1 contains the most relevant errors and seems to be quiet
for working-as-expected invocations. Log level 2 already includes
logging full TPM commands, some of which are 1024 bytes long. Thus,
log level 1 was chosen.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
14 months agostart: make not being able to set polling interval for ballooning non-critical
Fiona Ebner [Thu, 23 Feb 2023 09:49:03 +0000 (10:49 +0100)]
start: make not being able to set polling interval for ballooning non-critical

The guest will be running, so it's misleading to fail the start task
here. Also ensures that we clean up the hibernation state upon resume
even if there is an error here, which did not happen previously[0].

[0]: https://forum.proxmox.com/threads/123159/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agomemory: remove calls to parse_hotplug_features
Alexandre Derumier [Mon, 13 Feb 2023 12:00:09 +0000 (13:00 +0100)]
memory: remove calls to parse_hotplug_features

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
[FE: style: avoid overly long lines]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agomemory: refactor sockets
Alexandre Derumier [Mon, 13 Feb 2023 12:00:08 +0000 (13:00 +0100)]
memory: refactor sockets

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
15 months agotests: add memory tests
Alexandre Derumier [Mon, 13 Feb 2023 12:00:07 +0000 (13:00 +0100)]
tests: add memory tests

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
15 months agomemory: extract some code to their own sub for mocking
Alexandre Derumier [Mon, 13 Feb 2023 12:00:06 +0000 (13:00 +0100)]
memory: extract some code to their own sub for mocking

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
[FE: style: avoid overly long lines]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agofix #4525: clone disk: disallow mirror if it might cause problems with io_uring
Fiona Ebner [Fri, 10 Feb 2023 14:19:12 +0000 (15:19 +0100)]
fix #4525: clone disk: disallow mirror if it might cause problems with io_uring

The target of the drive-mirror operation is opened with (essentially)
the same flags as the source in QEMU, in particular whether io_uring
should be used is inherited.

But io_uring currently causes problems in combination with certain
storage types, sometimes even leading to crashes (LVM with Linux 6.1).
Just disallow live cloning of drives when the source uses io_uring and
the target storage is not ready for it. There is one exception, namely
when source and target storage are the same. In that case, just assume
it will keep working for the target.

Migration does not seem to be affected, because there, the target VM
opens the images with the checked aio setting and then NBD exports of
those are used as the targets for mirroring.

It can be that the default determined for the source is not what's
actually used, because after a drive-mirror to a storage with a
different default, it will still use the default from the old storage.
Unfortunately, aio doesn't seem to be part of the 'query-block' QMP
command's result, so just tolerate this edge case.

The check can be removed if either
1. drive-mirror learns to open the target with a different aio setting
or more ideally
2. there are no more bad storages for io_uring.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agodrive commandline: factor out determining direct cache usage into helper
Fiona Ebner [Fri, 10 Feb 2023 14:19:11 +0000 (15:19 +0100)]
drive commandline: factor out determining direct cache usage into helper

In preparation to re-use it for a check for live disk cloning.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agodrive commandline: factor out checks if io_uring is allowed by default
Fiona Ebner [Fri, 10 Feb 2023 14:19:10 +0000 (15:19 +0100)]
drive commandline: factor out checks if io_uring is allowed by default

while getting rid of the double negation.

In preparation to re-use the check for live disk cloning.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agohotplug: disk: mark aio as non-hotpluggable
Fiona Ebner [Fri, 10 Feb 2023 14:19:09 +0000 (15:19 +0100)]
hotplug: disk: mark aio as non-hotpluggable

Previously, changing aio would be applied to the configuration, but
the drive would still be using the old setting.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agoqemu_memory_hotplug: remove unused $opt arg
Alexandre Derumier [Thu, 2 Feb 2023 11:03:34 +0000 (12:03 +0100)]
qemu_memory_hotplug: remove unused $opt arg

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
15 months agoschema: OS type: note that the l26 type is also compatible with Linux 6.x
Thomas Lamprecht [Mon, 30 Jan 2023 10:02:53 +0000 (11:02 +0100)]
schema: OS type: note that the l26 type is also compatible with Linux 6.x

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agoclose #2792: allow online migration with replicated snapshots
Fiona Ebner [Wed, 18 Jan 2023 13:52:40 +0000 (14:52 +0100)]
close #2792: allow online migration with replicated snapshots

Since commit 9b6efe43 ("migrate: add live-migration of replicated
disks") live-migration with replicated volumes is possible. When
handling the replication, it is checked that all local volumes
previously detected as replicatable are actually replicated. So the
check if migration with snapshots is possible can just allow volumes
that are detected as replicatable.

Note that VM state files are also replicated.

If there is an invalid configuration with a non-replicatable volume or
state file and replication is enabled, then replication will fail, and
thus migration will fail early.

Trying to live-migrate to a non-replication target (needs --force)
will still fail if there are snapshots, because they are (correctly)
detected as non-replicated.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agoschema: memory: be precise that unit is binary prefix
Fiona Ebner [Mon, 23 Jan 2023 09:46:38 +0000 (10:46 +0100)]
schema: memory: be precise that unit is binary prefix

In the web UI, this was fixed years ago by pve-manager commit c11c4a40
("fix #1631: change units to binary prefix").

Quickly checked with the 'query-memory-size-summary' QMP command that
this is actually the case.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agofix spelling error in comment
Noel Ullreich [Fri, 20 Jan 2023 11:14:14 +0000 (12:14 +0100)]
fix spelling error in comment

Signed-off-by: Noel Ullreich <n.ullreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agocloud init schema: fix indentation and overly long wording
Thomas Lamprecht [Thu, 19 Jan 2023 10:57:03 +0000 (11:57 +0100)]
cloud init schema: fix indentation and overly long wording

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agofix #4378: standardized error for ovmf files
Noel Ullreich [Mon, 16 Jan 2023 14:24:10 +0000 (15:24 +0100)]
fix #4378: standardized error for ovmf files

The error messages for missing OVMF_CODE and OVMF_VARS files were
inconsistent as well as the error for the missing base var file not
telling you the expected path.

Signed-off-by: Noel Ullreich <n.ullreich@proxmox.com>
16 months agobump version to 7.3-3
Thomas Lamprecht [Mon, 16 Jan 2023 12:53:40 +0000 (13:53 +0100)]
bump version to 7.3-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
16 months agovm start: fix code style for balloon enabling
Thomas Lamprecht [Mon, 16 Jan 2023 12:46:29 +0000 (13:46 +0100)]
vm start: fix code style for balloon enabling

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
16 months agomigration: nbd export: switch away from deprecated QMP command
Fiona Ebner [Fri, 2 Dec 2022 12:54:52 +0000 (13:54 +0100)]
migration: nbd export: switch away from deprecated QMP command

The 'nbd-server-add' QMP command has been deprecated since QEMU 5.2 in
favor of a more general 'block-export-add'.

When using 'nbd-server-add', QEMU internally converts the parameters
and calls blk_exp_add() which is also used by 'block-export-add'. It
does one more thing, namely calling nbd_export_set_on_eject_blk() to
auto-remove the export from the server when the backing drive goes
away. But that behavior is not needed in our case, stopping the NBD
server removes the exports anyways.

It was checked with a debugger that the parameters to blk_exp_add()
are still the same after this change. Well, the block node names are
autogenerated and not consistent across invocations.

The alternative to using 'query-block' would be specifying a
predictable 'node-name' for our '-drive' commandline. It's not that
difficult for this use case, but in general one needs to be careful
(e.g. it can't be specified for an empty CD drive, but would need to
be set when inserting a CD later). Querying the actual 'node-name'
seemed a bit more future-proof.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agocdrom path: code reduction
Thomas Lamprecht [Fri, 13 Jan 2023 12:52:39 +0000 (13:52 +0100)]
cdrom path: code reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
16 months agocd rom handling: refactor cd rom path helper function
Stefan Sterz [Tue, 20 Dec 2022 10:30:37 +0000 (11:30 +0100)]
cd rom handling: refactor cd rom path helper function

to stop returning results of assignments

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
16 months agocd rom handling: return a clearer error when there is no cd rom drive
Stefan Sterz [Tue, 20 Dec 2022 10:30:36 +0000 (11:30 +0100)]
cd rom handling: return a clearer error when there is no cd rom drive

when a vm is configured to use a physical cd rom drive but there is no
such drive a cryptic "uninitialized value" error is thrown. this is
due to `$path` being undefined in `sub print_drive_commandline_full`.
warn that no cd rom drive is available instead.

note that the error was cosmetic as the vm would start just fine.

forum thread: https://forum.proxmox.com/threads/119592/

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
16 months agomigration: log error from query-migrate upon migration failure
Fiona Ebner [Wed, 11 Jan 2023 14:54:27 +0000 (15:54 +0100)]
migration: log error from query-migrate upon migration failure

if it is present. Should give more information for some failures and
even if it's not present, that fact helps to narrow things down.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agofix #4358: destroy_vm: Ignore 'suspended' lock when destroying VM
Stefan Hanreich [Thu, 5 Jan 2023 14:51:56 +0000 (15:51 +0100)]
fix #4358: destroy_vm: Ignore 'suspended' lock when destroying VM

Since we can now differentiate between 'suspended' and 'suspending',
it is possible to ignore the 'suspended' lock when destroying a VM.
It shouldn't matter whether the VM is locked because of hibernation
when you want to remove it. Therefore we can safely ignore the lock.

16 months agofix #4435: devices list: avoid error for undefined value
Fiona Ebner [Tue, 10 Jan 2023 13:41:37 +0000 (14:41 +0100)]
fix #4435: devices list: avoid error for undefined value

When $d->{'pci_bridge'}->{devices} is undef, @-dereferencing it will
die with:
> Can't use an undefined value as an ARRAY reference

This can happen (at least) when the VM is in 'prelaunch' state. The
QAPI definition for '@PciBridgeInfo' also declares the 'devices'
member as optional.

Before commit 721624b ("collect device list for nested pci-bridges"),
there was no issue, because $d->{'pci_bridge'}->{devices} was used in
foreach, so auto-vivified if undef.

Fixes: f721624b ("collect device list for nested pci-bridges")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agomemory hot-plug: fix check for maximal memory value
Alexandre Derumier [Mon, 2 Jan 2023 10:11:15 +0000 (11:11 +0100)]
memory hot-plug: fix check for maximal memory value

Fixes: 4d3f29e ("memory hotplug patch v10")
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
16 months agorollback: Only create start task with --start if VM is not running
Stefan Hanreich [Wed, 21 Dec 2022 16:51:10 +0000 (17:51 +0100)]
rollback: Only create start task with --start if VM is not running

When rolling back to the snapshot of a VM that includes RAM, the VM
gets started by the rollback task anyway, so no additional start task
is needed. Previously, when rolling back with the start parameter and
the VM snapshot included RAM, a start task was created. That task
failed because the VM had already been started by the rollback task.

Additionally documented this behaviour in the description of the start
parameter

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
16 months agotree-wide: switch to official spelling of QEMU in descriptions/messages
Fiona Ebner [Tue, 20 Dec 2022 09:23:32 +0000 (10:23 +0100)]
tree-wide: switch to official spelling of QEMU in descriptions/messages

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agobump version to 7.3-2
Thomas Lamprecht [Fri, 16 Dec 2022 11:55:00 +0000 (12:55 +0100)]
bump version to 7.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoovmf cmd assembly: rework now that it's in a separate method
Thomas Lamprecht [Mon, 12 Dec 2022 10:35:19 +0000 (11:35 +0100)]
ovmf cmd assembly: rework now that it's in a separate method

We can now do a few things that would be not really possible, or at
least mess with readability when this was still mostly inline
config2command, shaves of quite a few lines of code.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoovmf cmd assembly: reorder arguments
Thomas Lamprecht [Mon, 12 Dec 2022 10:40:22 +0000 (11:40 +0100)]
ovmf cmd assembly: reorder arguments

in preparation of reworking the new separate method for OVMF cmd
assembly, do this in a separate very targeted commit to make it more
clear that the next reworking-commit doesn't messes with our tests at
all.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agocfg2cmd: factor out ovmf drives printing
Fiona Ebner [Fri, 2 Dec 2022 12:59:31 +0000 (13:59 +0100)]
cfg2cmd: factor out ovmf drives printing

No functional change is intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agofix #4372: fix vm_resume migration callback
Fabian Grünbichler [Tue, 29 Nov 2022 12:09:26 +0000 (13:09 +0100)]
fix #4372: fix vm_resume migration callback

the fix for the recently introduced requirement of loading the VM config while
migrating was incomplete, since the vmlist node value could already be out of
date by the time load_config is called.

extend the fallback behaviour even further, by doing the following sequence:
- try regular load_config (likely case, rename already fully processed)
- if it fails, get node from vmlist, and load_config using that
- it that fails, invalidate the PVE::Cluster cache, retry regular load_config

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agobump version to 7.3-1
Thomas Lamprecht [Mon, 21 Nov 2022 12:44:02 +0000 (13:44 +0100)]
bump version to 7.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoexplain 'nocheck' in more places
Fabian Grünbichler [Mon, 21 Nov 2022 12:16:05 +0000 (13:16 +0100)]
explain 'nocheck' in more places

was only explained in git history and vm_stop, add comments in other
relevant places to avoid future breakage.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agovm_resume: fix nocheck/migrate handling
Fabian Grünbichler [Mon, 21 Nov 2022 12:16:04 +0000 (13:16 +0100)]
vm_resume: fix nocheck/migrate handling

it's not deterministic whether the rename/move of the VM config
triggered on the source side of a migration is already visible on the
target side when vm_resume is executed. check the vmlist for the node
where the config is currently located if $nocheck is set - it is now
needed to add the forwarding DB entries to the bridge.

this fixes an issue on busier or slower clusters, where pmxcfs hasn't
yet processed the rename, and resuming would fail with an error about
the config not existing.

Reported-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agobump version to 7.2-12
Thomas Lamprecht [Mon, 21 Nov 2022 07:36:17 +0000 (08:36 +0100)]
bump version to 7.2-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoapi: create/update vm: fix clamping cpuunits function calls
Fiona Ebner [Mon, 21 Nov 2022 07:25:13 +0000 (08:25 +0100)]
api: create/update vm: fix clamping cpuunits function calls

When applying the series introducing those calls, the helper was moved
to pve-common's CGroup.pm (see 07c10d5 ("cgroup: move get_cpuunits
helper from qemu-server as clamp_cpu_shares") in pve-common) instead
of pve-guest-common's GuestHelpers.pm. But these calls were not
updated.

Reported in the community forum:
https://forum.proxmox.com/threads/118267

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agod/control: depend on newer libpve-guest-common-perl 4.2-3
Thomas Lamprecht [Mon, 21 Nov 2022 07:21:40 +0000 (08:21 +0100)]
d/control: depend on newer libpve-guest-common-perl 4.2-3

for new unique tag helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoconfig: ensure that tags are unique
Thomas Lamprecht [Mon, 21 Nov 2022 07:19:33 +0000 (08:19 +0100)]
config: ensure that tags are unique

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-11
Thomas Lamprecht [Sun, 20 Nov 2022 15:30:32 +0000 (16:30 +0100)]
bump version to 7.2-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofdb: only manage FDB entries for Linux bridges for now
Thomas Lamprecht [Sun, 20 Nov 2022 15:03:41 +0000 (16:03 +0100)]
fdb: only manage FDB entries for Linux bridges for now

we need to handle OVS setups differently, so for now just ignore it
there (behavior as it was in 7.2)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofdb: pull out bridge variable
Thomas Lamprecht [Sun, 20 Nov 2022 15:03:16 +0000 (16:03 +0100)]
fdb: pull out bridge variable

no semantic change intended

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-10
Thomas Lamprecht [Thu, 17 Nov 2022 16:48:06 +0000 (17:48 +0100)]
bump version to 7.2-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomemory hot plug: round down to nearest even phys-bits for heuristics
Thomas Lamprecht [Thu, 17 Nov 2022 16:40:35 +0000 (17:40 +0100)]
memory hot plug: round down to nearest even phys-bits for heuristics

Mira found out that 41 phys-bits the limit is pretty much the same as
with 40, as such odd sizes are a bit unexpected anyway lets mask the
LSB and use that as base, that way we're good again.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-9
Thomas Lamprecht [Thu, 17 Nov 2022 16:09:21 +0000 (17:09 +0100)]
bump version to 7.2-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomemory hotplug: rework max memory handling, make phys-bits dependent
Thomas Lamprecht [Thu, 17 Nov 2022 14:55:40 +0000 (15:55 +0100)]
memory hotplug: rework max memory handling, make phys-bits dependent

QEMU 7.1 introduced some actual checks for the max memory value in
1caab5cf86bd ("i386/pc: bounds check phys-bits against max used GPA")
and while correct it breaks our by-luck working hard coded max mem of
4 TB for cases with smaller phys bit address sizes, like some older
CPUs or most CPU types have per default if not 'host' or 'max'.

QEMU uses 40 bits per default if the CPU isn't set to host or
phys-bits is not set explicitly.

For 40 bit it seems that depending on machine type one has a max
possible mem of: i440 -> 752, q35 -> 722 GiB, but instead of reducing
it to 704 GiB (512+1128+64) in a hard coded way we acutally check for
the bit size that will probably be used and use that to determine the
max memory size useable.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agocpu config: indentation fixup
Thomas Lamprecht [Thu, 17 Nov 2022 15:45:56 +0000 (16:45 +0100)]
cpu config: indentation fixup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agod/changelog: fixup release
Thomas Lamprecht [Thu, 17 Nov 2022 14:23:26 +0000 (15:23 +0100)]
d/changelog: fixup release

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoqm: add remote-migrate command
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:46 +0000 (14:33 +0100)]
qm: add remote-migrate command

which wraps the remote_migrate_vm API endpoint, but does the
precondition checks that can be done up front itself.

this now just leaves the FP retrieval and target node name lookup to the
sync part of the API endpoint, which should be do-able in <30s ..

an example invocation:

$ qm remote-migrate 1234 4321 'host=123.123.123.123,apitoken=PVEAPIToken=user@pve!incoming=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee,fingerprint=aa:bb:cc:dd:ee:ff:aa:bb:cc:dd:ee:ff:aa:bb:cc:dd:ee:ff:aa:bb:cc:dd:ee:ff:aa:bb:cc:dd:ee:ff:aa:bb' --target-bridge vmbr0 --target-storage zfs-a:rbd-b,nfs-c:dir-d,zfs-e --online

will migrate the local VM 1234 to the host 123.123.1232.123 using the
given API token, mapping the VMID to 4321 on the target cluster, all its
virtual NICs to the target vm bridge 'vmbr0', any volumes on storage
zfs-a to storage rbd-b, any on storage nfs-c to storage dir-d, and any
other volumes to storage zfs-e. the source VM will be stopped but remain
on the source node/cluster after the migration has finished.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agoapi: add remote migrate endpoint
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:45 +0000 (14:33 +0100)]
api: add remote migrate endpoint

entry point for the remote migration on the source side, mainly
preparing the API client that gets passed to the actual migration code
and doing some parameter parsing.

querying of the remote sides resources (like available storages, free
VMIDs, lookup of endpoint details for specific nodes, ...) should be
done by the client - see next commit with CLI example.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agomigrate: add remote migration handling
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:44 +0000 (14:33 +0100)]
migrate: add remote migration handling

remote migration uses a websocket connection to a task worker running on
the target node instead of commands via SSH to control the migration.
this websocket tunnel is started earlier than the SSH tunnel, and allows
adding UNIX-socket forwarding over additional websocket connections
on-demand.

the main differences to regular intra-cluster migration are:
- source VM config and disks are only removed upon request via --delete
- shared storages are treated like local storages, since we can't
assume they are shared across clusters (with potentical to extend this
by marking storages as shared)
- NBD migrated disks are explicitly pre-allocated on the target node via
tunnel command before starting the target VM instance
- in addition to storages, network bridges and the VMID itself is
transformed via a user defined mapping
- all commands and migration data streams are sent via a WS tunnel proxy
- pending changes and snapshots are discarded on the target side (for
  the time being)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agomigrate: refactor remote VM/tunnel start
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:43 +0000 (14:33 +0100)]
migrate: refactor remote VM/tunnel start

no semantic changes intended, except for:
- no longer passing the main migration UNIX socket to SSH twice for
forwarding
- dropping the 'unix:' prefix in start_remote_tunnel's timeout error message

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agomtunnel: add API endpoints
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:42 +0000 (14:33 +0100)]
mtunnel: add API endpoints

the following two endpoints are used for migration on the remote side

POST /nodes/NODE/qemu/VMID/mtunnel

which creates and locks an empty VM config, and spawns the main qmtunnel
worker which binds to a VM-specific UNIX socket.

this worker handles JSON-encoded migration commands coming in via this
UNIX socket:
- config (set target VM config)
-- checks permissions for updating config
-- strips pending changes and snapshots
-- sets (optional) firewall config
- disk (allocate disk for NBD migration)
-- checks permission for target storage
-- returns drive string for allocated volume
- disk-import, query-disk-import, bwlimit
-- handled by PVE::StorageTunnel
- start (returning migration info)
- fstrim (via agent)
- ticket (creates a ticket for a WS connection to a specific socket)
- resume
- stop
- nbdstop
- unlock
- quit (+ cleanup)

this worker serves as a replacement for both 'qm mtunnel' and various
manual calls via SSH. the API call will return a ticket valid for
connecting to the worker's UNIX socket via a websocket connection.

GET+WebSocket upgrade /nodes/NODE/qemu/VMID/mtunnelwebsocket

gets called for connecting to a UNIX socket via websocket forwarding,
i.e. once for the main command mtunnel, and once each for the memory
migration and each NBD drive-mirror/storage migration.

access is guarded by a short-lived ticket binding the authenticated user
to the socket path. such tickets can be requested over the main mtunnel,
which keeps track of socket paths currently used by that
mtunnel/migration instance.

each command handler should check privileges for the requested action if
necessary.

both mtunnel and mtunnelwebsocket endpoints are not proxied, the
client/caller is responsible for ensuring the passed 'node' parameter
and the endpoint handling the call are matching.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agopending: fix typo in variable name
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:41 +0000 (14:33 +0100)]
pending: fix typo in variable name

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agopending changes: allow skipping cloud-init
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:40 +0000 (14:33 +0100)]
pending changes: allow skipping cloud-init

in case of remote migration, we use the `update_vm_api` helper for
checking permissions on the incoming config. this would also cause an
incoming cloud-init image to be overwritten, since the VM is not running
yet at this point.

provide a parameter which can be set by an incoming *remote* migration
to avoid having inconsistent cloud init images on the source and target
side.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agofixup delayed cloudinit hotplug
Wolfgang Bumiller [Thu, 17 Nov 2022 14:16:19 +0000 (15:16 +0100)]
fixup delayed cloudinit hotplug

cloudinit generation needs to see the cloudinit drive so we
need to pass a config with it already updated

Fixes: 4b785da1a92c ("delay cloudinit generation in hotplug")
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agorework cloudinit_record_changed logic
Wolfgang Bumiller [Thu, 17 Nov 2022 13:35:27 +0000 (14:35 +0100)]
rework cloudinit_record_changed logic

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agoparse config: do not validate informative values in cloud init section
Thomas Lamprecht [Thu, 17 Nov 2022 11:46:11 +0000 (12:46 +0100)]
parse config: do not validate informative values in cloud init section

Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agod/control: bump versioned dependency for guest-common
Thomas Lamprecht [Thu, 17 Nov 2022 12:18:50 +0000 (13:18 +0100)]
d/control: bump versioned dependency for guest-common

to ensure the tag helper is available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoapi: update: check for tags permissions with 'assert_tag_permissions'
Dominik Csapak [Wed, 16 Nov 2022 15:48:01 +0000 (16:48 +0100)]
api: update: check for tags permissions with 'assert_tag_permissions'

from GuestHelpers. This function checks all necessary permissions and
raises an exception if the user does not have the correct ones.

This is necessary for the new 'privileged' tags and 'user-tag-access'
permissions to work.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agofix #4321: properly check cloud-init drive permissions
Leo Nunner [Wed, 16 Nov 2022 17:34:29 +0000 (18:34 +0100)]
fix #4321: properly check cloud-init drive permissions

The process for editing Cloud-init drives checked for inconsistent
permissions: for adding, the VM.Config.Disk permission was needed, while
the VM.Config.CDROM permission was needed to remove a drive. The regex
in drive_is_cloudinit needed to be adapted since the drive names have
different formats before/after they are actually generated.

Due to the regex letting names fall through before, Cloud-init drives
were being checked as disks, even though they are actually treated as
CDROM drives. Due to this, it makes more sense to check for
VM.Config.CDROM instead, while also requiring VM.Config.Cloudinit, since
generating a Cloud-init drive already generates default values that are
passed to the VM.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
18 months agobump version to 7.2-8
Thomas Lamprecht [Wed, 16 Nov 2022 17:31:16 +0000 (18:31 +0100)]
bump version to 7.2-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agodrop get_pending_changes and simplify cloudinit_pending api call
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:08 +0000 (18:14 +0100)]
drop get_pending_changes and simplify cloudinit_pending api call

- The forced-remove flag wasn't really used AFAICT and makes
  no sense IMO.
- Whether or not we care about non-MAC changes does not
  belong here, but should instead taken into account in the
  actual hotplug path recording the cloud-init state (iow.
  into $cloudinit_record_changed().)
  (This is not done here atm.)
- It seems much simpler to just have:
  * 'old' = the old value if it's not a new value
  * 'new' = the new value unless it's being deleted
  * If only one of them is set it's an addition or removal.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agodon't call 'cleanup_config' the cloudinit section
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:07 +0000 (18:14 +0100)]
don't call 'cleanup_config' the cloudinit section

It performs schema valdiation (and normalization).

We only ever write values into it which came from an
already validated config, and we also add an additional
"added" key which is not covered by the schema, so this
would fail.

Simply skip it.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agorecord cloud-init changes in the cloudinit section
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:06 +0000 (18:14 +0100)]
record cloud-init changes in the cloudinit section

introducing an 'added' value in the cloudinit section for
values which have not been present when the cloudinit image
has been generated

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agodelay cloudinit generation in hotplug
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:05 +0000 (18:14 +0100)]
delay cloudinit generation in hotplug

Hotpluggieg generated a cloudinit image based on old values
in order to attach the device and later update it again, but
the update was only done if cloudinit hotplug was enabled.
This is weird, let's not.

Also introduce 'apply_cloudinit_config' which also write the
config, which, as it turns out, is the only thing we
actually need anyway, currently.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agoPartially-revert "cloudinit: add cloudinit section for current generated config"
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:04 +0000 (18:14 +0100)]
Partially-revert "cloudinit: add cloudinit section for current generated config"

This partially reverts commit 95a5135dad974c7eae249cf92b62b06fe911af33.
Particularly the unprotected write to the config when
generating the cloudinit file. We leave the rest as is for
now and update the callers to deal with the config later.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agoRevert "cloudinit: avoid unsafe write of VM config"
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:03 +0000 (18:14 +0100)]
Revert "cloudinit: avoid unsafe write of VM config"

This reverts commit b137c30c3a5e4f5394e961a2048724fa18f86b2c.

In preparation of fixing the special:cloudinig section.

18 months agofix #4284: add read-only to non-hotpluggable disk options
Leo Nunner [Mon, 17 Oct 2022 13:24:00 +0000 (15:24 +0200)]
fix #4284: add read-only to non-hotpluggable disk options

Changing the read-only status of a disk is not possible through QMP, so
it needs to be exempt from the hotpluggable values as to notify the
user.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
18 months agowrite config: only write out special cloudinit config if the vm has it
Thomas Lamprecht [Wed, 16 Nov 2022 11:50:29 +0000 (12:50 +0100)]
write config: only write out special cloudinit config if the vm has it

this is only for the current in use CI stuff, not the actual cloud
init config itself.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>