]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
18 months agobump version to 7.2-7
Thomas Lamprecht [Thu, 10 Nov 2022 16:27:08 +0000 (17:27 +0100)]
bump version to 7.2-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agomigrate test: fix some more grave indentation/whitespace errors
Thomas Lamprecht [Sun, 13 Nov 2022 13:54:26 +0000 (14:54 +0100)]
migrate test: fix some more grave indentation/whitespace errors

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agomigration : add del_nets_bridge_fdb
Alexandre Derumier [Wed, 24 Aug 2022 16:26:44 +0000 (18:26 +0200)]
migration : add del_nets_bridge_fdb

at the end of a live migration, we need to remove old mac entries
on source host (vm is not yet stopped), before resume vm on target host

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 [T: resolve conflicts and rework on apply ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agonet devs: avoid registering MAC to fdb if not static
Thomas Lamprecht [Sun, 13 Nov 2022 12:38:55 +0000 (13:38 +0100)]
net devs: avoid registering MAC to fdb if not static

In theory we can have a config with netX records that do not specify
a `macaddr` property, we just auto-generate on in config2cmd for
startup transitively, but don't save that explicitly back to the
config; so while we could parse the /proc/$pid/cmdline or try to get
the info from QMP (not fully straight forward) it seems rather a
hassle; especially if one has in mind that this cannot happen via the
API FWICT; as there a "deletion" *saves* a newly auto generated value
out to the config, same with clone of a VM and restore of a backup.

So, in basically all reasonable cases we got the `macaddr` available,
but if we don't it makes no sense to add a FDB variable for a *newly*
generated one by the parse_net call, as the VM won't use that (well,
at least if one doesn't get "lucky" and it randomly re-generates the
same as on startup), so allow telling parse_net to skip auto
generating MACs and use that in the add-fdb-entries helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agonet devs: code cleanup new fdb mac add helper
Thomas Lamprecht [Sun, 13 Nov 2022 12:37:45 +0000 (13:37 +0100)]
net devs: code cleanup new fdb mac add helper

reduce a level of indentation and modernize slightly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agonet devs: register vNIC mac to FDB on start/resume
Alexandre Derumier [Wed, 24 Aug 2022 16:26:43 +0000 (18:26 +0200)]
net devs: register vNIC mac to FDB on start/resume

On plain VM start (no live migration), we can simply add MAC address
into the fdb. In case of a live migration, we add the mac address
just before the resume.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
18 months agofix #4201: delete cloud-init disk on rollback
Mira Limbeck [Fri, 11 Nov 2022 15:46:35 +0000 (16:46 +0100)]
fix #4201: delete cloud-init disk on rollback

If the config doesn't contain the cloud-init disk anymore after the
rollback, we have to clean it up since otherwise no further disk can be
attached unless the one still existing on the storage is deleted.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
18 months agotest: usb: cover more ports on checking xhci 7.1+
Thomas Lamprecht [Fri, 11 Nov 2022 08:10:18 +0000 (09:10 +0100)]
test: usb: cover more ports on checking xhci 7.1+

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agotests: add tests for various combinations of configs for usb
Dominik Csapak [Fri, 11 Nov 2022 06:59:55 +0000 (07:59 +0100)]
tests: add tests for various combinations of configs for usb

q35 + usb passthrough
q35 + usb3 passthrough
q35 + usb3 passthrough with new xhci controller
old machine type + new usb config error
old machine type + q35 + new usb config error
old ostype (w2k) + new usb config error

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agousb: fixup: include USB config only for non-q35 again
Thomas Lamprecht [Fri, 11 Nov 2022 06:42:55 +0000 (07:42 +0100)]
usb: fixup: include USB config only for non-q35 again

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agousb: small style/code cleanups
Thomas Lamprecht [Thu, 10 Nov 2022 16:02:24 +0000 (17:02 +0100)]
usb: small style/code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agousb: get controllers: avoid separate loop for usb 2 devs and improve variable names
Thomas Lamprecht [Thu, 10 Nov 2022 16:00:58 +0000 (17:00 +0100)]
usb: get controllers: avoid separate loop for usb 2 devs and improve variable names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agousb: rename check_usb_index into assert_usb_index_is_useable
Thomas Lamprecht [Thu, 10 Nov 2022 15:48:35 +0000 (16:48 +0100)]
usb: rename check_usb_index into assert_usb_index_is_useable

