[libvirt] [PATCH/RFC] qemu: persist hotadd devices

Daniel P. Berrange berrange at redhat.com
Fri Oct 17 09:58:32 UTC 2008

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.

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

|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list