$ /usr/bin/virsh detach-device WinXP-clone /var/lib/libvirt/images/hostdev-0694:0002.xml
Fehler: Fehler beim Lösen des Geräts von /var/lib/libvirt/images/hostdev-0694:0002.xml
Fehler: operation failed: host usb device vendor=0x0694 product=0x0002 not found
Ubuntu 13.04
libvirt0: 1.0.2-0ubuntu11 .13.04. 2
The automatic unplugging of usb devices (in this case a Lego NXT) doesn't work any more. The following udev rule is used;
ACTION=="remove", \ ="usb", \ idVendor} =="0694" , \ idProduct} =="0002" , \ ="/usr/ bin/virsh detach-device WinXP-clone /var/lib/ libvirt/ images/ hostdev- 0694:0002. xml" ="usb", \ idVendor} =="0694" , \ idProduct} =="0002" , \ ="/usr/ bin/virsh attach-device WinXP-clone /var/lib/ libvirt/ images/ hostdev- 0694:0002. xml"
SUBSYSTEMS=
ATTRS{
ATTRS{
RUN+
ACTION=="add", \
SUBSYSTEMS=
ATTRS{
ATTRS{
RUN+
the reason is apparently a bug in 'virsh detach-device':
$ /usr/bin/virsh attach-device WinXP-clone /var/lib/ libvirt/ images/ hostdev- 0694:0002. xml
Device attached successfully
$ /usr/bin/virsh detach-device WinXP-clone /var/lib/ libvirt/ images/ hostdev- 0694:0002. xml libvirt/ images/ hostdev- 0694:0002. xml
Fehler: Fehler beim Lösen des Geräts von /var/lib/
Fehler: operation failed: host usb device vendor=0x0694 product=0x0002 not found
$ cat /var/lib/ libvirt/ images/ hostdev- 0694:0002. xml
<!--NXT -->
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x0694'/>
<product id='0x0002'/>
</source>
</hostdev>
A fix might be described in RH bug# 916837: domain_ conf.c | 2 +-
---
src/conf/
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/ domain_ conf.c b/src/conf/ domain_ conf.c domain_ conf.c domain_ conf.c evMatchSubsysUS B(virDomainHost devDefPtr a,
virDomainHo stdevDefPtr b) subsys. u.usb.bus && b->source. subsys. u.usb.device) { subsys. u.usb.bus && a->source. subsys. u.usb.device) { subsys. u.usb.bus == b->source. subsys. u.usb.bus &&
a- >source. subsys. u.usb.device == b->source. subsys. u.usb.device)
index 4cae0d3..2b2f35c 100644
--- a/src/conf/
+++ b/src/conf/
@@ -8541,7 +8541,7 @@ static int
virDomainHostd
{
- if (b->source.
+ if (a->source.
/* specified by bus location on host */
if (a->source.
--
1.7.11.2