mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
Revert "storage: Don't duplicate efforts of backend driver"
This reverts commit 2ac0e647bdd33d93a374e7ef3eadf2a253c7bf79.
This commit is contained in:
parent
e983e62514
commit
6727bfd728
@ -1634,7 +1634,6 @@ storageVolDeleteInternal(virStorageVolPtr obj,
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
unsigned long long orig_pool_available, orig_pool_allocation;
|
|
||||||
|
|
||||||
if (!backend->deleteVol) {
|
if (!backend->deleteVol) {
|
||||||
virReportError(VIR_ERR_NO_SUPPORT,
|
virReportError(VIR_ERR_NO_SUPPORT,
|
||||||
@ -1643,9 +1642,6 @@ storageVolDeleteInternal(virStorageVolPtr obj,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_pool_available = pool->def->available;
|
|
||||||
orig_pool_allocation = pool->def->allocation;
|
|
||||||
|
|
||||||
if (backend->deleteVol(obj->conn, pool, vol, flags) < 0)
|
if (backend->deleteVol(obj->conn, pool, vol, flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1653,10 +1649,8 @@ storageVolDeleteInternal(virStorageVolPtr obj,
|
|||||||
* in this module since the allocation/available weren't adjusted yet
|
* in this module since the allocation/available weren't adjusted yet
|
||||||
*/
|
*/
|
||||||
if (updateMeta) {
|
if (updateMeta) {
|
||||||
if (orig_pool_allocation == pool->def->allocation)
|
pool->def->allocation -= vol->target.allocation;
|
||||||
pool->def->allocation -= vol->target.allocation;
|
pool->def->available += vol->target.allocation;
|
||||||
if (orig_pool_available == pool->def->available)
|
|
||||||
pool->def->available += vol->target.allocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < pool->volumes.count; i++) {
|
for (i = 0; i < pool->volumes.count; i++) {
|
||||||
@ -1775,7 +1769,6 @@ storageVolCreateXML(virStoragePoolPtr obj,
|
|||||||
virStorageVolDefPtr voldef = NULL;
|
virStorageVolDefPtr voldef = NULL;
|
||||||
virStorageVolPtr ret = NULL, volobj = NULL;
|
virStorageVolPtr ret = NULL, volobj = NULL;
|
||||||
virStorageVolDefPtr buildvoldef = NULL;
|
virStorageVolDefPtr buildvoldef = NULL;
|
||||||
unsigned long long orig_pool_available, orig_pool_allocation;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
|
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
|
||||||
|
|
||||||
@ -1823,9 +1816,6 @@ storageVolCreateXML(virStoragePoolPtr obj,
|
|||||||
goto cleanup;
|
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
|
/* Wipe any key the user may have suggested, as volume creation
|
||||||
* will generate the canonical key. */
|
* will generate the canonical key. */
|
||||||
VIR_FREE(voldef->key);
|
VIR_FREE(voldef->key);
|
||||||
@ -1883,10 +1873,8 @@ storageVolCreateXML(virStoragePoolPtr obj,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Update pool metadata */
|
/* Update pool metadata */
|
||||||
if (orig_pool_allocation == pool->def->allocation)
|
pool->def->allocation += buildvoldef->target.allocation;
|
||||||
pool->def->allocation += buildvoldef->target.allocation;
|
pool->def->available -= buildvoldef->target.allocation;
|
||||||
if (orig_pool_available == pool->def->available)
|
|
||||||
pool->def->available -= buildvoldef->target.allocation;
|
|
||||||
|
|
||||||
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
||||||
volobj->name, pool->def->name);
|
volobj->name, pool->def->name);
|
||||||
@ -1914,7 +1902,6 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
virStorageVolDefPtr origvol = NULL, newvol = NULL;
|
virStorageVolDefPtr origvol = NULL, newvol = NULL;
|
||||||
virStorageVolPtr ret = NULL, volobj = NULL;
|
virStorageVolPtr ret = NULL, volobj = NULL;
|
||||||
unsigned long long allocation;
|
unsigned long long allocation;
|
||||||
unsigned long long orig_pool_available, orig_pool_allocation;
|
|
||||||
int buildret;
|
int buildret;
|
||||||
|
|
||||||
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA |
|
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA |
|
||||||
@ -2017,9 +2004,6 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
pool->volumes.count+1) < 0)
|
pool->volumes.count+1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
orig_pool_available = pool->def->available;
|
|
||||||
orig_pool_allocation = pool->def->allocation;
|
|
||||||
|
|
||||||
/* 'Define' the new volume so we get async progress reporting.
|
/* 'Define' the new volume so we get async progress reporting.
|
||||||
* Wipe any key the user may have suggested, as volume creation
|
* Wipe any key the user may have suggested, as volume creation
|
||||||
* will generate the canonical key. */
|
* will generate the canonical key. */
|
||||||
@ -2073,10 +2057,8 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
newvol = NULL;
|
newvol = NULL;
|
||||||
|
|
||||||
/* Updating pool metadata */
|
/* Updating pool metadata */
|
||||||
if (orig_pool_allocation == pool->def->allocation)
|
pool->def->allocation += allocation;
|
||||||
pool->def->allocation += allocation;
|
pool->def->available -= allocation;
|
||||||
if (orig_pool_available == pool->def->available)
|
|
||||||
pool->def->available -= allocation;
|
|
||||||
|
|
||||||
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
||||||
volobj->name, pool->def->name);
|
volobj->name, pool->def->name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user