
Jim Fehlig wrote:
This set implements two new APIs, virDomainAttachDeviceFlags and virDomainDetachDeviceFlags as discussed here
https://www.redhat.com/archives/libvir-list/2009-December/msg00124.html
Introduce two new APIs
virDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, unsigned flags) virDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, unsigned flags)
with flags being one or more from VIR_DOMAIN_DEVICE_MODIFY_CURRENT, VIR_DOMAIN_DEVICE_MODIFY_LIVE, VIR_DOMAIN_DEVICE_MODIFY_CONFIG.
If caller specifies CURRENT (default), add or remove the device depending on the current state of domain. E.g. if domain is active add or remove the device to/from live domain, if it is inactive change the persistent config. If caller specifies LIVE, only change the active domain. If caller specifies CONFIG, only change persistent config - even if the domain is active. If caller specifies both LIVE and CONFIG, then change both.
If a driver can not satisfy the exact requested flags it must return an error. E.g if user specified LIVE but the driver can only change live and persisted config, the driver must fail the request.
The existing virDomain{Attach,Detach}Device is now explicitly restricted to active domains and is equivalent to virDomain{Attach,Detach}DeviceFlags(LIVE).
Finally, virsh {attach,detach}-{disk,interface,device} has been modified to add a --persistent flag in order to set the appropriate flags when calling the new APIs.
I have pushed this series now that 0.7.6 is released. The only change from reviewed and ACK'ed patches is adjustment of src/libvirt_public.syms to assumed next release of 0.7.7. Thanks for input during specification of these APIs and review of the patches! Jim