[libvirt-users] script called from qemu hook freezes.

daggs daggs at gmx.com
Thu Jan 3 17:07:58 UTC 2019


Greetings,

I'm executing an external script when the qemu hook is called with start or release, the script is rather simple, upon start it iterates over the output of lsusb -t and for each device, it looks if it should be added to the vm we started, if so, it attaches it to the vm as follows:
virsh --connect qemu:///system "${cmd}" "${domain}" /dev/stdin << END
<hostdev mode='subsystem' type='usb'>
  <source>
   <address bus='${busnum}' device='${devnum}' />
  </source>
</hostdev>
END

where cmd is attach-device, domain is the vm's name, busnum and devnum come from the output of the lsusb -t.
my issue is that upon the first attach attempt, the cmd hangs, I need to kill it and after than I cannot preform any virsh cmd, I must restart the host.
if I try to execute the same cmd after the vm is up, it works great.

why the attach process gets stuck? do I need to execute it under different stage?

thanks,

Dagg.




More information about the libvirt-users mailing list