]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
11 months agod/control: bump versioned dependency for libpve-guest-common-perl
Thomas Lamprecht [Thu, 8 Jun 2023 15:25:05 +0000 (17:25 +0200)]
d/control: bump versioned dependency for libpve-guest-common-perl

to ensure we got the vnet access check helper available for us, and
also that the get_derived_property interface is available for our
users

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agorestore: check bridge access when actual config is available
Thomas Lamprecht [Thu, 8 Jun 2023 15:19:43 +0000 (17:19 +0200)]
restore: check bridge access when actual config is available

This was not only rather inefficient (getting the config from the
archive twice) but also wrong, as we can override options on restore,
so we can do the check only when the backed-up config and override
config got merged.

If this is to late from POV of volume deletion or the like, then the
issue is that those things happen to early, as we can only know what
to do with the actual target config, so destructive actions that
happen before that are wrong by design.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agomove helper to check bridge access out of api
Thomas Lamprecht [Thu, 8 Jun 2023 15:16:24 +0000 (17:16 +0200)]
move helper to check bridge access out of api

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoapi: check bridge access for create, update, clone & restore
Alexandre Derumier [Wed, 7 Jun 2023 12:03:49 +0000 (14:03 +0200)]
api: check bridge access for create, update, clone & restore

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoconfig: implement method to calculate derived properties from a config
Fiona Ebner [Tue, 28 Feb 2023 10:54:09 +0000 (11:54 +0100)]
config: implement method to calculate derived properties from a config

See the corresponding commit in guest-common for more information.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoqmeventd: extract vmid from cgroup file instead of cmdline
Fiona Ebner [Wed, 24 May 2023 13:56:50 +0000 (15:56 +0200)]
qmeventd: extract vmid from cgroup file instead of cmdline

This is the single remaining user of the id argument. The id argument
is a Proxmox-specific extension to QEMU, which we'd like to drop to
reduce our differences with upstream QEMU.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agoremove left-over mentions of to-be-dropped, outdated QMP commands
Fiona Ebner [Wed, 24 May 2023 13:56:49 +0000 (15:56 +0200)]
remove left-over mentions of to-be-dropped, outdated QMP commands

