{
size_t i;
int ret = -1;
- unsigned long long orig_pool_available, orig_pool_allocation;
if (!backend->deleteVol) {
virReportError(VIR_ERR_NO_SUPPORT,
goto cleanup;
}
- orig_pool_available = pool->def->available;
- orig_pool_allocation = pool->def->allocation;
-
if (backend->deleteVol(obj->conn, pool, vol, flags) < 0)
goto cleanup;
* in this module since the allocation/available weren't adjusted yet
*/
if (updateMeta) {
- if (orig_pool_allocation == pool->def->allocation)
- pool->def->allocation -= vol->target.allocation;
- if (orig_pool_available == pool->def->available)
- pool->def->available += vol->target.allocation;
+ pool->def->allocation -= vol->target.allocation;
+ pool->def->available += vol->target.allocation;
}
for (i = 0; i < pool->volumes.count; i++) {
virStorageVolDefPtr voldef = NULL;
virStorageVolPtr ret = NULL, volobj = NULL;
virStorageVolDefPtr buildvoldef = NULL;
- unsigned long long orig_pool_available, orig_pool_allocation;
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
goto cleanup;
}
- orig_pool_available = pool->def->available;
- orig_pool_allocation = pool->def->allocation;
-
/* Wipe any key the user may have suggested, as volume creation
* will generate the canonical key. */
VIR_FREE(voldef->key);
goto cleanup;
/* Update pool metadata */
- if (orig_pool_allocation == pool->def->allocation)
- pool->def->allocation += buildvoldef->target.allocation;
- if (orig_pool_available == pool->def->available)
- pool->def->available -= buildvoldef->target.allocation;
+ pool->def->allocation += buildvoldef->target.allocation;
+ pool->def->available -= buildvoldef->target.allocation;
VIR_INFO("Creating volume '%s' in storage pool '%s'",
volobj->name, pool->def->name);
virStorageVolDefPtr origvol = NULL, newvol = NULL;
virStorageVolPtr ret = NULL, volobj = NULL;
unsigned long long allocation;
- unsigned long long orig_pool_available, orig_pool_allocation;
int buildret;
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA |
pool->volumes.count+1) < 0)
goto cleanup;
- orig_pool_available = pool->def->available;
- orig_pool_allocation = pool->def->allocation;
-
/* 'Define' the new volume so we get async progress reporting.
* Wipe any key the user may have suggested, as volume creation
* will generate the canonical key. */
newvol = NULL;
/* Updating pool metadata */
- if (orig_pool_allocation == pool->def->allocation)
- pool->def->allocation += allocation;
- if (orig_pool_available == pool->def->available)
- pool->def->available -= allocation;
+ pool->def->allocation += allocation;
+ pool->def->available -= allocation;
VIR_INFO("Creating volume '%s' in storage pool '%s'",
volobj->name, pool->def->name);