]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
2 years agobump version to 7.2-2
Thomas Lamprecht [Mon, 2 May 2022 15:26:36 +0000 (17:26 +0200)]
bump version to 7.2-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agovirgl: library check: refactor/code style nits
Thomas Lamprecht [Mon, 2 May 2022 15:20:39 +0000 (17:20 +0200)]
virgl: library check: refactor/code style nits

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocheck prerequisites for virtio-gl display
Stoiko Ivanov [Fri, 29 Apr 2022 16:50:07 +0000 (18:50 +0200)]
check prerequisites for virtio-gl display

and exit early if they are not met.
The necessary libraries were taken from Thomas' post in our community
forum:
https://forum.proxmox.com/threads/.61801/post-466767 (ff)

The /dev/dri/renderD.* check is based on util/drm.c in the current
qemu source code.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoapi: reassign disk: drop moved disk from boot order
Thomas Lamprecht [Mon, 2 May 2022 11:28:03 +0000 (13:28 +0200)]
api: reassign disk: drop moved disk from boot order

Reported-by: Matthias Heiserer <m.heiserer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.2-1
Thomas Lamprecht [Thu, 28 Apr 2022 16:35:35 +0000 (18:35 +0200)]
bump version to 7.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3861: migrate: fix live migration when cloud-init changes storage
Fabian Ebner [Thu, 28 Apr 2022 11:37:37 +0000 (13:37 +0200)]
fix #3861: migrate: fix live migration when cloud-init changes storage

