]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
2 years agofix #2429: allow to specify cloud-init vendor snippet via cicustom
Constantin Herold [Sat, 30 Oct 2021 14:49:41 +0000 (16:49 +0200)]
fix #2429: allow to specify cloud-init vendor snippet via cicustom

Signed-off-by: Constantin Herold <proxmox8914@herold.me>
Reviewed-by: Mira Limbeck <m.limbeck@proxmox.com>
2 years agoagent hotplug: small style cleanups & comment addition
Thomas Lamprecht [Thu, 4 Nov 2021 07:45:31 +0000 (08:45 +0100)]
agent hotplug: small style cleanups & comment addition

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoqemu-agent: allow hotplug of fstrim_cloned_disk option.
Alexandre Derumier [Wed, 6 Oct 2021 21:58:44 +0000 (23:58 +0200)]
qemu-agent: allow hotplug of fstrim_cloned_disk option.

This option don't have any impact on device itself.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2 years agotest: cfg2cmd: fix command output
Thomas Lamprecht [Wed, 3 Nov 2021 15:45:57 +0000 (16:45 +0100)]
test: cfg2cmd: fix command output

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agovm_commandline: reduce line bloat
Thomas Lamprecht [Wed, 3 Nov 2021 15:21:05 +0000 (16:21 +0100)]
vm_commandline: reduce line bloat

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoprint_keyboarddevice_full: drop unused machine parameter
Thomas Lamprecht [Wed, 3 Nov 2021 15:20:41 +0000 (16:20 +0100)]
print_keyboarddevice_full: drop unused machine parameter

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoscsi_inquiry: refactor and code cleanup
Thomas Lamprecht [Wed, 3 Nov 2021 15:19:10 +0000 (16:19 +0100)]
scsi_inquiry: refactor and code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agokvm_user_version: add explicit return statement
Thomas Lamprecht [Wed, 3 Nov 2021 15:18:00 +0000 (16:18 +0100)]
kvm_user_version: add explicit return statement

while perl returns the (scalar) result of the last expression
automatically its still nicer to explicitly do so..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodrives: ro: code reduction/refactor
Thomas Lamprecht [Wed, 27 Oct 2021 15:00:24 +0000 (17:00 +0200)]
drives: ro: code reduction/refactor

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodrives: expose 'readonly' flag of qemu for scsi/virtio
Dominik Csapak [Wed, 27 Oct 2021 11:35:27 +0000 (13:35 +0200)]
drives: expose 'readonly' flag of qemu for scsi/virtio

this allows a user to set a drive to 'read-only'. This can be useful
if a disk should not be written to, or if the backing file/source is
not writable (like a mapped pbs backup to /dev/loopX).

the option is named 'ro', to achieve consistency with containers

while this could also be achieved by setting 'snapshot=1', this would
create a temporary file in /var/tmp which can get quite big.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agovzdump: increase timeout for QMP 'cont' after backup start
Stefan Reiter [Wed, 27 Oct 2021 11:34:54 +0000 (13:34 +0200)]
vzdump: increase timeout for QMP 'cont' after backup start

Since 'backup' can now work asynchronously, QEMU may not be ready to
receive the next QMP command ('cont') immediately. Thus, increase the
timeout, to avoid aborted backups in slow environments.

There may be a deeper QEMU bug hidden under the covers here too, but at
least one user reported success with simply increasing the timeout:
https://forum.proxmox.com/threads/pve7-pbs2-backup-timeout-qmp-command-cont-failed-got-timeout.95212/page-2#post-426261

See also:
https://bugzilla.proxmox.com/show_bug.cgi?id=3693
https://forum.proxmox.com/threads/problem-seit-update-auf-7-0.97388/
https://forum.proxmox.com/threads/error-with-backup-when-backing-up-qmp-command-query-backup-failed-got-wrong-command-id.88017/page-3#post-416339

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agovm start: only print tpm-related message if there is an instance
Fabian Ebner [Wed, 27 Oct 2021 06:49:37 +0000 (08:49 +0200)]
vm start: only print tpm-related message if there is an instance

Otherwise, this can produce an undef warning and be misleading.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix removing cpulimit on running vm
Dominik Csapak [Tue, 12 Oct 2021 11:20:52 +0000 (13:20 +0200)]
fix removing cpulimit on running vm