The commands snapshot-drive and delete-drive-snapshot have been unused
by qemu-server since commit eba2b721 ("use qemu's blockdev-snapshot
functions") and are now going to be dropped in our QEMU builds too, so
get rid of these left-overs.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agocloudinit: pass through hostname via fqdn field
Leo Nunner [Tue, 23 May 2023 07:14:19 +0000 (09:14 +0200)]
cloudinit: pass through hostname via fqdn field

If no FQDN is provided, we simply set it to the current hostname. This
ensures that the hostname *really* gets set, since we encountered an
issue on Fedora and CentOS based systems where no hostname got set at
all.

When there's no FQDN set in the cloudinit config, this leads to the
following entry:

    127.0.1.1 <hostname> <hostname>

Which doesn't seem to cause any issues.

Tested on:
 - Ubuntu 23.04
 - CentOS 8
 - Fedora 38
 - Debian 11
 - SUSE 15.4

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
11 months agofix #2315: api: have resize endpoint spawn a worker task
Fiona Ebner [Tue, 30 May 2023 13:52:04 +0000 (15:52 +0200)]
fix #2315: api: have resize endpoint spawn a worker task

Similar to the corresponding endpoint for containers. Because disks
are involved, this can be a longer running operation, as is also
indicated by the 60 seconds timeout used in qemu_block_resize() which
is called by this endpoint.

This is a breaking API change.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agod/control: bump minimal QEMU version to 7.1
Thomas Lamprecht [Wed, 7 Jun 2023 17:23:12 +0000 (19:23 +0200)]
d/control: bump minimal QEMU version to 7.1

just to be safe and have this on a more recent one, as we def. do not
support 3.0 anymore

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #517: api: allow resizing qcow2 disk with snapshots
Fiona Ebner [Tue, 30 May 2023 13:52:03 +0000 (15:52 +0200)]
fix #517: api: allow resizing qcow2 disk with snapshots

Support for this was added in QEMU 5.1 by commit 7fa140abf6 ("qcow2:
Allow resize of images with internal snapshots").

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agofast plug options: add migrate_downtime and migrate_speed
Fiona Ebner [Thu, 11 May 2023 12:30:12 +0000 (14:30 +0200)]
fast plug options: add migrate_downtime and migrate_speed

for convenience. These options do not influence the QEMU instance
directly, but are only used for migration, so no need to keep them in
pending.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agofast plug options: order alphabetically
Fiona Ebner [Thu, 11 May 2023 12:30:11 +0000 (14:30 +0200)]
fast plug options: order alphabetically

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agocloudinit: fix 'pending' api endpoint
Leo Nunner [Thu, 11 May 2023 08:03:17 +0000 (10:03 +0200)]
cloudinit: fix 'pending' api endpoint

This patch partially reverts commit 1b5706cd168fedc5e494e24300069ee4ff25761f,
by reintroducing the old format for return values (key, value, pending,
delete), but drops the "force-delete" return value. Right now, this
endpoint does not conform to its own format, because the return values
are as follows:

{
    key => {
old => 'foo',
new => 'bar',
    },
    […]
}

While the format specified is

[
    {
key => 'baz',
old => 'foo',
new => 'bar',
    },
    […]
]

This leads to the endpoint being broken when used through 'qm' and
'pvesh'. Using the API works fine, because the format doesn't get
verified there. Reverting this change brings the advantage that we can
also use PVE::GuestHelpers::format_pending when calling the endpoint
through qm again.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
11 months agofix #3428: cloudinit: add parameter for upgrade on boot
Leo Nunner [Thu, 4 May 2023 10:55:01 +0000 (12:55 +0200)]
fix #3428: cloudinit: add parameter for upgrade on boot

up until now, we did an automatic upgrade after the first boot in our
standard cloud-init config. This has been requested to be toggleable
several times [1][2]. With this patch, "package_upgrade" is disabled by
default, and needs to be enabled manually, diverging from the previous
behaviour.

[1] https://forum.proxmox.com/threads/how-to-prevent-automatic-apt-upgrade-during-the-first-boot-with-cloud-init.68472/
[2] https://forum.proxmox.com/threads/cloud-init-ohne-package-upgrade.123841/

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
11 months agoallow setting ipconfigX with VM.Config.Cloudinit
Fabian Grünbichler [Wed, 3 May 2023 07:52:03 +0000 (09:52 +0200)]
allow setting ipconfigX with VM.Config.Cloudinit

these config keys only affect the cloudinit drive contents (and state of the
guest inside the VM), they are not used anywhere on the hypervisor side, so
they should not require VM.Config.Network (which allows a lot more, such as
changing vNIC VLAN tags or the bridges they are connected to).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
11 months agoschema: avoid using deprecated -no-hpet in example for 'args' property
Fiona Ebner [Mon, 3 Apr 2023 12:09:45 +0000 (14:09 +0200)]
schema: avoid using deprecated -no-hpet in example for 'args' property

instead use a recent example that served as a workaround in #4625.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agocfg2cmd: replace deprecated no-hpet option with hpet=off machine flag
Fiona Ebner [Mon, 3 Apr 2023 12:09:44 +0000 (14:09 +0200)]
cfg2cmd: replace deprecated no-hpet option with hpet=off machine flag

like the deprecation message printed by QEMU suggests.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agocfg2cmd: replace deprecated no-acpi option with acpi=off machine flag
Fiona Ebner [Mon, 3 Apr 2023 12:09:43 +0000 (14:09 +0200)]
cfg2cmd: replace deprecated no-acpi option with acpi=off machine flag

like the deprecation message printed by QEMU suggests.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agocfg2cmd: use actual backend names instead of removed tty and paraport aliases
Fiona Ebner [Mon, 3 Apr 2023 12:09:42 +0000 (14:09 +0200)]
cfg2cmd: use actual backend names instead of removed tty and paraport aliases

As described in:
https://qemu-project.gitlab.io/qemu/about/removed-features.html#chardev-backend-aliases-tty-and-parport-removed-in-8-0

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofixup d/changelog
Wolfgang Bumiller [Wed, 7 Jun 2023 11:50:14 +0000 (13:50 +0200)]
fixup d/changelog

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agobump version to 8.0.1
Wolfgang Bumiller [Wed, 7 Jun 2023 11:47:58 +0000 (13:47 +0200)]
bump version to 8.0.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agobump common dep to 8.0.2, guest-common to 5.0.1
Wolfgang Bumiller [Wed, 7 Jun 2023 11:47:52 +0000 (13:47 +0200)]
bump common dep to 8.0.2, guest-common to 5.0.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agoapi: switch agent api call to 'array' type
Dominik Csapak [Tue, 6 Jun 2023 13:08:51 +0000 (15:08 +0200)]
api: switch agent api call to 'array' type

we don't want to use the '-alist' formats anymore in favor of real arrays

Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agoblock resize: avoid passing zero size to QMP command
Fiona Ebner [Fri, 28 Apr 2023 12:32:07 +0000 (14:32 +0200)]
block resize: avoid passing zero size to QMP command

Commit 7246e8f9 ("Set zero $size and continue if volume_resize()
returns false") mentions that this is needed for "some storages with
backing block devices to do online resize" and since this patch came
together [0] with pve-storage commit a4aee43 ("Fix RBD resize with
krbd option enabled."), it's safe to assume that RBD with krbd is
meant. But it should be the same situation for any external plugin
relying on the same behavior.

Other storages backed by block devices like LVM(-thin) and ZFS return
1 and the new size respectively, and the code is older than the above
mentioned commits. So really, the RBD plugin just should have returned
a positive value to be in-line with those and there should be no need
to pass 0 to the block_resize QMP command either.

Actually, it's a hack, because the block_resize QMP command does not
actually do special handling for the value 0. It's just that in the
case of a block device, QEMU won't try to resize it (and not fail for
shrinkage). But the size in the raw driver's BlockDriverState is
temporarily set to 0 (which is not nice), until the sector count is
refreshed, where raw_co_getlength is called, which queries the new
size and sets the size in the raw driver's BlockDriverState again as a
side effect. It's not known to cause any issues, but bdrv_getlength is
a coroutine wrapper starting from QEMU 8.0.0, and it's just better to
avoid setting a completely wrong value even temporarily. Just pass the
actually requested size like is done for LVM(thin) and ZFS.

[0]: https://lists.proxmox.com/pipermail/pve-devel/2017-January/025060.html

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agonet: Skip and warn of interfaces without bridge
Christian Ebner [Wed, 12 Apr 2023 08:45:13 +0000 (10:45 +0200)]
net: Skip and warn of interfaces without bridge

Handle and warn about network interfaces which are not attached to
any bridge because the user actively removed it from the VM config.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
11 months agoqmrestore: improve description of bwlimit parameter
Stefan Hanreich [Wed, 29 Mar 2023 12:34:34 +0000 (14:34 +0200)]
qmrestore: improve description of bwlimit parameter

This makes the description consistent with the other places that
have bwlimit as a parameter as well.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
11 months agofix #4737: qmeventd: gracefully handle interrupted epoll_wait call
Fiona Ebner [Wed, 24 May 2023 10:30:58 +0000 (12:30 +0200)]
fix #4737: qmeventd: gracefully handle interrupted epoll_wait call

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
12 months agotests: fix invoking migration tests with make
Fiona Ebner [Mon, 22 May 2023 12:37:08 +0000 (14:37 +0200)]
tests: fix invoking migration tests with make

Even if between single quotes, the dollar sign needs to be escaped
here. Otherwise, there will be an error
> Search pattern not terminated at -e line 1.
and no migration tests would be run. The error did not lead to
aborting though, making it harder to notice.

Fixes: aac89f6c ("tests: avoid calling test script to get target names")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
12 months agobump version to 8.0.0
Fiona Ebner [Fri, 19 May 2023 07:33:28 +0000 (09:33 +0200)]
bump version to 8.0.0

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 [ T: slightly rework changelog ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: rework clean target, avoid doc-gen one
Thomas Lamprecht [Fri, 19 May 2023 12:17:45 +0000 (14:17 +0200)]
buildsys: rework clean target, avoid doc-gen one

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: use more central dpkg packaging makefile
Thomas Lamprecht [Fri, 19 May 2023 12:17:25 +0000 (14:17 +0200)]
buildsys: use more central dpkg packaging makefile

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agotests: avoid calling test script to get target names
Thomas Lamprecht [Fri, 19 May 2023 11:12:55 +0000 (13:12 +0200)]
tests: avoid calling test script to get target names

As otherwise we couple *all* Makefile targets to the dependencies of
the test script, even for a simple make call (e.g., done on building
the source), so use a much simpler heuristic that just depends on
perl, which is essential in Debian.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agotests: simplify outputting available migration test names
Thomas Lamprecht [Fri, 19 May 2023 11:07:12 +0000 (13:07 +0200)]
tests: simplify outputting available migration test names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
14 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>
14 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>
14 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>
16 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>
16 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>
17 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>