USB Qube Failover

I’m curious if there’s some method that could be used that follows the logic:

if sys-usb fails to start:
try attaching [devices that were attached to sys-usb] to sys-usb-failover
if sys-usb-failover fails to start:
run script that attaches the devices to dom0 on next boot

Obviously the potential for an automatic attachment of a USB device to dom0 comes with the security risk of doing that in the first place, but this also led me to consider the question in general:

What solutions, if any, has the community come up with to take some automated action on qube failure?

My guess is that salt might be able to do this, but I’m a little behind the curve on learning salt, so I’ll take a look at that in the meantime and follow up here if I figure it out on my own.

1 Like

Well, that didn’t take too long. Here’s what I’m thinking:

Some mechanism - maybe a cron job - checks the qvm.running state of sys-usb and if it doesn’t get true then it could try to start it and see if that fails.

If it does fail to start again - then it could use the qvm.prefs pcidevs state to remove all the pcidevs from sys-usb and then attach them to sys-usb-backup (which would ideally be a clone of a known-good sys-usb qube that hasn’t been updated or used since it was cloned), and then try to start it.

If that fails, maybe try restarting the full OS with sys-usb-backup configured to start on boot instead of sys-usb.

I’d imagine something similar could be done for other kinds of failures as well, I’ll try and put all the pieces together and share what I come up with, provided anyone is interested.

1 Like