to better convey that this might die

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agofix #3271: USB: allow usb hotplugging for modern guests
Dominik Csapak [Thu, 10 Nov 2022 14:35:58 +0000 (15:35 +0100)]
fix #3271: USB: allow usb hotplugging for modern guests

same as with the extended support for more usb devices, allow
hotplugging for guests that can use the qemu-xhci controller which
require a machine type >= 7.1 and a ostype l26 or windows > 7

if no usb device was passed through on startup, dynamically add
the xhci controller (and remove if the last usb device is unplugged)
so that live migration is still possible

much of the usb hotplug code was already there, but it still needed
a few adaptions, for example we have to add a chardev when adding
a spice redir port (that gets automatically removed when the
usb-redir device gets removed)

since the spice devices use the id 'usbredirdevX' instead of 'usbX', we
have to manually map that a bit around

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agoUSB: increase max usb devices to 14 for newer machine version and ostype
Dominik Csapak [Thu, 10 Nov 2022 14:35:57 +0000 (15:35 +0100)]
USB: increase max usb devices to 14 for newer machine version and ostype

for machine versions >= 7.1 and ostype linux or windows > 7, we use the
qemu-xhci controller where we have up to 14 usable ports, so make them
available to the user

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agofix #4324: USB: use qemu-xhci for machine versions >= 7.1
Dominik Csapak [Thu, 10 Nov 2022 14:35:56 +0000 (15:35 +0100)]
fix #4324: USB: use qemu-xhci for machine versions >= 7.1

going by reports in the forum (e.g. [0]) and semi-official qemu
information[1], we should prefer qemu-xhci over nec-usb-xhci

for compatibility purposes, we guard that behind the machine version,
so that guests with a fixed version don't suddenly have a different usb
controller after a reboot (which could potentially break some hardcoded
guest configs)

0: https://forum.proxmox.com/threads/proxmox-usb-connect-disconnect-loop.117063/
1: https://www.kraxel.org/blog/2018/08/qemu-usb-tips/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agoUSB: use machine_type_is_q35 instead of regex
Dominik Csapak [Thu, 10 Nov 2022 14:35:55 +0000 (15:35 +0100)]
USB: use machine_type_is_q35 instead of regex

we refactored that into PVE::QemuServer::Machine a while ago, so we can
use it here

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agoUSB: print_usbdevice_full: error out on invalid configuration
Dominik Csapak [Thu, 10 Nov 2022 14:35:54 +0000 (15:35 +0100)]
USB: print_usbdevice_full: error out on invalid configuration

should not happen normally, but an inattentive user of that function
may forget to check the validity of the parsed device, so err
on the safe side here

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agomove 'windows_version' to Helpers
Dominik Csapak [Thu, 10 Nov 2022 14:35:53 +0000 (15:35 +0100)]
move 'windows_version' to Helpers

to avoid a cyclic dependency when we want to use that in PVE::QemuServer::USB

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agoprint_tabletdevice_full: make use of $q35 variable
Dominik Csapak [Thu, 10 Nov 2022 14:35:52 +0000 (15:35 +0100)]
print_tabletdevice_full: make use of $q35 variable

just outside of context, we already save the result from
machine_type_is_q35 into the $q35 variable, but never use it.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agopci: cleanup pci: unregister mdev directly inline
Thomas Lamprecht [Thu, 10 Nov 2022 16:01:48 +0000 (17:01 +0100)]
pci: cleanup pci: unregister mdev directly inline

not worth the hassle of a break/depends cycle

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agouse full path for /usr/bin/taskset
Wolfgang Bumiller [Thu, 10 Nov 2022 10:15:43 +0000 (11:15 +0100)]
use full path for /usr/bin/taskset

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agofix #3593: add affinity to qemu
Daniel Bowder [Fri, 1 Jul 2022 00:09:45 +0000 (17:09 -0700)]
fix #3593: add affinity to qemu

Reuse the PVE::CpuSet to validate cpuset formatting.
Add new qemu property called 'affinity' to store the cpuset.
Push taskset command in front of kvm if 'affinity' is set.

Signed-off-by: Daniel Bowder <daniel@bowdernet.com>
18 months agopci: make mediated device sysfs path independent of PCI id
Dominik Csapak [Tue, 20 Sep 2022 12:50:17 +0000 (14:50 +0200)]
pci: make mediated device sysfs path independent of PCI id

