Support for adding optional USB devices in VM Manager form view


Jorgen

Recommended Posts

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:

318297034_OptionalUSBdevices.jpg.ea1bf93daf9c951fd9db63b75efa1186.jpg

 

 

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

969251564_ScreenShot2022-09-03at2_07_38pm.thumb.png.c93278178beefc8a56c87d53a22a3829.png

 

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:

 

Link to comment
  • 2 weeks later...
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:

318297034_OptionalUSBdevices.jpg.ea1bf93daf9c951fd9db63b75efa1186.jpg

 

 

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

969251564_ScreenShot2022-09-03at2_07_38pm.thumb.png.c93278178beefc8a56c87d53a22a3829.png

 

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.

 

image.png.5d3714a59002c8a6490f4eb1a94d7886.png

Edited by SimonF
  • Like 2
Link to comment
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:

318297034_OptionalUSBdevices.jpg.ea1bf93daf9c951fd9db63b75efa1186.jpg

 

 

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

969251564_ScreenShot2022-09-03at2_07_38pm.thumb.png.c93278178beefc8a56c87d53a22a3829.png

 

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.

image.thumb.png.a45e014742c76d7a446de85bff0adb35.png

  • Like 2
Link to comment
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?

Link to comment
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. 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.