mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: Break out storageDriverLoadPoolState
Will simplify a future patch
This commit is contained in:
parent
c180a3dcf7
commit
af9dc75c1f
@ -75,25 +75,14 @@ static void storageDriverUnlock(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
storagePoolUpdateAllState(void)
|
storagePoolUpdateState(virStoragePoolObjPtr pool)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
bool active;
|
bool active;
|
||||||
|
|
||||||
for (i = 0; i < driver->pools.count; i++) {
|
|
||||||
virStoragePoolObjPtr pool = driver->pools.objs[i];
|
|
||||||
virStorageBackendPtr backend;
|
virStorageBackendPtr backend;
|
||||||
|
|
||||||
virStoragePoolObjLock(pool);
|
|
||||||
if (!virStoragePoolObjIsActive(pool)) {
|
|
||||||
virStoragePoolObjUnlock(pool);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((backend = virStorageBackendForType(pool->def->type)) == NULL) {
|
if ((backend = virStorageBackendForType(pool->def->type)) == NULL) {
|
||||||
VIR_ERROR(_("Missing backend %d"), pool->def->type);
|
VIR_ERROR(_("Missing backend %d"), pool->def->type);
|
||||||
virStoragePoolObjUnlock(pool);
|
goto error;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Backends which do not support 'checkPool' are considered
|
/* Backends which do not support 'checkPool' are considered
|
||||||
@ -106,8 +95,7 @@ storagePoolUpdateAllState(void)
|
|||||||
VIR_ERROR(_("Failed to initialize storage pool '%s': %s"),
|
VIR_ERROR(_("Failed to initialize storage pool '%s': %s"),
|
||||||
pool->def->name, err ? err->message :
|
pool->def->name, err ? err->message :
|
||||||
_("no error message found"));
|
_("no error message found"));
|
||||||
virStoragePoolObjUnlock(pool);
|
goto error;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We can pass NULL as connection, most backends do not use
|
/* We can pass NULL as connection, most backends do not use
|
||||||
@ -123,12 +111,30 @@ storagePoolUpdateAllState(void)
|
|||||||
VIR_ERROR(_("Failed to restart storage pool '%s': %s"),
|
VIR_ERROR(_("Failed to restart storage pool '%s': %s"),
|
||||||
pool->def->name, err ? err->message :
|
pool->def->name, err ? err->message :
|
||||||
_("no error message found"));
|
_("no error message found"));
|
||||||
virStoragePoolObjUnlock(pool);
|
goto error;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pool->active = active;
|
pool->active = active;
|
||||||
|
error:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
storagePoolUpdateAllState(void)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < driver->pools.count; i++) {
|
||||||
|
virStoragePoolObjPtr pool = driver->pools.objs[i];
|
||||||
|
|
||||||
|
virStoragePoolObjLock(pool);
|
||||||
|
if (!virStoragePoolObjIsActive(pool)) {
|
||||||
|
virStoragePoolObjUnlock(pool);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
storagePoolUpdateState(pool);
|
||||||
virStoragePoolObjUnlock(pool);
|
virStoragePoolObjUnlock(pool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user