Sent: Friday, April 10, 2026 at 5:10 PM From: "daggs via Users" <users@lists.libvirt.org> To: users@lists.libvirt.org Subject: attaching a specific usb device to vm
Greetings,
I have two identical hdd to usb enclosures connected to a server which run two vms, lets call the foo and goo. I'm looking for the ability to connect a specific hdd to a specific vm, naturally using vendor and device is not possible and using bus+port will provide what I need however it does not persists incase of port change. I saw that using the hooks, libvirt provides the xml to the hook and read it from the output of the hook. I tried adding detection and adding accurate hostdev xml tag to the vm xml and I see it from the output of the hook execution in the prepare stage however, the system boots but the hdd is not visible in guest.
the docs reference this feature only for migrate and restore ops, does this means I cannot use it in the prepare stage? if so, is there another way to do what I want?
Thanks,
Dagg
I forgot a small but important detail, I'm running both vms in session mode, each as a different user