[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] esx: Add domain autostart support



2011/1/4 Eric Blake <eblake redhat com>:
> 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]