]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
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>
2 years agotest: unbreak restore_config_test
Fabian Grünbichler [Fri, 4 Jun 2021 09:47:43 +0000 (11:47 +0200)]
test: unbreak restore_config_test

for unprivileged users (and possibly some root setups). reading from
pmxcfs now results in a hard error for unprivileged users, so there
might be some more of these lurking somewhere..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoapi: update vm: correctly handle warnings status for delayed task
Fabian Ebner [Wed, 12 May 2021 12:32:58 +0000 (14:32 +0200)]
api: update vm: correctly handle warnings status for delayed task

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agocli tools: correctly handle warnings task status
Fabian Ebner [Wed, 12 May 2021 12:32:57 +0000 (14:32 +0200)]
cli tools: correctly handle warnings task status

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoallow migrating raw btrfs volumes
Wolfgang Bumiller [Tue, 22 Jun 2021 12:18:28 +0000 (14:18 +0200)]
allow migrating raw btrfs volumes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agod/control: bump versioned dependency for pve-common
Thomas Lamprecht [Wed, 23 Jun 2021 10:16:34 +0000 (12:16 +0200)]
d/control: bump versioned dependency for pve-common

to ensure the newer systemd properties required for KillMode=none
replacement can be used

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate prepare: make content type check generic
Thomas Lamprecht [Wed, 23 Jun 2021 10:15:42 +0000 (12:15 +0200)]
migrate prepare: make content type check generic

to avoid false-positives, e.g., from a ISO on a ISO only storage.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate prepare: use also explicit variable for storecfg
Thomas Lamprecht [Wed, 23 Jun 2021 10:15:16 +0000 (12:15 +0200)]
migrate prepare: use also explicit variable for storecfg

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocheck_storage_availability: make content type check generic
Thomas Lamprecht [Wed, 23 Jun 2021 10:03:35 +0000 (12:03 +0200)]
check_storage_availability: make content type check generic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agouse KillMode 'process' for systemd scope
Stefan Reiter [Mon, 21 Jun 2021 16:35:41 +0000 (18:35 +0200)]
use KillMode 'process' for systemd scope

KillMode 'none' is deprecated, and systemd loudly complains about that
in the journal. To avoid the warning, but keep the behaviour the same,
use KillMode 'process'.

This mode does two things differently, which we have to stop it from
doing:
* it sends SIGTERM right when the scope is cancelled (e.g. on shutdown)
 -> but only to the "root" process, which in our case is the worker
 instance forking QEMU, so it is already dead by the time this happens
* it sends SIGKILL to *all* children after a timeout
 -> can be avoided by setting either SendSIGKILL to false, or
 TimeoutStopUSec to infinity - for safety, we do both

In my testing, this replicated the previous behaviour exactly, but
without using the deprecated 'none' mode.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agovm_start: check if storages of volumes support correct content-type
Lorenz Stechauner [Tue, 22 Jun 2021 12:30:30 +0000 (14:30 +0200)]
vm_start: check if storages of volumes support correct content-type

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2 years agocfg2cmd: make io_uring default
Stefan Reiter [Mon, 21 Jun 2021 15:33:18 +0000 (17:33 +0200)]
cfg2cmd: make io_uring default

The 'aio' setting is not visible to the guest, and so can be changed
during migrations or snapshots without issue. It is thus only
dependendent on the actual QEMU version being >= 6.0, not machine
version.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoenable io-uring support
Stefan Reiter [Mon, 21 Jun 2021 15:33:17 +0000 (17:33 +0200)]
enable io-uring support

Note that the value in this enum directly represents the value passed to
QEMU, so we need to use the underscore.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agobump version to 7.0-3
Thomas Lamprecht [Mon, 21 Jun 2021 09:15:21 +0000 (11:15 +0200)]
bump version to 7.0-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: enforce that image content type is available
Fabian Ebner [Fri, 18 Jun 2021 10:59:34 +0000 (12:59 +0200)]
migrate: enforce that image content type is available

