2011/1/4 Eric Blake <eblake@xxxxxxxxxx>: > On 12/29/2010 05:36 PM, Matthias Bolte wrote: >> --- >> >> As we're currently in feature freeze this patch is meant to be >> applied after the next release. > > And we're now out of feature freeze, so I'm reviewing this... > >> + >> +static int >> +esxDomainSetAutostart(virDomainPtr domain, int autostart) >> +{ >> + Â Âint result = -1; >> + Â ÂesxPrivate *priv = domain->conn->privateData; >> + Â ÂesxVI_ObjectContent *virtualMachine = NULL; >> + Â ÂesxVI_HostAutoStartManagerConfig *spec = NULL; >> + Â ÂesxVI_AutoStartPowerInfo *powerInfo = NULL; >> + >> + Â Âif (esxVI_EnsureSession(priv->primary) < 0) { >> + Â Â Â Âreturn -1; >> + Â Â} >> + >> + Â Âif (esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid, >> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â NULL, &virtualMachine, >> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â esxVI_Occurrence_RequiredItem) < 0 || >> + Â Â Â ÂesxVI_HostAutoStartManagerConfig_Alloc(&spec) < 0) { >> + Â Â Â Âgoto cleanup; >> + Â Â} >> + >> + Â Âif (autostart) { >> + Â Â Â Â/* Enable autostart in general */ >> + Â Â Â Âif (esxVI_AutoStartDefaults_Alloc(&spec->defaults) < 0) { >> + Â Â Â Â Â Âgoto cleanup; >> + Â Â Â Â} >> + >> + Â Â Â Âspec->defaults->enabled = esxVI_Boolean_True; >> + Â Â} > > Can enabling the general autostart capability result in changing the > default of an unrelated domain with no specific autostart preference to > change over to doing autostart, as an unintended side effect of changing > the given domain to have mandatory autostart? ÂI'm hoping that the > answer is that enabling the global autostart capability doesn't change > the autostart behavior of any domains, in which case this patch looks fine. > Well, you've spotted a problem there that I didn't think of before :) Domains are individually configured to autostart or not and there is also this general switch to turn on/off autostart capability in general. Now, if the ESX driver turns on general autostart capability then this may result in enabling autostart for other domains that were marked for autostart but didn't because autostart was turned off in general. This needs a v2 that doesn't enable general autostart capability when it's disabled and there are domains marked for autostart. In this case the driver needs to report an error, as it cannot achieve the desired result under the given conditions. It's still safe to enable general autostart capability when there is no domain marked for autostart, or when only the domain is marked for autostart already that we want to enable autostart for anyway. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list