Jorgen Posted September 3, 2022 Share Posted September 3, 2022 Currently, unraid requires all USB devices added to a VM to be present on startup of that VM, or the startup fails. Libvirt actually supports adding USB devices as optional for VM startup using hostdev startuppolicy, see details below. But this can only be done in the XML view. It would be great if we could have another checkbox in the form view to specify that we want a specific USB device to be included with startuppolicy = optional. This will reduce the need to edit the XML directly, which always risks breaking the VM and deters many users. Something like this perhaps: Libvirt supports adding USB devices as optional for VM startup, using the hostdev source startupolicy = optional. https://libvirt.org/formatdomain.html#usb-pci-scsi-devices For example: <hostdev mode='subsystem' type='usb'> <source startupPolicy='optional'> <vendor id='0x1234'/> <product id='0xbeef'/> </source> </hostdev> It seems to work well in my limited testing, after some initial unrelated problems, see: Quote Link to comment
itimpi Posted September 3, 2022 Share Posted September 3, 2022 You can already do this using plugins, but I agree it would be nice to have it built in as standard. Quote Link to comment
SimonF Posted September 17, 2022 Share Posted September 17, 2022 (edited) On 9/3/2022 at 5:35 AM, Jorgen said: Currently, unraid requires all USB devices added to a VM to be present on startup of that VM, or the startup fails. Libvirt actually supports adding USB devices as optional for VM startup using hostdev startuppolicy, see details below. But this can only be done in the XML view. It would be great if we could have another checkbox in the form view to specify that we want a specific USB device to be included with startuppolicy = optional. This will reduce the need to edit the XML directly, which always risks breaking the VM and deters many users. Something like this perhaps: Libvirt supports adding USB devices as optional for VM startup, using the hostdev source startupolicy = optional. https://libvirt.org/formatdomain.html#usb-pci-scsi-devices For example: <hostdev mode='subsystem' type='usb'> <source startupPolicy='optional'> <vendor id='0x1234'/> <product id='0xbeef'/> </source> </hostdev> It seems to work well in my limited testing, after some initial unrelated problems, see: I have started to look at creating a PR for this requirement. Also will show missing devices. Edited September 17, 2022 by SimonF 2 Quote Link to comment
Solution SimonF Posted September 20, 2022 Solution Share Posted September 20, 2022 On 9/3/2022 at 5:35 AM, Jorgen said: Currently, unraid requires all USB devices added to a VM to be present on startup of that VM, or the startup fails. Libvirt actually supports adding USB devices as optional for VM startup using hostdev startuppolicy, see details below. But this can only be done in the XML view. It would be great if we could have another checkbox in the form view to specify that we want a specific USB device to be included with startuppolicy = optional. This will reduce the need to edit the XML directly, which always risks breaking the VM and deters many users. Something like this perhaps: Libvirt supports adding USB devices as optional for VM startup, using the hostdev source startupolicy = optional. https://libvirt.org/formatdomain.html#usb-pci-scsi-devices For example: <hostdev mode='subsystem' type='usb'> <source startupPolicy='optional'> <vendor id='0x1234'/> <product id='0xbeef'/> </source> </hostdev> It seems to work well in my limited testing, after some initial unrelated problems, see: Followed your suggestion and this has now been merged so will appear in the next RC.. Also includes support for missing USB devices so people can change to optional or remove. 2 Quote Link to comment
JonathanM Posted September 20, 2022 Share Posted September 20, 2022 47 minutes ago, SimonF said: Also includes support for missing USB devices so people can change to optional or remove. Would it be too much work to automatically change missing devices to optional, accompanied by a mid (yellow) level notification, something like... "VM was started without required USB device, automatically changed to optional" So the VM won't fail, but you would get a warning that something you need may be missing? Quote Link to comment
SimonF Posted September 20, 2022 Share Posted September 20, 2022 1 hour ago, JonathanM said: Would it be too much work to automatically change missing devices to optional, accompanied by a mid (yellow) level notification, something like... "VM was started without required USB device, automatically changed to optional" So the VM won't fail, but you would get a warning that something you need may be missing? Dont think it will be simple to do, also not sure it should still start without the device as ccould have a negative effect. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.