mdevs have a host-unique UUID they are indexed with in the PCI-id
independent `/sys/bus/mdev/devices/<uuid>` path, so there is no need
to go through the PCI id for them.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agopci: add/improve HW reservation comments
Thomas Lamprecht [Wed, 9 Nov 2022 07:55:55 +0000 (08:55 +0100)]
pci: add/improve HW reservation comments

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agovm start/stop: cleanup passed-through pci devices in more situations
Dominik Csapak [Tue, 20 Sep 2022 12:50:16 +0000 (14:50 +0200)]
vm start/stop: cleanup passed-through 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 simplifies the code, such that it now removes all PCI ids
reserved for that VMID, since we cannot have multiple VMs with the
same VMID anyway

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agofix #4228: add start parameter to rollback endpoint for automatic restarting of VM
Stefan Hanreich [Wed, 14 Sep 2022 08:30:53 +0000 (10:30 +0200)]
fix #4228: add start parameter to rollback endpoint for automatic restarting of VM

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
18 months agofix #3890 - GUI: warn for unlikely iothread config
Matthias Heiserer [Mon, 13 Jun 2022 13:54:25 +0000 (15:54 +0200)]
fix #3890 - GUI: warn for unlikely iothread config

Previously, only a plaintext line in the task log showed something was off.
Now, the GUI will show it as a warning.

Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
18 months agoapi: update cloudinit: line reduction/small cleanups
Thomas Lamprecht [Tue, 8 Nov 2022 16:38:18 +0000 (17:38 +0100)]
api: update cloudinit: line reduction/small cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoapi: add cloudinit to available subdirs index
Thomas Lamprecht [Tue, 8 Nov 2022 16:35:04 +0000 (17:35 +0100)]
api: add cloudinit to available subdirs index

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoadd cloudinit hotplug
Alexandre Derumier [Wed, 22 Jun 2022 11:52:05 +0000 (13:52 +0200)]
add cloudinit hotplug

This allow to regenerate config drive if pending values exist
when we change vm options.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agoapi2: add cloudinit_update
Alexandre Derumier [Wed, 22 Jun 2022 11:52:04 +0000 (13:52 +0200)]
api2: add cloudinit_update

This allow to regenerate the config drive with 1 api call.

This also avoid to delete drive first, and recreate it again.

As it's a readonly drive, we can simply live update it,
and eject/replace it with qemu monitor

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agoapi2: add cloudinit config api
Alexandre Derumier [Wed, 22 Jun 2022 11:52:03 +0000 (13:52 +0200)]
api2: add cloudinit config api

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agocloudinit: make cloudnit options fastplug
Alexandre Derumier [Wed, 22 Jun 2022 11:52:02 +0000 (13:52 +0200)]
cloudinit: make cloudnit options fastplug

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agogenerate cloudinit drive on offline plug
Alexandre Derumier [Wed, 22 Jun 2022 11:52:01 +0000 (13:52 +0200)]
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>
18 months agocloudinit: add cloudinit section for current generated config.
Alexandre Derumier [Wed, 22 Jun 2022 11:52:00 +0000 (13:52 +0200)]
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>
18 months agomigration: test targetnode min version for cloudinit section
Alexandre Derumier [Wed, 22 Jun 2022 11:51:59 +0000 (13:51 +0200)]
migration: test targetnode min version for cloudinit section

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agovzdump : skip special:cloudinit section
Alexandre Derumier [Wed, 22 Jun 2022 11:51:58 +0000 (13:51 +0200)]
vzdump : skip special:cloudinit section

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agoqemuconfig: load_current_config : delete cloudinit value
Alexandre Derumier [Wed, 22 Jun 2022 11:51:57 +0000 (13:51 +0200)]
qemuconfig: load_current_config : delete cloudinit value

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agoapi: create/update vm: clamp cpuunit value
Fiona Ebner [Fri, 7 Oct 2022 12:41:50 +0000 (14:41 +0200)]
api: create/update vm: clamp cpuunit value

While the clamping already happens before setting the actual systemd
CPU{Shares, Weight}, it can be done here too, to avoid writing new
out-of-range values into the config.

Can't use a validator enforcing this because existing out-of-range
values should not become errors upon parsing the config.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agochange cpu shares: drop superfluous parameter
Thomas Lamprecht [Tue, 8 Nov 2022 15:20:20 +0000 (16:20 +0100)]
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>
18 months agomove get_cpuunits helper to guest-common
Fiona Ebner [Fri, 7 Oct 2022 12:41:48 +0000 (14:41 +0200)]
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>
18 months agobump version to 7.2-6
Thomas Lamprecht [Mon, 7 Nov 2022 15:26:42 +0000 (16:26 +0100)]
bump version to 7.2-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agod/control: bump versioned dependency of libpve-common-perl
Thomas Lamprecht [Mon, 7 Nov 2022 15:26:19 +0000 (16:26 +0100)]
d/control: bump versioned dependency of libpve-common-perl

