storage: Use virStoragePoolObj{Is|Set}Active
Use the new accessor APIs for storage_driver, test_driver, and gluster backend.
This commit is contained in:
parent
1bd4349671
commit
0147f72741
@ -544,7 +544,7 @@ virStorageBackendGlusterCheckPool(virStoragePoolObjPtr pool,
|
|||||||
/* Return previous state remembered by the status XML. If the pool is not
|
/* 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.
|
* 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 */
|
* This will save one attempt to open the connection to the remote server */
|
||||||
*active = pool->active;
|
*active = virStoragePoolObjIsActive(pool);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,9 +145,9 @@ storagePoolUpdateState(virStoragePoolObjPtr obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->active = active;
|
virStoragePoolObjSetActive(obj, active);
|
||||||
|
|
||||||
if (!obj->active)
|
if (!virStoragePoolObjIsActive(obj))
|
||||||
virStoragePoolUpdateInactive(&obj);
|
virStoragePoolUpdateInactive(&obj);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -226,7 +226,7 @@ storageDriverAutostart(void)
|
|||||||
_("Failed to autostart storage pool '%s': %s"),
|
_("Failed to autostart storage pool '%s': %s"),
|
||||||
obj->def->name, virGetLastErrorMessage());
|
obj->def->name, virGetLastErrorMessage());
|
||||||
} else {
|
} else {
|
||||||
obj->active = true;
|
virStoragePoolObjSetActive(obj, true);
|
||||||
}
|
}
|
||||||
VIR_FREE(stateFile);
|
VIR_FREE(stateFile);
|
||||||
}
|
}
|
||||||
@ -735,7 +735,7 @@ storagePoolCreateXML(virConnectPtr conn,
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
VIR_INFO("Creating storage pool '%s'", obj->def->name);
|
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);
|
pool = virGetStoragePool(conn, obj->def->name, obj->def->uuid, NULL, NULL);
|
||||||
|
|
||||||
@ -940,7 +940,7 @@ storagePoolCreate(virStoragePoolPtr pool,
|
|||||||
VIR_STORAGE_POOL_EVENT_STARTED,
|
VIR_STORAGE_POOL_EVENT_STARTED,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
obj->active = true;
|
virStoragePoolObjSetActive(obj, true);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -1040,7 +1040,7 @@ storagePoolDestroy(virStoragePoolPtr pool)
|
|||||||
VIR_STORAGE_POOL_EVENT_STOPPED,
|
VIR_STORAGE_POOL_EVENT_STOPPED,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
obj->active = false;
|
virStoragePoolObjSetActive(obj, false);
|
||||||
|
|
||||||
virStoragePoolUpdateInactive(&obj);
|
virStoragePoolUpdateInactive(&obj);
|
||||||
|
|
||||||
@ -1156,7 +1156,7 @@ storagePoolRefresh(virStoragePoolPtr pool,
|
|||||||
obj->def->uuid,
|
obj->def->uuid,
|
||||||
VIR_STORAGE_POOL_EVENT_STOPPED,
|
VIR_STORAGE_POOL_EVENT_STOPPED,
|
||||||
0);
|
0);
|
||||||
obj->active = false;
|
virStoragePoolObjSetActive(obj, false);
|
||||||
|
|
||||||
virStoragePoolUpdateInactive(&obj);
|
virStoragePoolUpdateInactive(&obj);
|
||||||
|
|
||||||
@ -1194,7 +1194,7 @@ storagePoolGetInfo(virStoragePoolPtr pool,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
memset(info, 0, sizeof(virStoragePoolInfo));
|
memset(info, 0, sizeof(virStoragePoolInfo));
|
||||||
if (obj->active)
|
if (virStoragePoolObjIsActive(obj))
|
||||||
info->state = VIR_STORAGE_POOL_RUNNING;
|
info->state = VIR_STORAGE_POOL_RUNNING;
|
||||||
else
|
else
|
||||||
info->state = VIR_STORAGE_POOL_INACTIVE;
|
info->state = VIR_STORAGE_POOL_INACTIVE;
|
||||||
|
@ -1131,7 +1131,7 @@ testParseStorage(testDriverPtr privconn,
|
|||||||
virStoragePoolObjUnlock(obj);
|
virStoragePoolObjUnlock(obj);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
obj->active = true;
|
virStoragePoolObjSetActive(obj, true);
|
||||||
|
|
||||||
/* Find storage volumes */
|
/* Find storage volumes */
|
||||||
if (testOpenVolumesForPool(file, ctxt, obj, i+1) < 0) {
|
if (testOpenVolumesForPool(file, ctxt, obj, i+1) < 0) {
|
||||||
@ -4344,7 +4344,7 @@ testStoragePoolCreate(virStoragePoolPtr pool,
|
|||||||
if (!(obj = testStoragePoolObjFindInactiveByName(privconn, pool->name)))
|
if (!(obj = testStoragePoolObjFindInactiveByName(privconn, pool->name)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
obj->active = true;
|
virStoragePoolObjSetActive(obj, true);
|
||||||
|
|
||||||
event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid,
|
event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid,
|
||||||
VIR_STORAGE_POOL_EVENT_STARTED,
|
VIR_STORAGE_POOL_EVENT_STARTED,
|
||||||
@ -4492,7 +4492,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
|
|||||||
* code will not Remove the pool */
|
* code will not Remove the pool */
|
||||||
virStoragePoolObjSetConfigFile(obj, NULL);
|
virStoragePoolObjSetConfigFile(obj, NULL);
|
||||||
|
|
||||||
obj->active = true;
|
virStoragePoolObjSetActive(obj, true);
|
||||||
|
|
||||||
event = virStoragePoolEventLifecycleNew(obj->def->name, obj->def->uuid,
|
event = virStoragePoolEventLifecycleNew(obj->def->name, obj->def->uuid,
|
||||||
VIR_STORAGE_POOL_EVENT_STARTED,
|
VIR_STORAGE_POOL_EVENT_STARTED,
|
||||||
@ -4640,7 +4640,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
|
|||||||
if (!(obj = testStoragePoolObjFindActiveByName(privconn, pool->name)))
|
if (!(obj = testStoragePoolObjFindActiveByName(privconn, pool->name)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
obj->active = false;
|
virStoragePoolObjSetActive(obj, false);
|
||||||
|
|
||||||
if (obj->def->source.adapter.type ==
|
if (obj->def->source.adapter.type ==
|
||||||
VIR_STORAGE_ADAPTER_TYPE_FC_HOST) {
|
VIR_STORAGE_ADAPTER_TYPE_FC_HOST) {
|
||||||
@ -4718,7 +4718,7 @@ testStoragePoolGetInfo(virStoragePoolPtr pool,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(info, 0, sizeof(virStoragePoolInfo));
|
memset(info, 0, sizeof(virStoragePoolInfo));
|
||||||
if (obj->active)
|
if (virStoragePoolObjIsActive(obj))
|
||||||
info->state = VIR_STORAGE_POOL_RUNNING;
|
info->state = VIR_STORAGE_POOL_RUNNING;
|
||||||
else
|
else
|
||||||
info->state = VIR_STORAGE_POOL_INACTIVE;
|
info->state = VIR_STORAGE_POOL_INACTIVE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user