Re: Detach devices using Libvirt+Xen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/10/2012 03:24 AM, Daniel Espling wrote:
> Hi!
> 
> We're struggling to get device detaching to work reliably using Xen.

I haven't personally tried it under xen, so there may indeed be some
lurking bugs.

> 
> # virsh attach-device deb cdrom7.xml                                           
> Device attached successfully
> 
> # virsh detach-device deb cdrom7.xml                                           
> error: no such device in deb

The detach code is picky - you will have the best results if the XML you
detach matches exactly what 'virsh dumpxml deb' says for the device,
which might be slightly different than what you originally attached
(such as the addition of an <address> element stating how the guest sees
the device).

> 
> # 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.

But it looks like you already tried that.  Have you also tried 'virsh
update-device'?  The act of removing a media from a CD-ROM is _not_
detaching the CD-ROM device altogether, but updating it to have no media.

> 
> 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?

'virsh detach-disk' is just syntactic sugar around
virDomainDetachDevice; which is the same API being used by 'virsh
detach-device' but with more convenient command line arguments.  So
since there is only one API called by both virsh commands, it would be
the same API that you target through the python bindings if you are
trying to do it in python.

> 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)

CentOS 5 doesn't ship with that new of a libvirt out-of-the-box, so
since you are already building from source, you might have to invest
some time in the source code to see if the xen drivers in libvirt have a
bug in this area.  Sorry I'm not able to help more.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux