On Thu, Dec 12, 2013 at 07:54:34AM -0700, Eric Blake wrote: > On 12/12/2013 07:41 AM, Daniel P. Berrange wrote: > > > > The usage you describe here is not within the scope of the > > virInterfaceCreate() API IMHO. If we want users to have the > > ability to "re start" an interface without taking it offline > > first, then we should add another API that explicitly supports > > that use case. > > Or even a flag to the existing argument that says to restart if already > running, where the normal case of not having the flag is an error if > already running. > > > Overloading a single virInterfaceCreate to support two different use > > cases puts applications in an impossible position if they *want* to > > see an error from attempting to start an already active interface. > > Overloading without the use of a flag bit, that is. In this scenario I'd prefer a separate API. Flags are good when they are tweaking some aspect of behaviour but leaving the overall semantics of the method intact. A virInterfaceCreate API call is a lifecycle operation, which should result in a lifecycle change (and event emission) upon success. Just doing a refresh of the config isn't a lifecycle change and would not be expected to trigger any lifecycle events either. This is different enough that I think it would belong in a separate API. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list