Commit Graph

1295 Commits

Author SHA1 Message Date
Alexandre Derumier
c930f99e57 generate cloudinit drive on offline plug
Currently when only generate it at vm start

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-08 17:23:30 +01:00
Alexandre Derumier
95a5135dad cloudinit: add cloudinit section for current generated config.
Instead using vm pending options for pending cloudinit generated config,

write current generated cloudinit config in a new [special:cloudinit] SECTION.

Currently, some options like vm name, nic mac address can be hotplugged,
so they are not way to know if the cloud-init disk is already updated.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-08 17:23:30 +01:00
Thomas Lamprecht
0d31845364 change cpu shares: drop superfluous parameter
See the related commit in pve-common.

Originally-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-08 16:20:24 +01:00
Fiona Ebner
6b7ef5e57e move get_cpuunits helper to guest-common
while making it take the value directly instead of the config.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-08 16:15:31 +01:00
Fabian Grünbichler
0c19d8fbcf schema: move 'pve-targetstorage' to pve-common
for proper re-use in pve-container.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-07 16:15:29 +01:00
Fiona Ebner
e31762f25b fix #4099: disable io_uring for virtual disks on CIFS storages
Since kernel 5.15, there is an issue with io_uring when used in
combination with CIFS [0]. Unfortunately, the kernel developers did
not suggest any way to resolve the issue and didn't comment on my
proposed one. So for now, just disable io_uring when the storage is
CIFS, like is done for other storage types that had problematic
interactions.

It is rather easy to reproduce when writing large amounts of data
within the VM. I used
dd if=/dev/urandom of=file bs=1M count=1000
to reproduce it consistently, but your mileage may vary.

Some forum reports about users running into the issue [1][2][3].

[0]: https://www.spinics.net/lists/linux-cifs/msg26734.html
[1]: https://forum.proxmox.com/threads/109848/
[2]: https://forum.proxmox.com/threads/110464/
[3]: https://forum.proxmox.com/threads/111382/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-10-28 10:15:19 +02:00
Fiona Ebner
34e82fa28b config2cmd: make missing EFI disk warning more visible
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-09-26 11:32:23 +02:00
Thomas Lamprecht
b4415a5253 Revert "cleanup pci devices in more situations"
irrelevant/wrong

This reverts commit 81042ce445.
2022-09-20 14:22:49 +02:00
Dominik Csapak
81042ce445 cleanup pci devices in more situations
if the preparing of pci devices or the start of the vm fails, we need
to cleanup the pci devices (reservations *and* mdevs), or else
it might happen that there are leftovers which must be manually removed.

to include also mdevs now, refactor the cleanup code from 'vm_stop_cleanup'
into it's own function, and call that instead of only 'remove_pci_reservation'

also print the errors of the cleanup steps with 'warn', otherwise we
might discard important errors

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-09-20 13:52:43 +02:00
Dominik Csapak
bbf96e0f1e automatically add 'uuid' parameter when passing through NVIDIA vGPU
When passing through an NVIDIA vGPU via mediated devices, their
software needs the qemu process to have the 'uuid' parameter set to the
one of the vGPU. Since it's currently not possible to pass through multiple
vGPUs to one VM (seems to be an NVIDIA driver limitation at the moment),
we don't have to take care about that.

Sadly, the place we do this, it does not show up in 'qm showcmd' as we
don't (want to) query the pci devices in that case, and then we don't
have a way of knowing if it's an NVIDIA card or not. But since this
is informational with QEMU anyway, i'd say we can ignore that.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-08-12 13:42:33 +02:00
Matthias Heiserer
bd49ecb435 Qemu-Server: fix wrong quotation
Before, the two strings were one single string each, rather than multiple
separated by newlines.

