[libvirt] OS Eject & Removable Media

Jacob Leaver jleaver at c-corp.net
Mon Aug 24 23:18:56 UTC 2009


> Yeah, that's pretty much the problem in a nutshell. No notificatons
> from QEMU
>
> The only immediate option i see is to run 'info block' every time we
> invoke virDomainGetXMLDesc(), in order to check if the CDROM media has
> been ejected. Mildly disgusting, but probably doable.
>

Thanks for the quick and friendly reply!  It's nice to have confirmation.

Looking through the code with creating a qemu driver patch 
(specifically) in mind, it looks like I'd need to create a function, 
probably similar to info blockstats, that took a dom and a path 
argument, and returned a file, or if it was specific to this task, took 
an additional filepath to compare against, and return a true or false.

Then I'd want to add some functionality into either DomainXMLFromNative 
which might be too high-level, or possibly ParseCommandLineDisk in 
qemu_conf.c (which is ugly from a naming convention perspective, but 
simpler since all the data is right there.)

I'd compare the returned filename with dev->src (in 
ParseCommandLineDisk) and change the src to null if there's no mounted 
media.

I'm not so great at c coding, but I think I can hack something out if 
this sounds reasonable so far.

Thanks,

Jacob Leaver




More information about the libvir-list mailing list