aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2012-10-16 20:25:41 -0400
committerDoug Goldstein <cardoe@cardoe.com>2012-10-16 22:55:41 -0500
commit9daab54cb0ee40b2a3e578de0655a0dc8b5c5291 (patch)
treebe418dbee94dd8b4c9820587c1db21a1b9afc037
parentFix potential deadlock when agent is closed (diff)
downloadlibvirt-9daab54cb0ee40b2a3e578de0655a0dc8b5c5291.tar.gz
libvirt-9daab54cb0ee40b2a3e578de0655a0dc8b5c5291.tar.bz2
libvirt-9daab54cb0ee40b2a3e578de0655a0dc8b5c5291.zip
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
-rw-r--r--src/storage/storage_backend_logical.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index a9d785ccb..eebeec1ba 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -699,6 +699,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
{
int fdret, fd = -1;
virCommandPtr cmd = NULL;
+ virErrorPtr err;
if (vol->target.encryption != NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -775,9 +776,11 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
return 0;
cleanup:
+ err = virSaveLastError();
VIR_FORCE_CLOSE(fd);
virStorageBackendLogicalDeleteVol(conn, pool, vol, 0);
virCommandFree(cmd);
+ virSetError(err);
return -1;
}