and use it for the vdisk_list call too. This avoids scanning (and picking up
volumes from!) storages that are not even configured to hold images.

Previously, the content type was only enforced when a storage map was present.

Also serves a bit as a preparation to enforce content type on guest startup,
because now migration failure happens early and not only when trying to start
the guest on the remote node.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoprefer storage_check_enabled over storage_check_node
Fabian Ebner [Fri, 18 Jun 2021 10:59:33 +0000 (12:59 +0200)]
prefer storage_check_enabled over storage_check_node

storage_check_enabled simply checks for the 'disable' option and then calls
storage_check_node.

While not strictly necessary for a second call where only the storage differs,
e.g. in case of clone, it is more future-proof: if support for a target storage
is added at some point, it might be easy to miss adapting the call.

For the migration checks, the situation is improved by now always catching
disabled (target) storages.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agotest: fix restore config test as unprivileged user
Fabian Ebner [Mon, 31 May 2021 14:27:10 +0000 (16:27 +0200)]
test: fix restore config test as unprivileged user

after upgrading to bullseye, the cfs_read_file call within
restore_update_config_line() results in an error:
    Is a directory!
when done as an unprivileged user.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agovmstatus: don't set PID when VM is not running
Fabian Ebner [Fri, 18 Jun 2021 11:36:40 +0000 (13:36 +0200)]
vmstatus: don't set PID when VM is not running

by avoiding int(undef)

Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: limit description/comment length to 8 KiB
Thomas Lamprecht [Fri, 18 Jun 2021 11:11:07 +0000 (13:11 +0200)]
config: limit description/comment length to 8 KiB

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agovm status: force int where appropriate
Fabian Ebner [Tue, 1 Jun 2021 06:43:06 +0000 (08:43 +0200)]
vm status: force int where appropriate

to avoid potential problems with stringified numbers in Javascript and
elsewehere.

The vmid was not always an integer as the return schema expects, namely
when there was an opt_vmid argument, because the 'ne' comparision coerced the
vmid to be a string then.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoavoid setting lun number for drives when pvscsi controller is used
Fabian Ebner [Tue, 13 Apr 2021 08:24:14 +0000 (10:24 +0200)]
avoid setting lun number for drives when pvscsi controller is used

Reported in the community forum[0].

In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun property
is set to 0. This means that in our stack, one cannot have multiple disks and
use 'scsihw: pvscsi' currently, as kvm would fail with
    bad scsi device lun: 1

Instead of increasing the lun number, increase the scsi-id, as we already do for
lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0).

