On Fri, Oct 17, 2008 at 10:58:32AM +0100, Daniel P. Berrange wrote:
On Fri, Oct 17, 2008 at 09:50:35AM +0200, Guido G?nther wrote:
> Hi,
> currently devices added via qemudDomainAttachDevice don't ever get
> written out into the xml domain definition. Is this intentional?
Yes, because it allows mgmt app to decide whether they want the
device to be persist, or transient. If you always save the config
then there's no way for the mgmt app to add a transient device.
To persist it, currently we recommend calling DefineXML wit hthe
complete config.
Arguably though, we should have a version of AttachDevice which
allows this to be specified explicitly. Also CIM would like the
ability to add a device to the persistent config without touching
the inactive config.
Well that's a good example that when defining an interface, even if
one passes an XML it's good to have a flags parameter anyway, you really
don't want to stuck this in the XML. I need to keep this in mind.
So we could try something like
enum {
VIR_DOMAIN_ATTACH_DEVICE_TRANSIENT = 0, /* Hotplug device, don't save */
VIR_DOMAIN_ATTACH_DEVICE_PERSISTENT = 1, /* Hotplug device, and save */
VIR_DOMAIN_ATTACH_DEVICE_INACTIVE = 2 /* Don't hotplug, only save */
};
virDomainAttachDeviceOpts(virDomainPtr dom,
const char *xml,
int flags)
The existing method could just be a stub calling
virDomainAttachDevice(dom, xml, VIR_DOMAIN_ATTACH_DEVICE_TRANSIENT);
One more entry point, sigh, but it makes sense, yes.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/