Generalizes fd95d780 ("migrate: send updated TPM state volid to target
node") to also handle other offline migrated disks appearing in the
VM config, which currently should only be cloud-init.

Breaks migration new -> old under similar (edge-case-)conditions as
fd95d780 did.

Keep sending the 'tpmstate0' STDIN parameter to avoid breaking new ->
old in the scenario fd95d780 fixed.

Keep parsing the vm_start 'tpmstate0' STDIN parameter to avoid
breaking old -> new, and to be able to keep sending it.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agotests: preset RBD fsid to avoid unavailable rados command
Thomas Lamprecht [Thu, 28 Apr 2022 16:20:52 +0000 (18:20 +0200)]
tests: preset RBD fsid to avoid unavailable rados command

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoenable spice also for virtio-gpu display
Thomas Lamprecht [Thu, 28 Apr 2022 15:46:57 +0000 (17:46 +0200)]
enable spice also for virtio-gpu display

same spirit as commit 3591b62b859d940c143085510aa9b0005f42c479

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: create: allow overriding non-disk options during restore
Fabian Ebner [Tue, 26 Apr 2022 12:30:51 +0000 (14:30 +0200)]
api: create: allow overriding non-disk options during restore

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: create: refactor parameter check logic
Fabian Ebner [Tue, 26 Apr 2022 12:30:50 +0000 (14:30 +0200)]
api: create: refactor parameter check logic

In preparation to allow passing along certain parameters together with
'archive'. Moving the parameter checks to after the
conflicts-with-'archive' to ensure that the more telling error will
trigger first.

All check helpers should handle empty params fine, but check first
just to make sure and to avoid all the superfluous function calls.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: status: report spice also for virtio-gl display
Thomas Lamprecht [Thu, 28 Apr 2022 06:15:57 +0000 (08:15 +0200)]
api: status: report spice also for virtio-gl display

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoenable spice also for virtio-gl display
Thomas Lamprecht [Thu, 28 Apr 2022 06:07:08 +0000 (08:07 +0200)]
enable spice also for virtio-gl display

It can be used with that and the agent features can make it a nicer
experience.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoadd test for virtio-balloon free-page-reporting=on. (qemu 6.2)
Alexandre Derumier [Sun, 6 Mar 2022 12:46:47 +0000 (13:46 +0100)]
add test for virtio-balloon free-page-reporting=on. (qemu 6.2)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2 years agomemory: enable balloon free-page-reporting for auto-memory reclaim
Alexandre Derumier [Sun, 6 Mar 2022 12:46:46 +0000 (13:46 +0100)]
memory: enable balloon free-page-reporting for auto-memory reclaim

Allow balloon device  driver to report hints of guest free pages to
the host, for auto memory reclaim

https://lwn.net/Articles/759413/
https://events19.linuxfoundation.org/wp-content/uploads/2017/12/KVMForum2018.pdf

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
[ T: fixup tests ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix QemuServer module
Thomas Lamprecht [Wed, 27 Apr 2022 09:00:00 +0000 (11:00 +0200)]
fix QemuServer module

fixes d1e7b922894 ("parse vm config: remove "\s*" from multi-line
comment regex")

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoparse vm config: remove "\s*" from multi-line comment regex
Stefan Sterz [Thu, 24 Feb 2022 14:21:51 +0000 (15:21 +0100)]
parse vm config: remove "\s*" from multi-line comment regex

To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2 years agomigrate: resume initially running VM when failing after convergence
Fabian Ebner [Mon, 25 Apr 2022 12:31:12 +0000 (14:31 +0200)]
migrate: resume initially running VM when failing after convergence

When phase2() is aborted after the migration already converged, then
after migrate_cancel, the VM might be in POSTMIGRATE state.

(There also is a conditional for SHUTDOWN state in QEMU's
migration_iteration_finish(), so it's likely possible to end up there
if the VM is shut down at the right time during migration, but no need
to resume then).

Detect the POSTMIGRATE state and resume the VM if it wasn't paused at
the beginning of the migration. There is no direct way to go to
PAUSED, so just print an error if the VM was paused at the beginning
of the migration.

Reported-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agomigrate: add log for guest fstrim
Fabian Ebner [Mon, 25 Apr 2022 12:31:11 +0000 (14:31 +0200)]
migrate: add log for guest fstrim

and make a failure noticable.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 7.1-5
Thomas Lamprecht [Mon, 25 Apr 2022 18:16:02 +0000 (20:16 +0200)]
bump version to 7.1-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorestore: also deactivate/destroy cloud-init disk upon error
Fabian Ebner [Thu, 21 Apr 2022 11:26:52 +0000 (13:26 +0200)]
restore: also deactivate/destroy cloud-init disk upon error

by re-using the same hash that's used when allocating/activating the
disks in the helpers doing the opposite.

Also in preparation to allow skipping certain disks upon restore.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agorestore deactivate volumes: never die
Fabian Ebner [Thu, 21 Apr 2022 11:26:51 +0000 (13:26 +0200)]
restore deactivate volumes: never die

Such an error shouldn't abort the whole operation.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agorestore destroy volumes: remove check for absolute path
Fabian Ebner [Thu, 21 Apr 2022 11:26:50 +0000 (13:26 +0200)]
restore destroy volumes: remove check for absolute path

Only a result from vdisk_alloc is assigned as a volid and that's never
an absolute path.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agorestore: cleanup oldconf: also clean up snapshots from kept volumes
Fabian Ebner [Thu, 21 Apr 2022 11:26:49 +0000 (13:26 +0200)]
restore: cleanup oldconf: also clean up snapshots from kept volumes

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoQemuServer: Fix 'keyboard' parameter description
Dylan Whyte [Mon, 25 Apr 2022 15:21:38 +0000 (17:21 +0200)]
QemuServer: Fix 'keyboard' parameter description

The option has not defaulted to using the cluster-wide datacenter.cfg
since 2018.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
2 years agoapi: create/modify: fix content type checks by re-allowing iso images
Fabian Ebner [Fri, 22 Apr 2022 11:03:06 +0000 (13:03 +0200)]
api: create/modify: fix content type checks by re-allowing iso images

Fixes: f9be9137 ("api: create/modify: add content type checks"
Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agovga: add virtio-gl display type for VIRGL
Thomas Lamprecht [Fri, 22 Apr 2022 12:28:09 +0000 (14:28 +0200)]
vga: add virtio-gl display type for VIRGL

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: keep VM paused after migration if it was before
Fabian Ebner [Fri, 18 Mar 2022 07:51:23 +0000 (08:51 +0100)]
migrate: keep VM paused after migration if it was before

Also cannot issue a guest agent command in that case.

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

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agocode cleanup: remove commented-out debug print
Fabian Ebner [Mon, 11 Apr 2022 07:34:08 +0000 (09:34 +0200)]
code cleanup: remove commented-out debug print

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: add version guard for qemu-img dd's -l option
Fabian Ebner [Tue, 5 Apr 2022 08:22:14 +0000 (10:22 +0200)]
clone disk: add version guard for qemu-img dd's -l option

It's only available since QEMU 6.2 and doing a check here rather than
bumping the package dependency allows for easy downgrades.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: update vm: print drive string for newly allocated/imported drives
Fabian Ebner [Thu, 17 Mar 2022 11:31:06 +0000 (12:31 +0100)]
api: update vm: print drive string for newly allocated/imported drives

In the spirit of c75bf16 ("qm importdisk: tell user to what VM disk we
actually imported"), and so that the information is not lost once qm
importdisk switches to re-using the API call.

Added for cloudinit too, because a new disk is allocated.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: support VM disk import
Dominic Jäger [Thu, 17 Mar 2022 11:31:05 +0000 (12:31 +0100)]
api: support VM disk import

Extend qm importdisk functionality to the API.

Co-authored-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Co-authored-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoschema: drive: use separate schema when disk allocation is possible
Fabian Ebner [Thu, 17 Mar 2022 11:31:04 +0000 (12:31 +0100)]
schema: drive: use separate schema when disk allocation is possible

via the special syntax <storeid>:<size>.

Not worth it by itself, but this is anticipating a new 'import-from'
parameter which is only used upon import/allocation, but shouldn't be
part of the schema for the config or other API enpoints.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: add endpoint for parsing .ovf files
Fabian Ebner [Thu, 17 Mar 2022 11:31:03 +0000 (12:31 +0100)]
api: add endpoint for parsing .ovf files

Co-developed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
[split into its own patch + minor improvements/style fixes]
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
[renamed API handler, since it's not an index]
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoclone disk: also clone EFI disk from snapshot
Fabian Ebner [Thu, 17 Mar 2022 11:31:02 +0000 (12:31 +0100)]
clone disk: also clone EFI disk from snapshot

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: clone vm: check against cloning running TPM state early
Fabian Ebner [Thu, 17 Mar 2022 11:31:01 +0000 (12:31 +0100)]
api: clone vm: check against cloning running TPM state early

Drive keys are sorted when cloning and 'tpmstate0' comes late, so it
was likely that potentially large disks were already copied just to be
removed again, because of the TPM state restriction at the end.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: move check against cloning TPM state of running VM to beginning
Fabian Ebner [Thu, 17 Mar 2022 11:31:00 +0000 (12:31 +0100)]
clone disk: move check against cloning TPM state of running VM to beginning

where other similar checks are.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: assert that drive name is the same for drive-mirror on single VM
Fabian Ebner [Thu, 17 Mar 2022 11:30:59 +0000 (12:30 +0100)]
clone disk: assert that drive name is the same for drive-mirror on single VM

because when the VM ID of target and source are the same,
qemu_drive_mirror_monitor() switches the QEMU device node over to the
new backing image. The planned import-from functionality makes it
possible to run into this, although for an a bit unusual use case.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: create/modify: add content type checks
Fabian Ebner [Wed, 30 Mar 2022 10:24:37 +0000 (12:24 +0200)]
api: create/modify: add content type checks

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix #3957: spell 'occurred' correctly
Fabian Grünbichler [Fri, 25 Mar 2022 08:06:58 +0000 (09:06 +0100)]
fix #3957: spell 'occurred' correctly

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoPCI: allow longer pci domains
Dominik Csapak [Mon, 28 Feb 2022 13:48:20 +0000 (14:48 +0100)]
PCI: allow longer pci domains

some systems[0] have pci domains longer than the default ('0000') of 4
characters, so change the regex to allow at least 4.

0: https://forum.proxmox.com/threads/problem-with-gpu-passthrough-in-a-virtual-machine.105720/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agocpu config: code format/whitespace fixes
Thomas Lamprecht [Wed, 16 Mar 2022 14:53:00 +0000 (15:53 +0100)]
cpu config: code format/whitespace fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: snapshot delete: prefix lock-fail error
Fabian Grünbichler [Tue, 15 Mar 2022 12:28:27 +0000 (13:28 +0100)]
api: snapshot delete: prefix lock-fail error

otherwise users might get confused if they just get a message about a
migrate lock not being available..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agofix #3424: api: snapshot delete: wait for active replication
Fabian Ebner [Wed, 23 Feb 2022 12:03:59 +0000 (13:03 +0100)]
fix #3424: api: snapshot delete: wait for active replication

A to-be-deleted snapshot might be actively used by replication,
resulting in a not (or only partially) removed snapshot and locked
(snapshot-delete) VM. Simply wait a few seconds for any ongoing
replication.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: factor out check/cleanup for drive params
Fabian Ebner [Wed, 9 Mar 2022 10:09:15 +0000 (11:09 +0100)]
api: factor out check/cleanup for drive params

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoimage convert: allow block device as source
Fabian Ebner [Wed, 9 Mar 2022 10:09:14 +0000 (11:09 +0100)]
image convert: allow block device as source

Necessary to import from an existing storage using block-device
volumes like ZFS.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
[split into its own patch]
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoparse ovf: untaint path when calling file_size_info
Fabian Ebner [Wed, 9 Mar 2022 10:09:12 +0000 (11:09 +0100)]
parse ovf: untaint path when calling file_size_info

Prepare for calling parse_ovf via API, where the -T switch is used.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoschema: add pve-volume-id-or-absolute-path
Fabian Ebner [Wed, 9 Mar 2022 10:09:11 +0000 (11:09 +0100)]
schema: add pve-volume-id-or-absolute-path

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
[split into its own patch + style fixes]
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoefivars size: allow overriding efidisk parameter
Fabian Ebner [Wed, 9 Mar 2022 10:09:10 +0000 (11:09 +0100)]
efivars size: allow overriding efidisk parameter

For disk import, it should be based on the disk properties that are
passed in rather than on those of a possibly pre-existing disk in the
config.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: allow cloning from an unused or unreferenced disk
Fabian Ebner [Wed, 9 Mar 2022 10:09:09 +0000 (11:09 +0100)]
clone disk: allow cloning from an unused or unreferenced disk

and also when source and target drivename are different. In those
cases, it is done via qemu-img convert/dd.

In preparation to allow import from existing PVE-managed disks.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: pass in efi vars size rather than config
Fabian Ebner [Wed, 9 Mar 2022 10:09:08 +0000 (11:09 +0100)]
clone disk: pass in efi vars size rather than config

It's confusing that the config associated to the destination is
actually a reference to the source config for both existing callers.

Also, disk import will need to base the calculation on the passed-in
drive parameters and not just the current config, so this change is in
preparation for that too.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: group source and target parameters
Fabian Ebner [Wed, 9 Mar 2022 10:09:07 +0000 (11:09 +0100)]
clone disk: group source and target parameters

to make the interface more digestible.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: remove check for min QEMU version 2.7
Fabian Ebner [Wed, 9 Mar 2022 10:09:06 +0000 (11:09 +0100)]
clone disk: remove check for min QEMU version 2.7

Upgrading a cluster node entails re-starting or migrating VMs and even
PVE 6.0 already had QEMU 4.0.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: update: pass correct config when creating disks
Fabian Ebner [Wed, 9 Mar 2022 10:09:05 +0000 (11:09 +0100)]
api: update: pass correct config when creating disks

While the new options should be written to the pending config, the
decisions (currently only one) in create_disks needs to be made for
the current config.

Seems to fix EFI disk creation, but actually, it's only
future-proofing, because, currently, the same OVMF_VARS file is
used independently of $smm.

The correct config is also needed to determine the correct size for
the EFI disk for the upcoming import-from feature.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: create disks: always activate/update size when attaching existing volume
Fabian Ebner [Wed, 9 Mar 2022 10:09:04 +0000 (11:09 +0100)]
api: create disks: always activate/update size when attaching existing volume

For creation, activation and size update never triggered, because the
passed in $conf is essentially the same as the creation $settings, so
the disk was always detected to be the same as the "existing" one. But
actually, all disks are new, so it makes sense to do it.

For update, activation and size update nearly always triggered,
because only the pending changes are passed in as $conf. The case
where it didn't trigger is when the same pending change was made twice
(there are cases where hotplug isn't done, but makes it even more
unlikely).

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodevice unplug: verify that unplugging scsi disk completed
Fabian Ebner [Wed, 9 Mar 2022 10:09:03 +0000 (11:09 +0100)]
device unplug: verify that unplugging scsi disk completed

Avoids the error
  adding drive failed: Duplicate ID 'drive-scsi1' for drive
that could happen when switching over to a new disk (e.g. via qm set),
if unplugging wasn't fast enough.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: vm_start: 'force-cpu' is for internal migration use only
Oguz Bektas [Mon, 7 Mar 2022 13:20:25 +0000 (14:20 +0100)]
api: vm_start: 'force-cpu' is for internal migration use only

'force-cpu' parameter was introduced to allow live-migration of VMs with
custom CPU models; it does not need to be allowed for general use on
vm_start for regular users, since they would be able to set arbitrary
cpu types or cpuid parameters that aren't supported.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2 years agoqmp client: increase timeout for thaw
Fabian Ebner [Wed, 2 Mar 2022 13:21:07 +0000 (14:21 +0100)]
qmp client: increase timeout for thaw

Using a loop of freeze, sleep 5, thaw, sleep 5, an idling Windows 11
VM with 4 cores and 8GiB RAM once took 54 seconds for thawing. It took
less than a second about 90% of the time and maximum of a few seconds
for the majortiy of other cases, but there can be outliers where 10
seconds is not enough.

And there can be hookscripts executed upon thaw, which might also not
complete instantly.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agorestore: remove duplicate check
Fabian Ebner [Fri, 25 Feb 2022 08:58:16 +0000 (09:58 +0100)]
restore: remove duplicate check

The refactoring in 36d4bdcb8621fb85a520fda5e9e948dcdc9c60c6 missed
this. The check is already done as part of the following check_storage
call.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix #3733: add 20 seconds timeout when VM backup stopped
Moayad Almalat [Wed, 23 Feb 2022 09:03:24 +0000 (10:03 +0100)]
fix #3733: add 20 seconds timeout when VM backup stopped

2 years agorestore: factor out common early checks into closure
Thomas Lamprecht [Thu, 24 Feb 2022 12:29:42 +0000 (13:29 +0100)]
restore: factor out common early checks into closure

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorestore: early check cloud init target AllocateSpace permission
Thomas Lamprecht [Thu, 24 Feb 2022 12:21:55 +0000 (13:21 +0100)]
restore: early check cloud init target AllocateSpace permission

Originally-by: Matthias Heiserer <m.heiserer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3886: QEMU restore: verify storage allows images before writing
Matthias Heiserer [Thu, 24 Feb 2022 10:45:59 +0000 (11:45 +0100)]
fix #3886: QEMU restore: verify storage allows images before writing

When restoring a backup and the storage the disks would be created on
doesn't allow 'images', the process errors without cleanup.
This is the same behaviour we currently have when the storage is
disabled.

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: force raw format for TPM state
Fabian Ebner [Wed, 16 Feb 2022 10:47:49 +0000 (11:47 +0100)]
clone disk: force raw format for TPM state

The format can't be qcow2 for TPM state, because swtpm reads the file
directly expecting raw data.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix #3845: also clamp cpu units to cgroup dependent valid range on hotplug
Thomas Lamprecht [Fri, 11 Feb 2022 08:31:12 +0000 (09:31 +0100)]
fix #3845: also clamp cpu units to cgroup dependent valid range on hotplug

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig2cmd: drop unused get_cpuunits call
Thomas Lamprecht [Fri, 11 Feb 2022 08:30:22 +0000 (09:30 +0100)]
config2cmd: drop unused get_cpuunits call

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocpu units: lower minimum for accessing full cgroupv2 range
Thomas Lamprecht [Fri, 11 Feb 2022 08:29:50 +0000 (09:29 +0100)]
cpu units: lower minimum for accessing full cgroupv2 range

also clamp that up in the v1 case for compat.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocpu units: handle clamping more centrally
Thomas Lamprecht [Fri, 11 Feb 2022 08:28:26 +0000 (09:28 +0100)]
cpu units: handle clamping more centrally

preparation for also clamping on hotplug and lower the minimum in the
schema so that the full v2 range can be used.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: qga file-write: drop the check for base64
Thomas Lamprecht [Thu, 10 Feb 2022 15:27:55 +0000 (16:27 +0100)]
api: qga file-write: drop the check for base64

it's potentially expensive to check and the user already needs to
explicitly turn auto-encoding off, besides QEMU/QGA should handle
that and just error out gracefully on bogus base64 values.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: qga file-write: code/style cleanups/refactoring
Thomas Lamprecht [Thu, 10 Feb 2022 15:26:53 +0000 (16:26 +0100)]
api: qga file-write: code/style cleanups/refactoring

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3683: agent file-write: enable user to encode the content themselves
Dominik Csapak [Thu, 10 Feb 2022 14:52:10 +0000 (15:52 +0100)]
fix #3683: agent file-write: enable user to encode the content themselves

by adding an optional parameter 'encode' (enabled by default). When it
is disabled, the content must be base64 encoded already. This
way, users can send a binary file to the vm by base64 encoding it
themselves

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agomigrate: move tunnel-helpers to pve-guest-common
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:42 +0000 (14:07 +0100)]
migrate: move tunnel-helpers to pve-guest-common

besides the log calls these don't need any parts of the migration state,
so let's make them generic and re-use them for container migration and
replication in the future.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agonbd alloc helper: allow passing in explicit format
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:41 +0000 (14:07 +0100)]
nbd alloc helper: allow passing in explicit format

and make $volname optional, to support remote migration usage without
code duplication.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoupdate_vm: allow simultaneous setting of boot-order and dev
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:40 +0000 (14:07 +0100)]
update_vm: allow simultaneous setting of boot-order and dev

else this fails if we check 'boot' before the device was put into
the config or pending section.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoparse_config: optional strict mode
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:39 +0000 (14:07 +0100)]
parse_config: optional strict mode

when passing a config from one cluster to another, we want to be strict
when parsing - it's better to fail the migration early and upgrade the
target node instead of failing the migration later (when significant
work for transferring disks and/or state has already been done) or not
at all, but silently lose config settings that the target doesn't
understand.

this also might be helpful in other cases - e.g. when restoring from a
backup.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoschema: use pve-bridge-id
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:38 +0000 (14:07 +0100)]
schema: use pve-bridge-id

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agod/control: bump versioned (build-)dependency of libpve-common-perl
Thomas Lamprecht [Wed, 9 Feb 2022 17:47:03 +0000 (18:47 +0100)]
d/control: bump versioned (build-)dependency of libpve-common-perl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove map_storage to PVE::JSONSchema::map_id
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:37 +0000 (14:07 +0100)]
move map_storage to PVE::JSONSchema::map_id

