
On Fri, Aug 3, 2012 at 12:54 PM, Christophe Fergeau <cfergeau@redhat.com> wrote:
On Fri, Aug 03, 2012 at 12:44:10PM +0200, Marc-André Lureau wrote:
The counterpart GVirDomainStartFlags uses _NONE. Is this a "flawed" in libvirt API? Do we prefer to copy libvirt or do we want consitancy? I prefer constitancy.
I don't think this is a flaw, it's just that '0' has a different meaning depending on the API. Sometimes 0 means 'no flag', ie no additional behaviour, in this 'default' case, it means that the behaviour will be equivalent to one of the flags, but we don't indicate which one, we let the hypervisor choose the default one. So having different names for the enum for the 0 value doesn't strike me as inconsistent as they indicate slightly different things.
Yes, but in this particual case : virDomainShutdownFlagValues VIR_DOMAIN_SHUTDOWN_DEFAULT = 0, /* hypervisor choice */ (in libvirt Create means Launch or Start) virDomainCreateFlags VIR_DOMAIN_NONE = 0, /* Default behavior */ It would make sense if libvirt had VIR_DOMAIN_START_DEFAULT instead (the rest of the values have DOMAIN_START prefix too..), and we use _DEFAULT too for something that leaves libvirt hypervisor backend choose the behavior. -- Marc-André Lureau