for moved pve-targetstorage schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoschema: move 'pve-targetstorage' to pve-common
Fabian Grünbichler [Wed, 28 Sep 2022 12:50:53 +0000 (14:50 +0200)]
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>
18 months agobump version to 7.2-5
Thomas Lamprecht [Mon, 7 Nov 2022 15:15:22 +0000 (16:15 +0100)]
bump version to 7.2-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoqm: also move 'unlink' into disk related command group
Thomas Lamprecht [Mon, 7 Nov 2022 13:51:43 +0000 (14:51 +0100)]
qm: also move 'unlink' into disk related command group

missed that this one is also a disk specific command...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoqm: move disk related commands to own group
Thomas Lamprecht [Mon, 7 Nov 2022 13:43:25 +0000 (14:43 +0100)]
qm: move disk related commands to own group

set aliases for the previous ones for backward compat.

There's still cleanup potential, e.g., for snapshots, but to do that
nicely we may need (or want) to extend CLIHandler to accept commands
without fixed params also on the command group itself.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoqm: factor out setting node to local $nodename
Thomas Lamprecht [Mon, 7 Nov 2022 12:57:12 +0000 (13:57 +0100)]
qm: factor out setting node to local $nodename

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agofix #4099: disable io_uring for virtual disks on CIFS storages
Fiona Ebner [Thu, 27 Oct 2022 07:13:45 +0000 (09:13 +0200)]
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>
19 months agovzdump: set max-workers QMP option when specified and supported
Fiona Ebner [Mon, 3 Oct 2022 13:52:06 +0000 (15:52 +0200)]
vzdump: set max-workers QMP option when specified and supported

If not supported, a warning is printed and the setting is ignored.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
20 months agod/control: bump versioned dependecy for libpve-common-perl
Thomas Lamprecht [Mon, 26 Sep 2022 09:44:27 +0000 (11:44 +0200)]
d/control: bump versioned dependecy for libpve-common-perl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agoconfig2cmd: make missing EFI disk warning more visible
Fiona Ebner [Wed, 31 Aug 2022 12:46:09 +0000 (14:46 +0200)]
config2cmd: make missing EFI disk warning more visible

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
20 months agoqmeventd: send QMP 'quit' command instead of SIGTERM
Dominik Csapak [Fri, 23 Sep 2022 09:51:15 +0000 (11:51 +0200)]
qmeventd: send QMP 'quit' command instead of SIGTERM

this is functionally the same, but sending SIGTERM has the ugly side
effect of printing the following to the log:

> QEMU[<pid>]: kvm: terminating on signal 15 from pid <pid> (/usr/sbin/qmeventd)

while sending a QMP quit command does not.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
20 months agoqmeventd: rework 'forced_cleanup' handling and set timeout to 60s
Dominik Csapak [Fri, 23 Sep 2022 09:51:14 +0000 (11:51 +0200)]
qmeventd: rework 'forced_cleanup' handling and set timeout to 60s

currently, the 'forced_cleanup' (sending SIGKILL to the qemu process),
is intended to be triggered 5 seconds after sending the initial shutdown
signal (SIGTERM) which is sadly not enough for some setups.

Accidentally, it could be triggered earlier than 5 seconds, if a
SIGALRM triggers in the timespan directly before setting it again.

Also, this approach means that depending on when machines are shutdown
their forced cleanup may happen after 5 seconds, or any time after, if
new vms are shut off in the meantime.

Improve this situation by reworking the way we deal with this cleanup.
We save the pidfd, time incl. timeout in the Client, and set a timeout
to 'epoll_wait' of 10 seconds, which will then trigger a forced_cleanup.
Remove entries from the forced_cleanup list when that entry is killed,
or when the normal cleanup took place.

To improve the shutdown behaviour, increase the default timeout to 60
seconds, which should be enough, but add a commandline toggle where
users can set it to a different value.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
20 months agofix net regex in qm cleanup
Dominik Csapak [Tue, 20 Sep 2022 14:50:43 +0000 (16:50 +0200)]
fix net regex in qm cleanup

the '+' needs to be in the brackets, otherwise '$1' is not the right id

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
20 months agoRevert "cleanup pci devices in more situations"
Thomas Lamprecht [Tue, 20 Sep 2022 12:22:49 +0000 (14:22 +0200)]
Revert "cleanup pci devices in more situations"

