Need to restart VM with passthrough that crash.

FrancisS

Well-Known Member
Apr 26, 2019
65
8
48
61
Hello,

We have a VM with USB passthough that crash with the error "usb_packet_check_state".

We need to restart automatically the VM.

The cluster is configured with "shutdown_policy=migrate" (some VMs not in HA !) and the VM with HA state "ignored".

If we set the VM with the "state=started" (after a crash the VM restart) , the hypervisor restart loop trying to migrate the VM.

Is there a plan to have the possibility to set a "shutdown_policy" for a VM (not only globally) ?

We do not want to use a script/cron...

Best regards.

Francis
 
Hello,

Per-VM policy Patch
There is a patch that hasn't been applied:
This is the only mention of a feature like this on the mailing, that i am aware of. But it wouldn't be a permanent per-VM shutdown policy, like you envision.

Similar Reported Bugs
Bug 2614 - Something like this should also resolve your issue, but nobody took at look at this yet.

Interim Solution (Script)
You mentioned that you do not want to avoid using scripts, but i believe that this might be your best approach currently. For example, a script that runs before the pve-ha-lrm service starts it shutdown procedure.

You can tag the VM using qm set <VMID> --tags nomigrate and shut down the VM gracefully before the HA attempts to migrate them.

Interim Solution (No Script)
You can utilize the HA Node Affinity Rules to pin the VM to a single node. This should keep the VM from migrating away from the Node with the node hosting the USB device. The VM would stay HA-managed this way. When a shutdown is initiated the HA manager shouldn't find a valid migration target.

Similar to this:
ha-manager rules add node-affinity usb-vm-rule --resources vm:<VMID> --nodes <node-name> --strict

See the docs here.

Best regards,
Elias