mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
Don't overwrite errors in qemuTranslateDiskSourcePool
Both virStoragePoolFree and virStorageVolFree reset the last error, which might lead to the cryptic message: An error occurred, but the cause is unknown When the volume wasn't found, virStorageVolFree was called with NULL, leading to an error: invalid storage volume pointer in virStorageVolFree This patch changes it to: Storage volume not found: no storage vol with matching name 'tomato'
This commit is contained in:
parent
3068244e85
commit
926055474d
@ -1248,6 +1248,7 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
|
|||||||
char *poolxml = NULL;
|
char *poolxml = NULL;
|
||||||
virStorageVolInfo info;
|
virStorageVolInfo info;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
virErrorPtr savedError = NULL;
|
||||||
|
|
||||||
if (def->type != VIR_DOMAIN_DISK_TYPE_VOLUME)
|
if (def->type != VIR_DOMAIN_DISK_TYPE_VOLUME)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1324,8 +1325,17 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
|
|||||||
def->srcpool->voltype = info.type;
|
def->srcpool->voltype = info.type;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virStoragePoolFree(pool);
|
if (ret < 0)
|
||||||
virStorageVolFree(vol);
|
savedError = virSaveLastError();
|
||||||
|
if (pool)
|
||||||
|
virStoragePoolFree(pool);
|
||||||
|
if (vol)
|
||||||
|
virStorageVolFree(vol);
|
||||||
|
if (savedError) {
|
||||||
|
virSetError(savedError);
|
||||||
|
virFreeError(savedError);
|
||||||
|
}
|
||||||
|
|
||||||
VIR_FREE(poolxml);
|
VIR_FREE(poolxml);
|
||||||
virStoragePoolDefFree(pooldef);
|
virStoragePoolDefFree(pooldef);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user