since we are going to reuse the same mechanism/code for network bridge
mapping and pve-container.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agod/control: bump (build-)dependency of libpve-guest-common-perl
Thomas Lamprecht [Wed, 9 Feb 2022 17:45:48 +0000 (18:45 +0100)]
d/control: bump (build-)dependency of libpve-guest-common-perl

to get new helpers for snapshot

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoagent: code style fix
Thomas Lamprecht [Wed, 9 Feb 2022 17:45:14 +0000 (18:45 +0100)]
agent: code style fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosnapshot: implement __snapshot_activate_storages
Fabian Ebner [Thu, 13 Jan 2022 11:04:02 +0000 (12:04 +0100)]
snapshot: implement __snapshot_activate_storages

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone: repeat more checks after locking
Fabian Grünbichler [Tue, 8 Feb 2022 08:00:31 +0000 (09:00 +0100)]
clone: repeat more checks after locking

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoclone disk: don't modify drive parameter
Fabian Ebner [Thu, 27 Jan 2022 14:01:55 +0000 (15:01 +0100)]
clone disk: don't modify drive parameter

While existing callers are not using the parameter after the call,
the modification is rather unexpected and could lead to bugs quickly.

Also avoid setting an undef value in the hash, but use delete instead.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: move disk: fork before locking
Fabian Ebner [Thu, 27 Jan 2022 14:01:54 +0000 (15:01 +0100)]
api: move disk: fork before locking