like in pve-container:
04a62bd ("fix #3506: config: fix removing the cpulimit of a running CT")

reported in the forums (no bug# yet):
https://forum.proxmox.com/threads/issue-with-removing-cpu-limit-from-running-vm.97799/

note that this will break CGv1 without the following fix installed:
https://git.proxmox.com/?p=pve-common.git;a=commitdiff;h=d37a71867

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Oguz Bektas <o.bektas@proxmox.com>
Reviewed-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agouse non SMM ovmf code file for i440fx machines
Dominik Csapak [Mon, 11 Oct 2021 12:10:24 +0000 (14:10 +0200)]
use non SMM ovmf code file for i440fx machines

ovmf with SMM enabled will not boot on i440fx (hangs on graphics
initialization), so load the non SMM variant.

should be no issue regarding live-migration since it never worked with
this anyway.

adapts the test and adds one with q35

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Stefan Reiter <s.reiter@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agobump version to 7.0-17
Thomas Lamprecht [Thu, 21 Oct 2021 09:58:18 +0000 (11:58 +0200)]
bump version to 7.0-17

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig properties: refactor skipping internal options to declarative
Thomas Lamprecht [Thu, 21 Oct 2021 06:23:08 +0000 (08:23 +0200)]
config properties: refactor skipping internal options to declarative

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotests: fixup simple1-template.conf.cmd
Thomas Lamprecht [Wed, 20 Oct 2021 16:18:31 +0000 (18:18 +0200)]
tests: fixup simple1-template.conf.cmd

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocode and indentation cleanups
Thomas Lamprecht [Wed, 20 Oct 2021 15:31:45 +0000 (17:31 +0200)]
code and indentation cleanups

fix the classic indentation error on `additionalProperties` in the
main QEMU API

drop some not so useful empty lines to avoid making rather huge
methods even bigger (more intimidating, less on screen to grasp the
full picture).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig2cmd: code cleanup and indentation reduction
Thomas Lamprecht [Wed, 20 Oct 2021 13:39:20 +0000 (15:39 +0200)]
config2cmd: code cleanup and indentation reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoindentation and fixes
Thomas Lamprecht [Wed, 20 Oct 2021 10:56:57 +0000 (12:56 +0200)]
indentation and fixes

with some style/tw thrown in-between

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix overly long/short lines and typos
Thomas Lamprecht [Wed, 20 Oct 2021 06:24:08 +0000 (08:24 +0200)]
fix overly long/short lines and typos

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoostype: support Windows 11/Server 2022
Stefan Reiter [Mon, 11 Oct 2021 12:55:18 +0000 (14:55 +0200)]
ostype: support Windows 11/Server 2022

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoRevert "config_aware_timeout: add 5s if TPM is configured"
Thomas Lamprecht [Mon, 18 Oct 2021 07:47:42 +0000 (09:47 +0200)]
Revert "config_aware_timeout: add 5s if TPM is configured"

This reverts commit d4e1e1f86232c2c0e2924302fab2f968ef8218b1.

It's bogus, the VM start timeout is only starting to tick after we
started the TPM already...

2 years agoconfig_aware_timeout: add 5s if TPM is configured
Thomas Lamprecht [Mon, 18 Oct 2021 07:43:14 +0000 (09:43 +0200)]
config_aware_timeout: add 5s if TPM is configured

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoswtmp: die early in startup check
Thomas Lamprecht [Mon, 18 Oct 2021 07:42:36 +0000 (09:42 +0200)]
swtmp: die early in startup check

no point in waiting another 50 ms if we know that we'd die already
anyway..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocode style: readability cleanups
Thomas Lamprecht [Mon, 18 Oct 2021 07:40:03 +0000 (09:40 +0200)]
code style: readability cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoswtpm: wait for pidfile
Stefan Reiter [Thu, 14 Oct 2021 09:28:49 +0000 (11:28 +0200)]
swtpm: wait for pidfile

swtpm may take a little bit to daemonize, so the pidfile might not be
available right after run_command. Causes an ugly warning about using an
undefined value in a match, so wait up to 5s for it to appear.

Note that in testing this loop only ever got to the first or second
iteration, so I believe the timeout duration should be more than enough.

Also add a missing 'usleep' import, 'usleep' was used before but never
imported, apparently the other case never got triggered...

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agosnapshot: fix tpmstate with rbd
Stefan Reiter [Thu, 14 Oct 2021 09:28:48 +0000 (11:28 +0200)]
snapshot: fix tpmstate with rbd

QEMU doesn't know about the tpmstate, so 'do_snapshots_with_qemu' should
never return true in that case. Note that inconsistencies related to
snapshot timing do not matter much, as the actual TPM data is exported
together with other device state by QEMU anyway.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agovm_start: better name systemd scope property variable
Thomas Lamprecht [Mon, 18 Oct 2021 07:41:18 +0000 (09:41 +0200)]
vm_start: better name systemd scope property variable

`properties` is a bit ambiguous and as we have scope and start
runtime properties in the same scope it's good to avoid that
ambiguity.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocloudinit: opennebula: refactor to reduce code bloat
Thomas Lamprecht [Fri, 15 Oct 2021 14:55:27 +0000 (16:55 +0200)]
cloudinit: opennebula: refactor to reduce code bloat

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocloudinit: better use of string variable interpolation
Thomas Lamprecht [Fri, 15 Oct 2021 14:54:27 +0000 (16:54 +0200)]
cloudinit: better use of string variable interpolation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci: prepare: improve no-IOMMU error message
Thomas Lamprecht [Fri, 15 Oct 2021 17:57:58 +0000 (19:57 +0200)]
pci: prepare: improve no-IOMMU error message

give some context

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3258: block vm start when pci device is already in use
Dominik Csapak [Thu, 7 Oct 2021 13:45:31 +0000 (15:45 +0200)]
fix #3258: block vm start when pci device is already in use

on vm start, we reserve all pciids that we use, and
remove the reservation again in vm_stop_cleanup

first with only a time-based reservation but after the vm is started,
we reserve again but with the pid.

for this, we have to move the start_timeout calculation above the
hostpci handling.

also moved the pci initialization out of the conf parsing loop
so that we can reserve all ids before we actually touch any of them

while touching the lines, fix the indentation

this way, when a vm starts with a pci device that is already configured
for a different running vm, will not be started and the user gets
the error that the device is already in use

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci reservation: rework helpers style and readability wise
Thomas Lamprecht [Fri, 15 Oct 2021 16:08:22 +0000 (18:08 +0200)]
pci reservation: rework helpers style and readability wise

both style and readability are naturally subjective to a certain
degree...

Also, this patch mixes a bit much into one thing, but splitting that
up would mean lots of work I just wanted to avoid, sorry about that.

Among other things:

- avoid a level of indentation in the reserve loop
- rename pciids to reservation_list where it was a better fit
- make reserve set either pid or time to avoid suggesting that we
  save both
- rename parameters to requested/dropped IDs for easier understanding
  what's going on in the code
- avoid old_pid/pid, use running_pid and reserver_pid instead to
  clarify what they actually mean
- drop useless returns to avoid suggesting the return value has any
  use and save some lnes
- use a hash slice to delete all dropped IDs at once, shorter and
  faster
- use 5 second timeout for reservation, this does nothing intensive
  nor does it wait for anything, so the critical section should be
  really short, 5s is really long enough for a wait..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci reservation: move lock/reservation file into /run/qemu-server
Thomas Lamprecht [Fri, 15 Oct 2021 15:02:21 +0000 (17:02 +0200)]
pci reservation: move lock/reservation file into /run/qemu-server

lck needs to die, the days of any 8.3 file naming schemes are long
gone (in the server space that is ;)

/var/run is /run so use the shorter, and while /var/lock is a OK
place for the locks we try to keep lock and lock-object together
nowadays. The qemu-server sub-directory avoids overly cluttering the
already crowded top-level /run dir

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci reservation: encode locklessness of parsers in name
Thomas Lamprecht [Fri, 15 Oct 2021 12:44:47 +0000 (14:44 +0200)]
pci reservation: encode locklessness of parsers in name

to avoid that they're misused

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci: add helpers to (un)reserve pciids for a vm
Dominik Csapak [Thu, 7 Oct 2021 13:45:30 +0000 (15:45 +0200)]
pci: add helpers to (un)reserve pciids for a vm

saves a list of pciid <-> vmid mappings in /var/run
that we can check when we start a vm

if we're not given a pid but a timeout, we save the time when the
reservation will run out (current time + timeout + 5s) since each
vm start (until we can save the pid) varies from config to config

reserve_pci_usage and remove_pci_reservation always expect a list of ids
so that we can update the reservation for a vm all at once

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agopci related code cleanups
Thomas Lamprecht [Mon, 11 Oct 2021 06:39:28 +0000 (08:39 +0200)]
pci related code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci: use local helper to generated generate_mdev_uuid
Thomas Lamprecht [Mon, 11 Oct 2021 06:38:26 +0000 (08:38 +0200)]
pci: use local helper to generated generate_mdev_uuid

avoid (API) leaking qemu-server specific stuff into pve-common

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci: prepare_pci_device: fixup parameter name
Thomas Lamprecht [Mon, 11 Oct 2021 06:37:35 +0000 (08:37 +0200)]
pci: prepare_pci_device: fixup parameter name

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci: refactor pci device preparation
Dominik Csapak [Thu, 7 Oct 2021 13:45:29 +0000 (15:45 +0200)]
pci: refactor pci device preparation

makes the vm start a bit less crowded

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 7.0-16
Thomas Lamprecht [Tue, 5 Oct 2021 18:22:22 +0000 (20:22 +0200)]
bump version to 7.0-16

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotests: cfg2cmd: add 4MB-EFI-secboot and TPM test
Thomas Lamprecht [Tue, 5 Oct 2021 18:20:51 +0000 (20:20 +0200)]
tests: cfg2cmd: add 4MB-EFI-secboot and TPM test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoefi: use vendor-agonstic "pre-enrolled-keys" + description fix
Thomas Lamprecht [Tue, 5 Oct 2021 16:35:25 +0000 (18:35 +0200)]
efi: use vendor-agonstic "pre-enrolled-keys" + description fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: bump versioned dependency on pve-edk2-firmware 3.20210831-1
Thomas Lamprecht [Tue, 5 Oct 2021 16:09:38 +0000 (18:09 +0200)]
d/control: bump versioned dependency on pve-edk2-firmware 3.20210831-1

to ensure the newer OVMF 4MB builds with secureboot/SMM-enforcement
are available.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoovmf: support secure boot with 4m and 4m-ms efidisk types
Stefan Reiter [Tue, 5 Oct 2021 16:02:06 +0000 (18:02 +0200)]
ovmf: support secure boot with 4m and 4m-ms efidisk types

Provide support for secure boot by using the new "4m" and "4m-ms"
variants of the OVMF code/vars templates. This is specified on the
efidisk via the 'efitype' and 'ms-keys' parameters.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agopci: to not capture first group in PCIRE
Dominik Csapak [Tue, 5 Oct 2021 13:11:58 +0000 (15:11 +0200)]
pci: to not capture first group in PCIRE

we do not need this group, but want to use the regex where we have
multiple groups, so make it a non-capture group

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 7.0-15
Thomas Lamprecht [Tue, 5 Oct 2021 05:25:22 +0000 (07:25 +0200)]
bump version to 7.0-15

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: add dependency for swtpm and swtpm-tools
Thomas Lamprecht [Tue, 5 Oct 2021 05:09:12 +0000 (07:09 +0200)]
d/control: add dependency for swtpm and swtpm-tools

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: wrap-and-sort -tkn
Thomas Lamprecht [Tue, 5 Oct 2021 05:08:32 +0000 (07:08 +0200)]
d/control: wrap-and-sort -tkn

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agostart: warn about terminating the swtpm instance
Thomas Lamprecht [Tue, 5 Oct 2021 05:05:39 +0000 (07:05 +0200)]
start: warn about terminating the swtpm instance

if only to notice the user about the PID if the termination fails

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotrivial: indentation/formatting fixup
Thomas Lamprecht [Tue, 5 Oct 2021 05:05:07 +0000 (07:05 +0200)]
trivial: indentation/formatting fixup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3075: add TPM v1.2 and v2.0 support via swtpm
Stefan Reiter [Mon, 4 Oct 2021 15:29:20 +0000 (17:29 +0200)]
fix #3075: add TPM v1.2 and v2.0 support via swtpm

Starts an instance of swtpm per VM in it's systemd scope, it will
terminate by itself if the VM exits, or be terminated manually if
startup fails.

Before first use, a TPM state is created via swtpm_setup. State is
stored in a 'tpmstate0' volume, treated much the same way as an efidisk.

It is migrated 'offline', the important part here is the creation of the
target volume, the actual data transfer happens via the QEMU device
state migration process.

Move-disk can only work offline, as the disk is not registered with
QEMU, so 'drive-mirror' wouldn't work. swtpm itself has no method of
moving a backing storage at runtime.

For backups, a bit of a workaround is necessary (this may later be
replaced by NBD support in swtpm): During the backup, we attach the
backing file of the TPM as a read-only drive to QEMU, so our backup
code can detect it as a block device and back it up as such, while
ensuring consistency with the rest of disk state ("snapshot" semantic).

The name for the ephemeral drive is specifically chosen as
'drive-tpmstate0-backup', diverging from our usual naming scheme with
the '-backup' suffix, to avoid it ever being treated as a regular drive
from the rest of the stack in case it gets left over after a backup for
some reason (shouldn't happen).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoapi: template: invert lock and fork
Fabian Grünbichler [Fri, 10 Sep 2021 07:48:20 +0000 (09:48 +0200)]
api: template: invert lock and fork

like for other API calls, repeat the cheap checks done for early abort
before forking and without locks after forking and obtaining the lock,
and only hold the flock in the forked worker instead of across the fork.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: return UPID in template call
Fabian Grünbichler [Fri, 10 Sep 2021 07:48:19 +0000 (09:48 +0200)]
api: return UPID in template call

as reported on the forum, this is currently missing, making status
queries via the API impossible:

https://forum.proxmox.com/threads/create-vm-via-api-interface.95942/#post-416084

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agovm_destroy: remove pending volumes as well
Fabian Grünbichler [Wed, 29 Sep 2021 09:45:07 +0000 (11:45 +0200)]
vm_destroy: remove pending volumes as well

if a volume is only referenced in the pending section of a config it was
previously not removed when removing the VM, unless the non-default
'remove unreferenced disks' option was enabled.

keeping track of volume IDs which we attempt to remove gets rid of false
warnings in case a volume is referenced both in the config and the
pending section, or multiple times in the config for other reasons.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 7.0-14
Thomas Lamprecht [Wed, 22 Sep 2021 07:32:25 +0000 (09:32 +0200)]
bump version to 7.0-14

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: code style, use up to 100cc if it helps to reduce line-bloat
Thomas Lamprecht [Wed, 22 Sep 2021 07:26:18 +0000 (09:26 +0200)]
migrate: code style, use up to 100cc if it helps to reduce line-bloat

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: simplify code and add comment
Thomas Lamprecht [Wed, 22 Sep 2021 07:25:53 +0000 (09:25 +0200)]
migrate: simplify code and add comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: use correct target storage id for checks
Fabian Ebner [Fri, 25 Jun 2021 12:32:05 +0000 (14:32 +0200)]
migrate: use correct target storage id for checks

The '--targetstorage' parameter does not apply to shared storages.

Example for a problem solved with the enabled check: Given a VM with
images only on a shared storage 'storeA', not available on the target
node (i.e. restricted by the nodes property). Then using
'--targetstorage storeB' would make offline migration suddenly
"work", but of course the disks would not be accessible and then
trying to migrate back would fail...

Example for a problem solved with the content type check: if a
VM had a shared ISO image, and there was a '--targetstorage storeA'
option, availablity of the 'iso' content type is checked for
'storeA', which is wrong as the ISO would not be moved to that
storage.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agowhitespace/indentation fixes & cleanups
Thomas Lamprecht [Thu, 9 Sep 2021 15:50:21 +0000 (17:50 +0200)]
whitespace/indentation fixes & cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3608: unbreak removal of scsi controller
Fabian Grünbichler [Thu, 9 Sep 2021 12:40:42 +0000 (14:40 +0200)]
fix #3608: unbreak removal of scsi controller

the assumption that the index of the controller matches that of the last
removed drive only holds for virtio-scsi-single controller, which makes
the old code print a warning when removing the last drive of a
non-virtio-scsi-single controller except when the indices line up by
chance.

we can simply only call a simplified qemu_iothread_del when removing a
scsi disk of a VM with the virtio-scsi-single controller, and skip the
call for the other controllers which don't support io-threads anyway.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agofix #3581: pass size via argument for memory-backend-ram qmp call
Constantin Herold [Tue, 17 Aug 2021 15:34:34 +0000 (17:34 +0200)]
fix #3581: pass size via argument for memory-backend-ram qmp call

Signed-off-by: Constantin Herold <proxmox8914@herold.me>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump version to 7.0-13
Fabian Grünbichler [Thu, 5 Aug 2021 12:03:33 +0000 (14:03 +0200)]
bump version to 7.0-13

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoapi2: only add ide drives for non-legacy bootorders
Dominik Csapak [Thu, 5 Aug 2021 11:53:01 +0000 (13:53 +0200)]
api2: only add ide drives for non-legacy bootorders

@bootorder only contains entries for non-legacy bootorder entries,
but the default one contains all cdroms anyway, and if the user
explicitely disabled cdroms, it is ok to not add them back
for the new cdrom drive.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 7.0-12
Thomas Lamprecht [Fri, 30 Jul 2021 14:53:48 +0000 (16:53 +0200)]
bump version to 7.0-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobootorder: fix double entry on cdrom edit
Dominik Csapak [Fri, 30 Jul 2021 11:28:39 +0000 (13:28 +0200)]
bootorder: fix double entry on cdrom edit

We unconditionally added an entry into the bootorder whenever we
edited the drive, even if it was already in there. Instead we only want to do
that if the bootorder list does not contain it already.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoFix #3371: parse ovf: Allow dots in VM name
Dominic Jäger [Wed, 21 Jul 2021 10:06:48 +0000 (12:06 +0200)]
Fix #3371: parse ovf: Allow dots in VM name

Dots are allow in PVE VM names, so they should not be dropped during import.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2 years agobump version to 7.0-11
Thomas Lamprecht [Fri, 23 Jul 2021 09:08:53 +0000 (11:08 +0200)]
bump version to 7.0-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #2563: allow live migration with local cloud-init disk
Mira Limbeck [Thu, 15 Jul 2021 12:33:18 +0000 (14:33 +0200)]
fix #2563: allow live migration with local cloud-init disk

The content of the ISO should be the same on both nodes, so offline
migrate the ISO, but don't regenerate it on VM start on the target node.

This way even with snippets the content will not change during live
migration.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2 years agoapi: always add new CD drives to bootorder
Stefan Reiter [Mon, 5 Jul 2021 09:14:12 +0000 (11:14 +0200)]
api: always add new CD drives to bootorder

Attaching an ISO image to a VM is usually/often done for two reasons:
* booting an installer image
* supplying additional drivers to an installer (e.g. virtio)

Both of these cases (the latter at least with SeaBIOS and the Windows
installer) require the disk to be marked as bootable.

For this reason, enable the bootable flag for all new CDROM drives
attached to a VM by adding it to the bootorder list. It is appended to
the end, as otherwise it would cause new drives to boot before already
existing boot targets, which would be a more grave (and IMO bad)
behaviour change.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agolive-restore: fail early if target storage doesn't exist
Stefan Reiter [Thu, 8 Jul 2021 11:25:33 +0000 (13:25 +0200)]
live-restore: fail early if target storage doesn't exist

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agolvm: avoid the use of IO uring
Thomas Lamprecht [Fri, 23 Jul 2021 08:55:16 +0000 (10:55 +0200)]
lvm: avoid the use of IO uring

there may be a kernel issue or a bug in how QEMU uses io_uring, but
we have users that report crashes which f.ebner could see on some
workloads, not really deterministic though and it seems that in newer
kernel versions (5.12+) the crash becomes a hang

While we're closing in on the actual issue here (which could be the
same as for RBD) let's disable io_uring for LVM.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonic: support e1000e
Thomas Lamprecht [Fri, 16 Jul 2021 17:09:57 +0000 (19:09 +0200)]
nic: support e1000e

That bit of code seems to be enough here, tested with

qm set VMID --net1 e1000e=EA:93:42:22:10:D8,bridge=vmbr0

on a Alpine Linux and a Windows Server 2016 VM.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agonic: one per line and sort
Thomas Lamprecht [Fri, 16 Jul 2021 16:57:38 +0000 (18:57 +0200)]
nic: one per line and sort

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-10
Thomas Lamprecht [Wed, 7 Jul 2021 12:56:40 +0000 (14:56 +0200)]
bump version to 7.0-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocfg2cmd: avoid io_uring with LVM and write{back, through} cache
Fabian Ebner [Wed, 7 Jul 2021 11:28:35 +0000 (13:28 +0200)]
cfg2cmd: avoid io_uring with LVM and write{back, through} cache

Reported in the community forum[0]. Also tried with LVM-thin, but it
doesn't seem to be affected.

See also 628937f53acde52f7257ca79f574c87a45f392e7 for the same fix for
krbd.

[0]: https://forum.proxmox.com/threads/after-upgrade-to-7-0-all-vms-dont-boot.92019/post-401017

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 7.0-9
Thomas Lamprecht [Wed, 7 Jul 2021 10:02:18 +0000 (12:02 +0200)]
bump version to 7.0-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix cpuunits defaults regression
Thomas Lamprecht [Wed, 7 Jul 2021 10:01:27 +0000 (12:01 +0200)]
fix cpuunits defaults regression

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-8
Thomas Lamprecht [Wed, 7 Jul 2021 08:28:01 +0000 (10:28 +0200)]
bump version to 7.0-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconf: cpuunits: adapt description and defaults for cgroup v2
Thomas Lamprecht [Wed, 7 Jul 2021 08:27:05 +0000 (10:27 +0200)]
conf: cpuunits: adapt description and defaults for cgroup v2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocpu weight: clamp to maximum for cgroup v2
Thomas Lamprecht [Wed, 7 Jul 2021 07:36:17 +0000 (09:36 +0200)]
cpu weight: clamp to maximum for cgroup v2

In v2 the range is [1, 10000], but the API allows the old limits from
2 to 262144, so clamp the upper for v2.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi2: fix vmconfig_apply_pending errors handling
Alexandre Derumier [Mon, 5 Jul 2021 22:02:30 +0000 (00:02 +0200)]
api2: fix vmconfig_apply_pending errors handling

commit
https://git.proxmox.com/?p=qemu-server.git;a=commit;h=eb5e482ded9ae6aeb6575de9441b79b90a5de531

have introduced error handling for offline pending apply,

-               PVE::QemuServer::vmconfig_apply_pending($vmid, $conf, $storecfg, $running);
+               PVE::QemuServer::vmconfig_apply_pending($vmid, $conf, $storecfg, $running, $errors);

 sub vmconfig_apply_pending {
-    my ($vmid, $conf, $storecfg) = @_;
+    my ($vmid, $conf, $storecfg, $errors) = @_;

but they was wrong nonused $running param, so currently $errors are not correctly handled

Fixes: eb5e482ded ("vmconfig_apply_pending: add error handling")
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Tested-by: Oguz Bektas <o.bektas@proxmox.com>
2 years agobump version to 7.0-7
Thomas Lamprecht [Mon, 5 Jul 2021 18:49:55 +0000 (20:49 +0200)]
bump version to 7.0-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofurther improve on #3329, ensure write-back is used over write-around
Thomas Lamprecht [Mon, 5 Jul 2021 18:47:42 +0000 (20:47 +0200)]
further improve on #3329, ensure write-back is used over write-around

Suggested-by: Rick Altherr <kc8apf@kc8apf.net>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-6
Thomas Lamprecht [Fri, 2 Jul 2021 07:45:10 +0000 (09:45 +0200)]
bump version to 7.0-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agolive-restore: add another comment for efidisk special case just to be sure
Thomas Lamprecht [Thu, 1 Jul 2021 10:57:11 +0000 (12:57 +0200)]
live-restore: add another comment for efidisk special case just to be sure

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agolive-restore: preload efidisk before starting VM
Stefan Reiter [Thu, 1 Jul 2021 09:37:29 +0000 (11:37 +0200)]
live-restore: preload efidisk before starting VM

The efidisk never got restored correctly before, since we don't use the
generic print_drive_commandline_full for it, and as such it didn't get a
backing image attached. This not only causes the efidisk data to be lost
on restore, but also an error at the end, since we try to remove a
non-existing PBS blockdev.

Since it is attached differently to a regular drive, adding PBS backing
would be more difficult, but not to worry: an efidisk is small enough
that it doesn't hurt performance to just restore it via the regular
mechanism before starting the VM, and simply excluding it from the live
restore entirely.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agocfg2cmd/drive: don't use io_uring for krbd with wb/wt cache
Stefan Reiter [Wed, 30 Jun 2021 15:18:17 +0000 (17:18 +0200)]
cfg2cmd/drive: don't use io_uring for krbd with wb/wt cache

As reported here and locally reproduced:
https://forum.proxmox.com/threads/efi-vms-wont-start-under-7-beta-with-writeback-cache.91629/

This configuration is currently broken. Until we figure out how to fix
it properly, we can just have this (luckily very narrow) config pattern
fall back to aio=threads as it used to.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agobump version to 7.0-5
Thomas Lamprecht [Thu, 24 Jun 2021 16:58:22 +0000 (18:58 +0200)]
bump version to 7.0-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #2175: PVE/API2/Qemu: update_vm_api: check old drive for permissions too
Dominik Csapak [Thu, 24 Jun 2021 14:25:11 +0000 (16:25 +0200)]
fix #2175: PVE/API2/Qemu: update_vm_api: check old drive for permissions too

otherwise a user with only VM.Config.CDROM can detach a disk from a VM
by updating it to a cdrom drive

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoPVE/API2/Qemu/update_vm_api: refactor drive permission check
Dominik Csapak [Thu, 24 Jun 2021 14:25:10 +0000 (16:25 +0200)]
PVE/API2/Qemu/update_vm_api: refactor drive permission check

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 7.0-5
Thomas Lamprecht [Thu, 24 Jun 2021 16:45:57 +0000 (18:45 +0200)]
bump version to 7.0-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocfg2cmd: add btrfs-store and test for cache mode
Thomas Lamprecht [Thu, 24 Jun 2021 16:41:45 +0000 (18:41 +0200)]
cfg2cmd: add btrfs-store and test for cache mode

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodon't default to O_DIRECT on btrfs without nocow
Wolfgang Bumiller [Thu, 24 Jun 2021 14:58:33 +0000 (16:58 +0200)]
don't default to O_DIRECT on btrfs without nocow

otherwise it'll produce a whole lot of checksum errors

and while this would be nice as a storage feature check,
it's hard to be 100% accurate there anyway since a directory
storage can point anywhere, like for instance a btrfs
directory, causing the same issue...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump version to 7.0-4
Thomas Lamprecht [Wed, 23 Jun 2021 10:57:31 +0000 (12:57 +0200)]
bump version to 7.0-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotemplate: add -snapshot to KVM command
Fabian Grünbichler [Fri, 4 Jun 2021 09:47:47 +0000 (11:47 +0200)]
template: add -snapshot to KVM command

this allows effectively setting ALL volumes as read-only, even if the
disk controller does not support it. without it, IDE and SATA disks
with (base) volumes which are marked read-only/immutable on the storage
level prevent the template VM from starting for backup purposes.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agotest: add template drive read-only tests
Fabian Grünbichler [Fri, 4 Jun 2021 09:47:46 +0000 (11:47 +0200)]
test: add template drive read-only tests

ensuring the current behaviour:

templates will pass readonly=on to Qemu, except for SATA and IDE drives
which don't support that flag.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agotemplate: mark efidisk as read-only
Fabian Grünbichler [Fri, 4 Jun 2021 09:47:45 +0000 (11:47 +0200)]
template: mark efidisk as read-only

otherwise backups of templates using UEFI fail with storages like LVM
thin, where the volumes are not writable. disk controllers like IDE and
SATA that don't support being read-only are still broken for UEFI.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
[ drop the readonly=off when not required, resolve merger conflict
  from Dominik's EFI disk cache mode fix ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodrive: factor out read-only helper
Fabian Grünbichler [Fri, 4 Jun 2021 09:47:44 +0000 (11:47 +0200)]
drive: factor out read-only helper

we also need it for efidisks.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>