[libvirt] [PATCH 6/7] storage: Introduce storagePoolUpdateAllState function

Erik Skultety eskultet at redhat.com
Mon Mar 30 12:03:21 UTC 2015



On 03/25/2015 06:42 PM, John Ferlan wrote:
>> the 'checkPool' block has been moved to storagePoolUpdateAllState.
> 
> move the checkPool block into storageDriverInitialize. This ensures
> activating pools earlier allowing domains using volumes from a pool to
> be able to find the volume during qemuProcessReconnect ...

storagePoolUpdateAllState is called only from storageDriverInitialize...
moving checkPool to storageDriverInitialize would result in copying the
whole (65 lines) UpdateAllState body which I think is not necessary.

>>  static void
>> +storagePoolUpdateAllState(void)
>> +{
>> +    size_t i;
>> +    bool active = false;
>> +
>> +    for (i = 0; i < driver->pools.count; i++) {
>> +        virStoragePoolObjPtr pool = driver->pools.objs[i];
>> +        virStorageBackendPtr backend;
>> +
>> +        virStoragePoolObjLock(pool);
>> +        if (!virStoragePoolObjIsActive(pool)) {
>> +            virStoragePoolObjUnlock(pool);
>> +            continue;
>> +        }
>> +
>> +        if ((backend = virStorageBackendForType(pool->def->type)) == NULL) {
>> +            VIR_ERROR(_("Missing backend %d"), pool->def->type);
>> +            virStoragePoolObjUnlock(pool);
>> +            continue;
>> +        }
> 
> Redundant check with DriverAutostart and since that's the only place
> that calls us....  I think dropping the VIR_ERROR is fine...

storageDriverInitialize is the only place that calls UpdateAllState.
Based on the fact that 'Initialize' is executed before 'Autostart' I
think it might be better to remove the error check from 'Autostart' instead.

Erik




More information about the libvir-list mailing list