using the familiar early+repeated checks pattern from other API calls.
Only intended functional changes are with regard to locking/forking.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: clone: fork before locking
Fabian Ebner [Thu, 27 Jan 2022 14:01:53 +0000 (15:01 +0100)]
api: clone: fork before locking

using the familiar early+repeated checks pattern from other API calls.
Only intended functional changes are with regard to locking/forking.

For a full clone of a running VM without guest agent, this also fixes
issuing vm_{resume,suspend} calls for drive mirror completion.
Previously, those just timed out, because of not getting the lock:

> create full clone of drive scsi0 (rbdkvm:vm-104-disk-0)
> Formatting '/var/lib/vz/images/105/vm-105-disk-0.raw', fmt=raw
> size=4294967296 preallocation=off
> drive mirror is starting for drive-scsi0
> drive-scsi0: transferred 2.0 MiB of 4.0 GiB (0.05%) in 0s
> drive-scsi0: transferred 635.0 MiB of 4.0 GiB (15.50%) in 1s
> drive-scsi0: transferred 1.6 GiB of 4.0 GiB (40.50%) in 2s
> drive-scsi0: transferred 3.6 GiB of 4.0 GiB (90.23%) in 3s
> drive-scsi0: transferred 4.0 GiB of 4.0 GiB (100.00%) in 4s, ready
> all 'mirror' jobs are ready
> suspend vm
> trying to acquire lock...
> can't lock file '/var/lock/qemu-server/lock-104.conf' - got timeout
> drive-scsi0: Cancelling block job
> drive-scsi0: Done.
> resume vm
> trying to acquire lock...
> can't lock file '/var/lock/qemu-server/lock-104.conf' - got timeout

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodrive mirror monitor: warn when suspend/resume/freeze/thaw calls fail
Fabian Ebner [Thu, 27 Jan 2022 14:01:52 +0000 (15:01 +0100)]
drive mirror monitor: warn when suspend/resume/freeze/thaw calls fail

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agopci: allow override of PCI vendor/device ids
Nicholas Sherlock [Tue, 18 Jan 2022 21:38:39 +0000 (21:38 +0000)]
pci: allow override of PCI vendor/device ids

