mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-04 20:15:19 +00:00
storage: lvm: Don't overwrite lvcreate errors
Before:
$ sudo virsh vol-create-as --pool vgvirt sparsetest --capacity 16M --allocation 0
error: Failed to create vol sparsetest
error: internal error Child process (/usr/sbin/lvchange -aln vgvirt/sparsetest) unexpected exit status 5: One or more specified logical volume(s) not found.
After:
$ sudo virsh vol-create-as --pool vgvirt sparsetest --capacity 16M --allocation 0
error: Failed to create vol sparsetest
error: internal error Child process (/usr/sbin/lvcreate --name sparsetest -L 0K --virtualsize 16384K vgvirt) unexpected exit status 5: Unable to create new logical volume with no extents
(cherry picked from commit 01df6f2bff
)
Conflicts:
src/storage/storage_backend_logical.c
This commit is contained in:
parent
d325704a3f
commit
dd2f524c6b
@ -679,6 +679,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
|
|||||||
"-s", vol->backingStore.path, NULL
|
"-s", vol->backingStore.path, NULL
|
||||||
};
|
};
|
||||||
const char **cmdargv = cmdargvnew;
|
const char **cmdargv = cmdargvnew;
|
||||||
|
virErrorPtr err;
|
||||||
|
|
||||||
if (vol->target.encryption != NULL) {
|
if (vol->target.encryption != NULL) {
|
||||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
@ -750,8 +751,10 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
err = virSaveLastError();
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
virStorageBackendLogicalDeleteVol(conn, pool, vol, 0);
|
virStorageBackendLogicalDeleteVol(conn, pool, vol, 0);
|
||||||
|
virSetError(err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user