]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: lvm: Don't overwrite lvcreate errors
authorCole Robinson <crobinso@redhat.com>
Wed, 17 Oct 2012 00:25:41 +0000 (20:25 -0400)
committerCole Robinson <crobinso@redhat.com>
Sat, 27 Oct 2012 19:25:12 +0000 (15:25 -0400)
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 01df6f2bff98d8fc68350ab90c212780ef9db67a)

Conflicts:
src/storage/storage_backend_logical.c

src/storage/storage_backend_logical.c

index 9a91dd9a74475e2b0d757e8e81f3d632f525f580..302c3dd7cb78be936af579af89def01d6ed834a3 100644 (file)
@@ -679,6 +679,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
         "-s", vol->backingStore.path, NULL
     };
     const char **cmdargv = cmdargvnew;
+    virErrorPtr err;
 
     if (vol->target.encryption != NULL) {
         virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -750,8 +751,10 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
     return 0;
 
  cleanup:
+    err = virSaveLastError();
     VIR_FORCE_CLOSE(fd);
     virStorageBackendLogicalDeleteVol(conn, pool, vol, 0);
+    virSetError(err);
     return -1;
 }