This allows mobile- and vGPUs to be presented to the guest as if they
were the original desktop variants of the card. It also allows
device-ID variants that guests don't know about to be renamed to
match compatible sibling devices the guest does have drivers for
(e.g. to remove manufacturer-specific vendor ID variants that prevent
the use of a device which would otherwise have a supported chipset)

e.g. hostpci0: 03:00,vendor-id=0x8086,device-id=0x10f6

Signed-off-by: Nicholas Sherlock <n.sherlock@gmail.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agofix #3792: cloudinit: use of uninitialized value
Mira Limbeck [Mon, 20 Dec 2021 14:03:59 +0000 (15:03 +0100)]
fix #3792: cloudinit: use of uninitialized value

With the patch adding vendor-data support to cloud-init, a use of
uninitialized value was introduced. This can be fixed by setting it to
an empty string if no vendor-data is defined.

vendor-data can only be set via --cicustom and is optional.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2 years agoavoid writing the config if there are no pending changes to apply
Oguz Bektas [Thu, 2 Dec 2021 11:43:03 +0000 (12:43 +0100)]
avoid writing the config if there are no pending changes to apply

We drop properties which we do not understand and we call
`vmconfig_apply_pending` on stop and before start, so if a user tried
to edit the config or downgraded qemu-server they may get stuff
dropped from the config just by doing a stop/start, which may be a
bit too confusing, also the write is just unnecessary then.