irrelevant/wrong

This reverts commit 81042ce4451d796aaf878845a19054ccac30608a.

20 months agocleanup pci devices in more situations
Dominik Csapak [Wed, 27 Jul 2022 13:28:54 +0000 (15:28 +0200)]
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>
20 months agoqmp client: increase default fallback timeout to 5s
Thomas Lamprecht [Fri, 16 Sep 2022 10:56:29 +0000 (12:56 +0200)]
qmp client: increase default fallback timeout to 5s

allowing slower or overloaded systems a higher chance to finish
commands while not being to long to be problematic for sync api calls
with their 30s total budget

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agovzdump: tpmstate: include HMP error in message
Fabian Grünbichler [Wed, 14 Sep 2022 13:07:28 +0000 (15:07 +0200)]
vzdump: tpmstate: include HMP error in message

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
20 months agovzdump: tpmstate: escape drive string
Fabian Grünbichler [Wed, 14 Sep 2022 13:07:27 +0000 (15:07 +0200)]
vzdump: tpmstate: escape drive string

the volume path could contain escaped ":" or ",", which means their '\'
needs to be escaped another time for passing to HMP.

the same approach is used for hotplugging regular drives in
PVE::QemuServer, and is needed (at least) for RBD storages with IPv6
monhosts or an explicit monhost port.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
20 months agoapi: create disks: avoid adding secondary cloud-init drives
Fabian Ebner [Fri, 6 May 2022 10:11:14 +0000 (12:11 +0200)]
api: create disks: avoid adding secondary cloud-init drives

This will break possibly existing workflows like
1. add second cloud-init
2. remove first cloud-init
to change the cloud-init storage.

On the other hand, it avoids unintended misconfiguration of having
mutliple cloud-init drives with potentially different settings.

Also in preparation for adding cloud-init-related API calls, where
not being able to assume that there's only one cloud-init drive/state
would complicate things quite a bit.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
20 months agosnapshot: save VM state: propagate error from QEMU
Fiona Ebner [Mon, 29 Aug 2022 10:54:54 +0000 (12:54 +0200)]
snapshot: save VM state: propagate error from QEMU

So that there is a better chance to debug issues like in [0]. For
suspending, which uses the same QMP calls, this is already done.

[0]: https://forum.proxmox.com/threads/114203/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
20 months agocpu config: fix depreacation mapping on CPU hotplug of custom types
Thomas Lamprecht [Tue, 30 Aug 2022 07:25:03 +0000 (09:25 +0200)]
cpu config: fix depreacation mapping on CPU hotplug of custom types

we need to do the independent of is_custom_model to ensure the
reported model is understood by QEMU

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reported-by: Fiona Ebner <f.ebner@proxmox.com>
20 months agocpu config: map depreacated IceLake-Client CPU type to IceLake-Server
Thomas Lamprecht [Tue, 30 Aug 2022 07:04:41 +0000 (09:04 +0200)]
cpu config: map depreacated IceLake-Client CPU type to IceLake-Server

the former CPU type never existed on the market and will be dropped
by QEMU 7.1, so map it to the server variant as they're pretty much
identical anyway FIWCT.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agocpu config: minor code style nits/comment
Thomas Lamprecht [Tue, 30 Aug 2022 07:01:40 +0000 (09:01 +0200)]
cpu config: minor code style nits/comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agoexpand error for suspend with pcie pass through a bit
Thomas Lamprecht [Tue, 30 Aug 2022 06:34:50 +0000 (08:34 +0200)]
expand error for suspend with pcie pass through a bit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agoshorten and subjectively improve code comment
Thomas Lamprecht [Wed, 22 Jun 2022 13:08:31 +0000 (15:08 +0200)]
shorten and subjectively improve code comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agofix #3577: prevent suspension for VMs with pci passthrough
Dominik Csapak [Tue, 21 Jun 2022 14:07:04 +0000 (16:07 +0200)]
fix #3577: prevent suspension for VMs with pci passthrough

Prevent the user from suspending the vm at all, as while suspension
itself may finish, the saved state is incomplete as we can neither
save nor restore PCIe device state in any generic fashion, so
resuming will almost certainly break.

The single case when it could work is when the guest OS didn't uses
the passed through device at all, so there's no state, but that's
really odd (as why bother passing through then), and the user should
rather remove the hostpci entry in that case.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ T: reword commit message slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
21 months agoqmp client: increase guest fstrim timeout to 10 minutes
Fiona Ebner [Fri, 19 Aug 2022 07:01:24 +0000 (09:01 +0200)]
qmp client: increase guest fstrim timeout to 10 minutes

