storage: Use virStoragePoolObj{Is|Set}Active

Use the new accessor APIs for storage_driver, test_driver, and
gluster backend.
This commit is contained in:
John Ferlan 2017-07-26 12:15:42 -04:00
parent 1bd4349671
commit 0147f72741
3 changed files with 14 additions and 14 deletions

View File

@ -544,7 +544,7 @@ virStorageBackendGlusterCheckPool(virStoragePoolObjPtr pool,
/* Return previous state remembered by the status XML. If the pool is not
* available we will fail to refresh it and end up in the same situation.
* This will save one attempt to open the connection to the remote server */
*active = pool->active;
*active = virStoragePoolObjIsActive(pool);
return 0;
}

View File

@ -145,9 +145,9 @@ storagePoolUpdateState(virStoragePoolObjPtr obj)
}
}
obj->active = active;
virStoragePoolObjSetActive(obj, active);
if (!obj->active)
if (!virStoragePoolObjIsActive(obj))
virStoragePoolUpdateInactive(&obj);
cleanup:
@ -226,7 +226,7 @@ storageDriverAutostart(void)
_("Failed to autostart storage pool '%s': %s"),
obj->def->name, virGetLastErrorMessage());
} else {
obj->active = true;
virStoragePoolObjSetActive(obj, true);
}
VIR_FREE(stateFile);
}
@ -735,7 +735,7 @@ storagePoolCreateXML(virConnectPtr conn,
0);
VIR_INFO("Creating storage pool '%s'", obj->def->name);
obj->active = true;
virStoragePoolObjSetActive(obj, true);
pool = virGetStoragePool(conn, obj->def->name, obj->def->uuid, NULL, NULL);
@ -940,7 +940,7 @@ storagePoolCreate(virStoragePoolPtr pool,
VIR_STORAGE_POOL_EVENT_STARTED,
0);
obj->active = true;
virStoragePoolObjSetActive(obj, true);
ret = 0;
cleanup:
@ -1040,7 +1040,7 @@ storagePoolDestroy(virStoragePoolPtr pool)
VIR_STORAGE_POOL_EVENT_STOPPED,
0);
obj->active = false;
virStoragePoolObjSetActive(obj, false);
virStoragePoolUpdateInactive(&obj);
@ -1156,7 +1156,7 @@ storagePoolRefresh(virStoragePoolPtr pool,
obj->def->uuid,
VIR_STORAGE_POOL_EVENT_STOPPED,
0);
obj->active = false;
virStoragePoolObjSetActive(obj, false);
virStoragePoolUpdateInactive(&obj);
@ -1194,7 +1194,7 @@ storagePoolGetInfo(virStoragePoolPtr pool,
goto cleanup;
memset(info, 0, sizeof(virStoragePoolInfo));
if (obj->active)
if (virStoragePoolObjIsActive(obj))
info->state = VIR_STORAGE_POOL_RUNNING;
else
info->state = VIR_STORAGE_POOL_INACTIVE;

View File

@ -1131,7 +1131,7 @@ testParseStorage(testDriverPtr privconn,
virStoragePoolObjUnlock(obj);
goto error;
}
obj->active = true;
virStoragePoolObjSetActive(obj, true);
/* Find storage volumes */
if (testOpenVolumesForPool(file, ctxt, obj, i+1) < 0) {
@ -4344,7 +4344,7 @@ testStoragePoolCreate(virStoragePoolPtr pool,
if (!(obj = testStoragePoolObjFindInactiveByName(privconn, pool->name)))
return -1;
obj->active = true;
virStoragePoolObjSetActive(obj, true);
event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid,
VIR_STORAGE_POOL_EVENT_STARTED,
@ -4492,7 +4492,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
* code will not Remove the pool */
virStoragePoolObjSetConfigFile(obj, NULL);
obj->active = true;
virStoragePoolObjSetActive(obj, true);
event = virStoragePoolEventLifecycleNew(obj->def->name, obj->def->uuid,
VIR_STORAGE_POOL_EVENT_STARTED,
@ -4640,7 +4640,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
if (!(obj = testStoragePoolObjFindActiveByName(privconn, pool->name)))
return -1;
obj->active = false;
virStoragePoolObjSetActive(obj, false);
if (obj->def->source.adapter.type ==
VIR_STORAGE_ADAPTER_TYPE_FC_HOST) {
@ -4718,7 +4718,7 @@ testStoragePoolGetInfo(virStoragePoolPtr pool,
return -1;
memset(info, 0, sizeof(virStoragePoolInfo));
if (obj->active)
if (virStoragePoolObjIsActive(obj))
info->state = VIR_STORAGE_POOL_RUNNING;
else
info->state = VIR_STORAGE_POOL_INACTIVE;