[0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
Tested-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agocfg2cmd: add test for efidisk rbd cache handling
Thomas Lamprecht [Wed, 16 Jun 2021 13:24:55 +0000 (15:24 +0200)]
cfg2cmd: add test for efidisk rbd cache handling

I don't think this is something which will get broken by accident but
still nice to "document" this behavior in a regression test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofollowup; shorter code for efidisk rbd cache handling
Thomas Lamprecht [Wed, 16 Jun 2021 13:17:58 +0000 (15:17 +0200)]
followup; shorter code for efidisk rbd cache handling

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3329: turn on cache=writeback for efidisks on rbd
Dominik Csapak [Wed, 16 Jun 2021 13:09:33 +0000 (15:09 +0200)]
fix #3329: turn on cache=writeback for efidisks on rbd

on slower ceph clusters, the write pattern of the ovmf booting process
slows down the boot of the vm, so we turn on caching by default

it seems no other storage (until now) behaves like this. if it does in
the future, we can still add them too, or add a 'cache' property for
the efidisk

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agovm destroy: do not remove unreferenced disks by default
Fabian Ebner [Fri, 4 Jun 2021 13:49:30 +0000 (15:49 +0200)]
vm destroy: do not remove unreferenced disks by default

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoscan volids: remove superfluous parameter
Fabian Ebner [Fri, 4 Jun 2021 13:49:29 +0000 (15:49 +0200)]
scan volids: remove superfluous parameter

The only caller that didn't use 'images' was removed as part of the migration
refactoring in commit 62a4c963b824c923a4fc82a48c81d0f63ebaddae, so this is not
even a breaking change as the 'PVE 7' comment might've suggested.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoRevert "revert spice_ticket prefix change in 7827de4"
Fabian Ebner [Fri, 4 Jun 2021 13:49:28 +0000 (15:49 +0200)]
Revert "revert spice_ticket prefix change in 7827de4"

This reverts commit ff09c795edd12b1cc4604ee28a7cdd99cdd1afa8. We wanted to wait
until PVE 7.0 for the change to not break migration new -> old until then.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agobuildsys: change upload dist to bullseye
Thomas Lamprecht [Tue, 8 Jun 2021 07:47:35 +0000 (09:47 +0200)]
buildsys: change upload dist to bullseye

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agovzdump: add master key support
Fabian Grünbichler [Fri, 28 May 2021 12:09:53 +0000 (14:09 +0200)]
vzdump: add master key support

running outdated VMs without master key support will generate a warning
but proceed with a backup without encrypted key upload.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agovzdump: drop legacy fallback logging for dirty-bitmap
Thomas Lamprecht [Wed, 2 Jun 2021 14:48:13 +0000 (16:48 +0200)]
vzdump: drop legacy fallback logging for dirty-bitmap

Users need to reboot at least once for the upgrade to 7.0, so any VM
running is then using a new enough QEMU...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-2
Thomas Lamprecht [Fri, 28 May 2021 11:08:50 +0000 (13:08 +0200)]
bump version to 7.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agolive-restore: merge snapshot/repo log lines into one
Thomas Lamprecht [Fri, 28 May 2021 10:14:34 +0000 (12:14 +0200)]
live-restore: merge snapshot/repo log lines into one

to many lines make task log harder to read

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agolive-restore: add more logging
Stefan Reiter [Tue, 18 May 2021 15:13:44 +0000 (17:13 +0200)]
live-restore: add more logging

To bring it better in line with regular restore, also log the
repository, the snapshot and the target for each drive.

While at it, adjust capitalization of existing log line and clean up
repeated '$1' use.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agodestroy VM: also check if unused volumes are base images
Fabian Ebner [Mon, 19 Apr 2021 08:46:43 +0000 (10:46 +0200)]
destroy VM: also check if unused volumes are base images

It's arguably not likely in practice that only an unused volume is still in use
as a base image, but do it for completeness sake.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodestroy VM: always remove (referenced) VM state volumes
Fabian Ebner [Mon, 19 Apr 2021 08:46:42 +0000 (10:46 +0200)]
destroy VM: always remove (referenced) VM state volumes

With --destroy-unreferenced-disks 0 they were not removed yet, but no use in
keeping them around.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoqm: assume correct VNC setup in 'vncproxy', disallow passwordless
Stefan Reiter [Thu, 27 May 2021 10:27:51 +0000 (12:27 +0200)]
qm: assume correct VNC setup in 'vncproxy', disallow passwordless

The QMP 'change' command is no longer available since QEMU 6.0, so this
cannot work - instead of replacing it, we can just remove it however.

The 'if' branch would only set the VNC socket path anew and enable
password mode, which is always set and enabled on startup already.
The 'else' branch was intended for certificate login (?), which
according to the FIXME comment is long gone anyway - simply forbid
'vncproxy' without the PVE ticket environment variable set.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agocfg2cmd: use long form QEMU parameters to avoid warning in 6.0
Stefan Reiter [Thu, 27 May 2021 10:27:50 +0000 (12:27 +0200)]
cfg2cmd: use long form QEMU parameters to avoid warning in 6.0

QEMU warns us about this:

kvm: -chardev socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait: warning: short-form boolean option 'server' deprecated
Please use server=on instead
kvm: -chardev socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait: warning: short-form boolean option 'nowait' deprecated
Please use wait=off instead
kvm: -vnc unix:/var/run/qemu-server/100.vnc,password: warning: short-form boolean option 'password' deprecated
Please use password=on instead

The new syntax is backwards compatible to at least QEMU 4.0.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agovmstatus: make template property optional
Fabian Ebner [Thu, 11 Mar 2021 10:26:47 +0000 (11:26 +0100)]
vmstatus: make template property optional

to avoid printing 'template: ' with 'qm status <id> --verbose' if it's false.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: clone: sort vm disks to keep numbers consistent
Lorenz Stechauner [Wed, 26 May 2021 14:19:17 +0000 (16:19 +0200)]
api: clone: sort vm disks to keep numbers consistent

reported by user in forum:
https://forum.proxmox.com/threads/problem-when-copying-template-with-2-discs.89851/

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
3 years agobump version to 7.0-1
Thomas Lamprecht [Thu, 13 May 2021 17:11:22 +0000 (19:11 +0200)]
bump version to 7.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodebian: update compat, copyright, ..
Thomas Lamprecht [Thu, 13 May 2021 17:09:29 +0000 (19:09 +0200)]
debian: update compat, copyright, ..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.4-2
Thomas Lamprecht [Thu, 29 Apr 2021 14:16:51 +0000 (16:16 +0200)]
bump version to 6.4-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2862: allow sata/ide template backups
Fabian Grünbichler [Mon, 26 Apr 2021 12:11:03 +0000 (14:11 +0200)]
fix #2862: allow sata/ide template backups

for IDE and SATA, setting the whole drive into readonly mode is not
possible. skip the readonly flag for such drives as a workaround until
we find a better solution.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofix bootdisk_size for new bootorder config scheme
Dominik Csapak [Mon, 8 Mar 2021 13:43:38 +0000 (14:43 +0100)]
fix bootdisk_size for new bootorder config scheme

Previously, we ever only had a single boot *disk*, while possibly
having multiple cdroms/nics in the boot order

e.g. the config:

 boot: dnc
 bootdisk: scsi0
 ide0: media=cdrom,none
 scsi0: xxx
 net0: ...

would return the size of scsi0 even though it would first boot
from cdrom/network.

When editing the bootorder with such a legacy config, we
remove the 'bootdisk' property and replace the legacy notation
with an explicit order, but we only search the first disk
for the size now.

Restore that behaviour by iterating over all disks in the boot
order property string until we get one that is not a cdrom
and has a size.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoRevert "migration: do not set default speed limit"
Thomas Lamprecht [Thu, 29 Apr 2021 12:27:41 +0000 (14:27 +0200)]
Revert "migration: do not set default speed limit"

The default was changed for 5.2, so while it is not 32 MiB/s anymore,
it is still 128 MiB/s which I did not notice on my 1 Gbps (or < 125
MiB/s) setup. For users with links faster than one gigabit it now did
some limiting - so setup a very high limit so than even 100G should
not max this out.

This reverts commit a89bd100846f8e923aa7d15863b92e6e2d7264d2.

3 years agobump version to 6.4-1
Thomas Lamprecht [Fri, 23 Apr 2021 14:26:59 +0000 (16:26 +0200)]
bump version to 6.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomigrate: fix memory migration start time
Fabian Ebner [Fri, 23 Apr 2021 12:31:40 +0000 (14:31 +0200)]
migrate: fix memory migration start time

The variable is only ever used for calculating the average speed of memory
migration, but it was set before disk mirroring already. But the disk
sizes are not included in the calculation, resulting in (very) wrong values.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoqemu_img_convert: add missing newline for progress output
Fabian Ebner [Thu, 22 Apr 2021 06:57:57 +0000 (08:57 +0200)]
qemu_img_convert: add missing newline for progress output

which was accidentally removed by b5e9d97bdf8a63a542f8cbb3c1d0821ee731f796.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>