Commit Graph

18 Commits

Author SHA1 Message Date
Dominik Csapak
17dcba38dd ui: qemu: increase available usb ports depending on machine and ostype
in the backend, we allow up to 14 usb ports, but only if the vm can
use the qemu-xhci controller which is only possible since machine
version 7.1 and if the ostype is l26 or windows > 7

for this we introduce two helpers:
* qemu_min_version: modeled after the signature of 'min_version' from
  qemu-server, expects two arrays of versions and returns true if
  the first parameter is equal or greater than the second version
* get_max_usb_count looks at the given ostype and machine string
  and returns the proper maximum number

since we don't currently have the actual running version of the vm in
the gui, this is only a heuristic for running vms. but since the actual
running version could only be lower if none is set (e.g. for
migrated/long-running vms) we allow more in the gui and the backend will
do the proper thing (either hotplug it, or make it a pending change)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-11-10 17:06:41 +01:00
Dominik Csapak
988898a625 ui: USBInputPanel: use correct maximum usb index
We already have that factored out in PVE.Utils, so use that.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-11-10 17:06:41 +01:00
Dominic Jäger
f1374bff13 ui: eslint: Remove useless escapes
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-18 15:22:05 +02:00
Thomas Lamprecht
8058410f40 ui: eslint: fix various spacing related issues
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-01-19 17:39:15 +01:00
Thomas Lamprecht
f6710aac38 ui: eslint: fix trailing comma and comma related whitespaces errors
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-01-19 17:31:03 +01:00
Aaron Lauterer
0d077e8150 ui: vm/usbedit: simplify USB3 handling
Enable USB3 by default. There are no restrictions anymore that the speed
of the dev must match the USB3 speed. The xhci controller can deal with
USB 2 and 1 devices. USB3 devices can be plugged in a USB2 (ehci)
controller. As discussed in [0]

When using a USB device for SPICE passthrough my tests showed that USB2
devices connecting to the xhci controller work but a USB3 device passed
via Spice cannot connect to an ehci controller (no USB3 enabled).

qemu-server 6.0-9 supports USB3 also for Spice USB passthrough. See
commit 733234b [1].

All this means we can get rid of the separate handling of USB3 and non
USB3 devices and leave the decision to the user if USB3 should be
enabled or not.

[0]: https://pve.proxmox.com/pipermail/pve-devel/2019-September/039131.html
[1]: https://git.proxmox.com/?p=qemu-server.git;a=commitdiff;h=733234be04d585febd74c655d8b82d17ebf9e133

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-26 17:02:23 +02:00
Thomas Lamprecht
d155bbc960 ui: usbselector/usbedit: make widths a bit larger
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-26 16:39:02 +02:00
Aaron Lauterer
cc9c5af4aa ui: vm/usbedit: add gettext to label
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-09-26 07:31:18 +02:00
Thomas Lamprecht
17f6a3f6f4 ui: vm/usbedit: don't use getUSBValue to avoid possible duplicate "usb3"
As getUSBValue() always added the "usb3" property if the selected
device was recognized as USB3. But we can now also pass such a device
as USB2 so lift this restriction - which also fixes a bug for USB3
selected devices with the USB3 checkbox set.

The solution also avoids the me.down query, which is nice too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 17:08:08 +02:00
Thomas Lamprecht
2e8f031f99 ui: vm/usbedit: code & indentation cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 10:01:27 +02:00
Thomas Lamprecht
7c72eb5112 ui: vm/usbedit: cleanup and refactor usb selector change
split the long ternary operation into a common if/else, to make it
readable.

Also, remove the usb3field.isDisabled check as:
1. we do not disable it anywhere anymore
2. if we would, it makes sense to do this anyhow

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 08:42:25 +02:00
Thomas Lamprecht
4292a318ee ui: vm/usbedit: use simple bind for radio button changes
reduces code and is more expressive

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 08:18:15 +02:00
Thomas Lamprecht
410313f8b2 ui: vm/usbedit: omit usb3 changes for spice completely
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 08:17:56 +02:00
Aaron Lauterer
4d51f6572b usb: Enable USB3 for Spice USB passthrough
Instead of having two times the check if the USB3 setting needs to be
added to the config string it is now checked at one place only.

If USB3 is checked for a non USB3 device it will be attached to the USB2
root hub of the xhci controller.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-09-23 07:44:57 +02:00
Thomas Lamprecht
d49d0443b8 ui: use cbind to make usb input panel static
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-05-18 15:39:54 +02:00
Thomas Lamprecht
ef4ef788d5 use InputPanel from widget toolkit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
2018-01-25 13:36:38 +01:00
Thomas Lamprecht
9fccc702ec use windowEdit from widget toolkit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
2018-01-25 13:36:38 +01:00
Dominik Csapak
f46721af8e add usbselector and usb edit window for qemu
the edit window has 3 radiobuttons (spice,device,port)

and a checkbox for usb3 (which gets disabled and checked
if you choose a usb3 device)

also it makes use of the help feature

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-06-08 15:57:56 +02:00