we also have the same skipping logic when starting vms, this way we
avoid calling 'write_config' when there are no present changes to
commit.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2 years agobump version to 7.1-4
Thomas Lamprecht [Mon, 22 Nov 2021 16:07:17 +0000 (17:07 +0100)]
bump version to 7.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: send updated TPM state volid to target node
Fabian Grünbichler [Mon, 22 Nov 2021 10:30:11 +0000 (11:30 +0100)]
migrate: send updated TPM state volid to target node

The volid may change if local-storage migration is involved, we need
to tell the target node the new one and update the in-memory config
for starting the target VM accordingly.

Reported here: https://forum.proxmox.com/threads/99906/#post-431345

this possibly breaks migration new -> old iff
- spice is not used (else the explicit ticket wins because it comes
  later)
- a local TPM state volume is used
- that local TPM state volume has a different volume id on the target
  node (switched storage, volname already taken, ..)

because the target node will then mis-interpret the tpmstate0 line as
spice ticket and set it accordingly. if the old tpm state volume ID does
not exist on the target node, migration will fail. if it exists by
chance, it might work albeit with a wrong spice ticket (new because of
this patch) and tpm state volume (pre-existing breakage).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agomigrate: improve start STDIN-parameter parsing
Fabian Grünbichler [Mon, 22 Nov 2021 10:30:10 +0000 (11:30 +0100)]
migrate: improve start STDIN-parameter parsing

