
Daniel Veillard wrote:
On Mon, Nov 16, 2009 at 04:06:41PM -0700, Jim Fehlig wrote:
virDomain{Attach,Detach}Device is only permitted on active domains. Explicitly state this restriction in the API documentation.
Well, actually I'm not sure it's true. For exemple the XML xen driver has an implementation for inactive Xen domains, and if I look at the VirtualBox driver it seems to take care of domains which are not currently running (or paused).
So what do folks prefer? Allow the individual drivers to restrict attach/detach device or enforce restriction in the front-end? IMO, it should be delegated to the individual drivers, with a comment in the API description that some hypervisors may not support this operation on inactive domains. Why restrict a hypervisor's management functionality in the libvirt front-end?
Also if we were to implement that restriction it would be better done in the libvirt.c front-end by asking the driver if the domin is active and returning directly from there.
Agreed. I had already thought about this after submitting the patch. I'll rework the patch depending on consensus answer to above question. Thanks, Jim