mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Create a shallow copy for volume building only if supported
Since the previous commit, the shallow copy is only used inside the if (backend->buildVol) if.
This commit is contained in:
parent
56a4e9cb61
commit
1b5685dada
@ -1766,7 +1766,6 @@ storageVolCreateXML(virStoragePoolPtr obj,
|
|||||||
virStorageBackendPtr backend;
|
virStorageBackendPtr backend;
|
||||||
virStorageVolDefPtr voldef = NULL;
|
virStorageVolDefPtr voldef = NULL;
|
||||||
virStorageVolPtr ret = NULL, volobj = NULL;
|
virStorageVolPtr ret = NULL, volobj = NULL;
|
||||||
virStorageVolDefPtr buildvoldef = NULL;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
|
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
|
||||||
|
|
||||||
@ -1828,19 +1827,21 @@ storageVolCreateXML(virStoragePoolPtr obj,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(buildvoldef) < 0) {
|
|
||||||
voldef = NULL;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make a shallow copy of the 'defined' volume definition, since the
|
|
||||||
* original allocation value will change as the user polls 'info',
|
|
||||||
* but we only need the initial requested values
|
|
||||||
*/
|
|
||||||
memcpy(buildvoldef, voldef, sizeof(*voldef));
|
|
||||||
|
|
||||||
if (backend->buildVol) {
|
if (backend->buildVol) {
|
||||||
int buildret;
|
int buildret;
|
||||||
|
virStorageVolDefPtr buildvoldef = NULL;
|
||||||
|
|
||||||
|
if (VIR_ALLOC(buildvoldef) < 0) {
|
||||||
|
voldef = NULL;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make a shallow copy of the 'defined' volume definition, since the
|
||||||
|
* original allocation value will change as the user polls 'info',
|
||||||
|
* but we only need the initial requested values
|
||||||
|
*/
|
||||||
|
memcpy(buildvoldef, voldef, sizeof(*voldef));
|
||||||
|
|
||||||
/* Drop the pool lock during volume allocation */
|
/* Drop the pool lock during volume allocation */
|
||||||
pool->asyncjobs++;
|
pool->asyncjobs++;
|
||||||
@ -1891,7 +1892,6 @@ storageVolCreateXML(virStoragePoolPtr obj,
|
|||||||
cleanup:
|
cleanup:
|
||||||
virObjectUnref(volobj);
|
virObjectUnref(volobj);
|
||||||
virStorageVolDefFree(voldef);
|
virStorageVolDefFree(voldef);
|
||||||
VIR_FREE(buildvoldef);
|
|
||||||
if (pool)
|
if (pool)
|
||||||
virStoragePoolObjUnlock(pool);
|
virStoragePoolObjUnlock(pool);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user