In the docs, this looked very strange as there were linebreaks and the
dots were shown. Can be seen e.g. in api-viewer /nodes/{node}/qemu/{vmid}/config.

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-30 12:32:25 +02:00
Dominik Csapak
2dda626d1e fix #4119: give namespace parameter to live-restore
we forgot to give the namespace parameter here, so do that.
while we're at it, give the pbs options as a hash instead of adding
another parameter.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-29 13:07:12 +02:00
Thomas Lamprecht
6884a7d7fa fix #4115: enable option to name QEMU threads after their main purpose
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-06-17 14:25:49 +02:00
Wolfgang Bumiller
21a9ec2ad3 support pbs namespaces
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-05-12 13:45:37 +02:00
Thomas Lamprecht
8884a8bfb9 virgl: library check: refactor/code style nits
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-02 17:20:39 +02:00
Stoiko Ivanov
9f979d9f31 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>
2022-05-02 17:15:42 +02:00
Fabian Ebner
13d121d79b 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>
2022-04-28 18:29:12 +02:00
Thomas Lamprecht
f8ea1b30ce enable spice also for virtio-gpu display
same spirit as commit 3591b62b85

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-28 17:47:07 +02:00
Fabian Ebner
202a2a0bee api: create: allow overriding non-disk options during restore
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-28 08:43:09 +02:00
Thomas Lamprecht
463bb05f93 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>
2022-04-28 08:07:14 +02:00
Alexandre Derumier
c70e4ec397 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>
2022-04-27 11:08:50 +02:00
Thomas Lamprecht
baa4f62de0 fix QemuServer module
fixes d1e7b92289 ("parse vm config: remove "\s*" from multi-line
comment regex")

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-27 11:08:50 +02:00
Stefan Sterz
d1e7b92289 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>
2022-04-27 08:17:21 +02:00
Fabian Ebner
e8b07b29ee 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>
2022-04-25 18:19:17 +02:00
Fabian Ebner
ff86112c14 restore deactivate volumes: never die
Such an error shouldn't abort the whole operation.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-25 18:19:17 +02:00
Fabian Ebner
e60afe8273 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>
2022-04-25 18:19:17 +02:00
Fabian Ebner
01a4377fc1 restore: cleanup oldconf: also clean up snapshots from kept volumes
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-25 18:19:17 +02:00
Dylan Whyte
233fb3366b 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>
2022-04-25 18:11:21 +02:00
Thomas Lamprecht
6f070e39de vga: add virtio-gl display type for VIRGL
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-22 14:28:09 +02:00
Fabian Ebner
d18b5d90ee code cleanup: remove commented-out debug print
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-11 09:34:33 +02:00
Fabian Ebner
a9c45bd4a4 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>
2022-04-06 17:41:49 +02:00
Fabian Ebner
c1accf9db9 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>
2022-04-04 16:41:13 +02:00
Fabian Ebner
39051ac0df 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>
2022-04-04 16:40:55 +02:00
Fabian Ebner
62375438dc clone disk: also clone EFI disk from snapshot
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 10:24:59 +02:00
Fabian Ebner
1d1f8f9ada 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>
2022-04-01 10:24:59 +02:00
Fabian Ebner
5f9575929a 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>
2022-04-01 10:24:59 +02:00
Fabian Grünbichler
8b8893c3c4 fix #3957: spell 'occurred' correctly
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-03-25 09:06:58 +01:00
Fabian Ebner
a23d57d596 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>
2022-03-14 16:28:55 +01:00
Fabian Ebner
6e55f5799e 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>
2022-03-11 10:45:59 +01:00
Fabian Ebner
ff84f0e36b 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>
2022-03-11 10:45:59 +01:00
Fabian Ebner
25166060ae 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>
2022-03-11 10:45:59 +01:00
Fabian Ebner
7344af7bf8 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>
2022-03-11 10:45:59 +01:00
Fabian Ebner
1196086ff1 clone disk: group source and target parameters
to make the interface more digestible.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-03-11 10:45:59 +01:00
Fabian Ebner
31b1db61c2 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>
2022-03-11 10:45:59 +01:00
Fabian Ebner
52b361afd6 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>
2022-03-11 10:45:59 +01:00
Fabian Ebner
f7765dd72e restore: remove duplicate check
The refactoring in 36d4bdcb86 missed
this. The check is already done as part of the following check_storage
call.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-02-25 09:58:16 +01:00
Moayad Almalat
39abafc8e7 fix #3733: add 20 seconds timeout when VM backup stopped 2022-02-24 13:33:45 +01:00
Thomas Lamprecht
36d4bdcb86 restore: factor out common early checks into closure
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-02-24 13:29:42 +01:00
Thomas Lamprecht
9f8ba326ce 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>
2022-02-24 13:24:01 +01:00
Matthias Heiserer
62af60cd3d 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>
2022-02-24 13:19:49 +01:00