only do the compat fallback if no explicit spice ticket was given, and
warn on unknown parameters on STDIN.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 7.1-3
Thomas Lamprecht [Tue, 16 Nov 2021 13:04:49 +0000 (14:04 +0100)]
bump version to 7.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: skip tpmstate for NBD migration
Fabian Grünbichler [Tue, 16 Nov 2021 10:52:15 +0000 (11:52 +0100)]
migrate: skip tpmstate for NBD migration

This patch fixes the wrong attempt of setting up an NBD server for
the replicated TPM state volume, in contrast to the other volumes the
TPM state is managed by swtpm and isn't available to QEMU for
block-migration/bitmap tracking.

Note that we do migrate the state volume via a storage migration
anyway if necessary.

This code path was only triggered for replicated VMs with TPM.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.1-2
Thomas Lamprecht [Mon, 15 Nov 2021 15:59:27 +0000 (16:59 +0100)]
bump version to 7.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoexclude efidisk and tpmstate for boot disk selection
Dominik Csapak [Mon, 15 Nov 2021 15:56:41 +0000 (16:56 +0100)]
exclude efidisk and tpmstate for boot disk selection

else we cannot create a vm without a disk but with a tpmstate/efidisk,
since the api tries to generate the default bootorder with them included

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 7.1-1
Thomas Lamprecht [Mon, 15 Nov 2021 15:27:06 +0000 (16:27 +0100)]
bump version to 7.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci: do not reserve pci-ids for mediated devices
Dominik Csapak [Mon, 15 Nov 2021 13:07:35 +0000 (14:07 +0100)]
pci: do not reserve pci-ids for mediated devices

else a user cannot use more than one mdev per card per host.
We do not need to reserve them at all, since sysfs will error out
on creation/reuse anyway

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoapi: update: fix missing newline in background-delayed task error
Thomas Lamprecht [Mon, 15 Nov 2021 08:21:48 +0000 (09:21 +0100)]
api: update: fix missing newline in background-delayed task error

this error path is mostly used for re-attaching disks and the like,
and the "check if task is already done" part uses a method to read
the task status that will never include a trailing newline, so add it
our self to avoid "... at /usr/share/perl5/PVE/API2/Qemu.pm line
1480. (500)"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocfg2cmd: disable SMM when display=none and SeaBIOS is both used
Oguz Bektas [Thu, 11 Nov 2021 12:05:58 +0000 (13:05 +0100)]
cfg2cmd: disable SMM when display=none and SeaBIOS is both used

issue reported in community forum [0][1], like "serial[n]" display we
also need to set this option for "none", otherwise we get a boot
loop.

[0]: https://forum.proxmox.com/threads/99508
[1]: https://forum.proxmox.com/threads/97310/post-427129

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-19
Thomas Lamprecht [Thu, 11 Nov 2021 11:49:13 +0000 (12:49 +0100)]
bump version to 7.0-19

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