Hi! We're struggling to get device detaching to work reliably using Xen. We can reliably use the same code to manage devices using Libvirt+KVM without any problems. We've tested this on Xen with both CD-ROM and USB devices without success. See below for detailed descriptions. Thankful for any help! Regards, Daniel Espling --- For CD-ROM, we can mount them using attach-device but cannot remove them using the correspoding call to detach-device: cdrom7.xml contains: <disk type='file' device='cdrom'> <driver name='file' type='raw'/> <source file='/opt/diskimages/test7.iso'/> <target dev='hdc' bus='ide'/> <readonly/> </disk> eject.xml contains: <disk type='block' device='cdrom'> <driver name='file'/> <target dev='hdc' bus='ide'/> <readonly/> </disk> cdrom8.xml is identical to cdrom7.xml apart from the .iso file used. # virsh attach-device deb cdrom7.xml Device attached successfully # virsh detach-device deb cdrom7.xml error: no such device in deb # virsh attach-device deb eject.xml error: Failed to attach device from eject.xml error: POST operation failed: xend_post: error from xen daemon: (xend.err 'Device 5632 not connected') # virsh update-device deb cdrom8.xml --persistent error: Failed to update device from cdrom8.xml error: POST operation failed: xend_post: error from xen daemon: (xend.err 'Device 5632 not connected') dumpxml shows the cdrom device attached exactly as it's defined in the xml. Using virsh we're able to use "virsh detach-disk deb hdc" to unmount the CD-ROM, but we need to be able to do this using the python API. We cannot find a corresponding call to detach-disk and we therefore have to rely on detach-device instead, right? Are there any flags we can use for detachDeviceFlags() to replicate the functionality of detach-disk? ---- Similarly for USB devices, we can mount them OK but not remove them using the corresponding call to detach-device. Calling detach-disk works, but again we need to find the corresponding call for this function using the python API. One thing we've found with mounting USB devices is that they seem to be mounted on the SCSI bus instead of the USB one as specified: Example: usb7.xml contains: <disk type='file' device='disk'> <driver name='file' type='raw'/> <source file='/opt/diskimages/test7.iso'/> <target dev='sda' bus='usb'/> <readonly/> </disk> dumpxml shows: <disk type='file' device='disk'> <driver name='file'/> <source file='/opt/diskimages/test7.iso'/> <target dev='sda' bus='scsi'/> <readonly/> </disk> # virsh attach-device deb usb7.xml Device attached successfully Test attaching again (expected to fail): # virsh attach-device deb usb7.xml error: Failed to attach device from usb7.xml error: Requested operation is not valid: target 'sda' already exists `-testgrid7.leeds.ac.uk /opt/recontext # virsh detach-device deb usb7.xml error: no such device in deb ---- Relevant info: Compiled against library: libvir 0.9.9 Using library: libvir 0.9.9 Using API: Xen 0.9.9 Running hypervisor: Xen 4.0.0 Running CentOS 5.5 (final) Linux 2.6.32.24 #3 SMP Fri Oct 29 16:22:02 BST 2010 x86_64 x86_64 x86_64 GNU/Linux |