like for other drive-related operations. The default of 3 seconds is
just not enough for large (or slow) disks.

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

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
21 months agobump version to 7.2-4
Fabian Grünbichler [Tue, 16 Aug 2022 12:01:32 +0000 (14:01 +0200)]
bump version to 7.2-4

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agovzdump/pbs: die with missing, but configured master key
Fabian Grünbichler [Tue, 16 Aug 2022 11:52:38 +0000 (13:52 +0200)]
vzdump/pbs: die with missing, but configured master key

the created backups are encrypted, but are not restorable with the
master key in case the original PVE system is lost.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agopbs: detect mismatch of encryption settings and key
Fabian Grünbichler [Tue, 16 Aug 2022 09:45:41 +0000 (11:45 +0200)]
pbs: detect mismatch of encryption settings and key

if the key file doesn't exist (anymore), but the storage.cfg references
one, die when starting a backup that should use encryption instead of
falling back to plain-text operations.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agoautomatically add 'uuid' parameter when passing through NVIDIA vGPU
Dominik Csapak [Fri, 12 Aug 2022 09:29:49 +0000 (11:29 +0200)]
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>
22 months agoQemu-Server: fix wrong quotation
Matthias Heiserer [Thu, 30 Jun 2022 10:12:03 +0000 (12:12 +0200)]
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>
23 months agofix #4119: give namespace parameter to live-restore
Dominik Csapak [Wed, 22 Jun 2022 12:57:35 +0000 (14:57 +0200)]
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>
23 months agofix #4115: enable option to name QEMU threads after their main purpose
Thomas Lamprecht [Fri, 17 Jun 2022 12:25:49 +0000 (14:25 +0200)]
fix #4115: enable option to name QEMU threads after their main purpose

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix uninitialized value
Fabian Grünbichler [Mon, 30 May 2022 08:00:16 +0000 (10:00 +0200)]
fix uninitialized value

if the configured display hardware has the (optional) default type, but
some other attribute is set, this would match against `undef` and spew
lots of warnings in the logs.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agocpuconfig: add amd epyc milan model
Alexandre Derumier [Tue, 17 May 2022 15:15:26 +0000 (17:15 +0200)]
cpuconfig: add amd epyc milan model

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2 years agoqmp client: fix indendation of timeout checks
Thomas Lamprecht [Sat, 14 May 2022 07:24:21 +0000 (09:24 +0200)]
qmp client: fix indendation of timeout checks

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoRevert "bump version to 7.2-4"
Thomas Lamprecht [Fri, 13 May 2022 12:55:17 +0000 (14:55 +0200)]
Revert "bump version to 7.2-4"

bogus

This reverts commit 3613ae505d930fc33efab735328dd27e8746d06f.

2 years agoRevert "pbs: backup-ns parameter was renamed to ns"
Thomas Lamprecht [Fri, 13 May 2022 12:54:41 +0000 (14:54 +0200)]
Revert "pbs: backup-ns parameter was renamed to ns"

This reverts commit 479c274dd344016c0b7b8333b2283c371f654180.

2 years agobump version to 7.2-4
Thomas Lamprecht [Fri, 13 May 2022 12:51:36 +0000 (14:51 +0200)]
bump version to 7.2-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopbs: backup-ns parameter was renamed to ns
Thomas Lamprecht [Fri, 13 May 2022 12:51:01 +0000 (14:51 +0200)]
pbs: backup-ns parameter was renamed to ns

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3754: encode JSON as utf8 for CLI
Stefan Hrdlicka [Wed, 11 May 2022 12:42:37 +0000 (14:42 +0200)]
fix #3754: encode JSON as utf8 for CLI

since this output is printed to the command line it should
be encoded to avoid the wide character warnings

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
2 years agobump version to 7.2-3
Thomas Lamprecht [Thu, 12 May 2022 13:14:44 +0000 (15:14 +0200)]
bump version to 7.2-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: add versioned recommends on proxmox-backup-file-restore
Thomas Lamprecht [Thu, 12 May 2022 13:12:25 +0000 (15:12 +0200)]
d/control: add versioned recommends on proxmox-backup-file-restore

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosupport pbs namespaces
Wolfgang Bumiller [Thu, 12 May 2022 08:42:32 +0000 (10:42 +0200)]
support pbs namespaces

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
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>