Commit Graph

2945 Commits

Author SHA1 Message Date
Thomas Lamprecht
989b718a45 bump version to 7.2-7
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-13 15:47:29 +01:00
Thomas Lamprecht
cd1db1b3e0 migrate test: fix some more grave indentation/whitespace errors
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-13 14:56:57 +01:00
Alexandre Derumier
73ed64967e 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>
2022-11-13 14:56:57 +01:00
Thomas Lamprecht
4ddd2ca293 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>
2022-11-13 14:56:57 +01:00
Thomas Lamprecht
1b5ba4ddc6 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>
2022-11-13 14:56:57 +01:00
Alexandre Derumier
21947fea42 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>
2022-11-13 14:55:26 +01:00
Mira Limbeck
f9408af460 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>
2022-11-11 19:26:16 +01:00
Thomas Lamprecht
d74f424e39 test: usb: cover more ports on checking xhci 7.1+
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-11 09:10:18 +01:00
Dominik Csapak
b1099442b6 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>
2022-11-11 08:52:01 +01:00
Thomas Lamprecht
f6b24f427d usb: fixup: include USB config only for non-q35 again
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-11 07:43:03 +01:00
Thomas Lamprecht
342f049352 usb: small style/code cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-10 17:02:34 +01:00
Thomas Lamprecht
e68881e4a3 usb: get controllers: avoid separate loop for usb 2 devs and improve variable names
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-10 17:02:34 +01:00
Thomas Lamprecht
871ebe1775 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>
2022-11-10 17:02:34 +01:00
Dominik Csapak
c60cad61a0 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>
2022-11-10 17:02:34 +01:00
Dominik Csapak
0c3d18ef13 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>
2022-11-10 17:02:34 +01:00
Dominik Csapak
4862922a2b 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>
2022-11-10 17:02:34 +01:00
Dominik Csapak
3deccbd7d0 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>
2022-11-10 17:02:34 +01:00
Dominik Csapak
b06a24927c 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>
2022-11-10 17:02:34 +01:00
Dominik Csapak
238af88edc 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>
2022-11-10 17:02:34 +01:00
Dominik Csapak
2b938c7d88 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>
2022-11-10 17:02:34 +01:00
Thomas Lamprecht
faf72d6cbf 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>
2022-11-10 17:02:34 +01:00
Wolfgang Bumiller
c963efc882 use full path for /usr/bin/taskset
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-11-10 11:15:43 +01:00
Daniel Bowder
8387039819 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>
2022-11-10 09:39:28 +01:00
Dominik Csapak
6fa358a334 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>
2022-11-09 09:06:19 +01:00
Thomas Lamprecht
2fa64dbddd pci: add/improve HW reservation comments
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-09 08:55:55 +01:00
Dominik Csapak
1b189121fc 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>
2022-11-09 08:49:45 +01:00
Stefan Hanreich
76b29aafd7 fix #4228: add start parameter to rollback endpoint for automatic restarting of VM
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2022-11-08 18:15:49 +01:00
Matthias Heiserer
d80ad18c67 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>
2022-11-08 17:49:51 +01:00
Thomas Lamprecht
058fe7bc48 api: update cloudinit: line reduction/small cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-08 17:38:18 +01:00
Thomas Lamprecht
92f4be45d2 api: add cloudinit to available subdirs index
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-08 17:35:04 +01:00
Alexandre Derumier
94ec5e7c30 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>
2022-11-08 17:31:59 +01:00
Alexandre Derumier
9687287bb3 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>
2022-11-08 17:31:59 +01:00
Alexandre Derumier
2be1fb0af4 api2: add cloudinit config api
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-08 17:24:59 +01:00
Alexandre Derumier
71d9006b7c cloudinit: make cloudnit options fastplug
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
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
Alexandre Derumier
9c88e85446 migration: test targetnode min version for cloudinit section
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
31280b4b72 vzdump : skip special:cloudinit section
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
ae37db2423 qemuconfig: load_current_config : delete cloudinit value
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-08 17:23:30 +01:00
Fiona Ebner
dbc45fdf9f 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>
2022-11-08 16:21:27 +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
Thomas Lamprecht
3e9f8c5a53 bump version to 7.2-6
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-07 16:26:42 +01:00
Thomas Lamprecht
c0d75d2a29 d/control: bump versioned dependency of libpve-common-perl
for moved pve-targetstorage schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-07 16:26:23 +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
Thomas Lamprecht
8e8111da72 bump version to 7.2-5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-07 16:15:29 +01:00
Thomas Lamprecht
49063d763b 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>
2022-11-07 14:51:45 +01:00
Thomas Lamprecht
e79cf17d8d 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>
2022-11-07 14:43:27 +01:00
Thomas Lamprecht
10ff4fe745 qm: factor out setting node to local $nodename
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-07 13:57:12 +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