GPU passthrough with a stopped VM and backup kernel panic

AxxelH

Member
Nov 21, 2020
15
0
21
52
I have a rarely used VM configured for GPU passthrough, this VM is manually started when needed. The same GPU is passed through to an LXC container that is running most of the time. I have hookscripts on both VM and LXC that stop the other when one is starting. This works pretty well.

As part of backup of the VM the VM hookscript is run (pre-start and post-start), which I did not expect. There does not appear to be any indication to the hookscript that the start is related to a backup, so it stops the LXC as if the VM is actually starting. Since I'd prefer to keep the LXC running, I modified the hook script for the VM to not stop the LXC if the reason for the start is a backup (a vzdump script is used to track this so the VM hook knows).

Unfortunately, backing up the VM while the GPU is still in the LXC causes the machine to kernel panic. My guess is that this is because of some conflict in the driver binding as the VM tries to set it up for passthrough, even though the VM will never start or use the GPU.

Is there a way to backup a VM without "starting" the VM? In addition to the confusion of states in the hookscript, it seem unnecessary to configure the GPU for passthrough just to backup the filesystem?

If not, is there a better option than manually adding the GPU passthrough every time I want to use the VM? I'm aware from other threads that I don't have the option of adding the GPU passthrough to the VM on the fly from the hookscript.
 
Last edited:
Is there a way to backup a VM without "starting" the VM? In addition to the confusion of states in the hookscript, it seem unnecessary to configure the GPU for passthrough just to backup the filesystem?
no, not with built in methods.

the backup works by starting the qemu process, but without actually running the guest. then we can backup the data via qemu and stop the process again.
This is done to guarantee consistency and to be able to start the vm during backup (which wouldn't be possible otherwise)

If not, is there a better option than manually adding the GPU passthrough every time I want to use the VM? I'm aware from other threads that I don't have the option of adding the GPU passthrough to the VM on the fly from the hookscript.
i think we should make it possible so that (at least in an early stage of the guest) the hookscript should be able to add/remove stuff from the config.

would you mind opening a feature request for this on https://bugzilla.proxmox.com
no promises though, as my colleagues might not agree with me ;)