]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Save error during refresh failure processing
authorJohn Ferlan <jferlan@redhat.com>
Wed, 12 Sep 2018 15:25:37 +0000 (11:25 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 20 Sep 2018 11:49:49 +0000 (07:49 -0400)
https://bugzilla.redhat.com/show_bug.cgi?id=1614283

Save the error from the refresh failure because the stopPool
processing may overwrite the error or even worse clear it
due to calling an external libvirt API that resets the last
error such as is the case with the SCSI pool which may call
virGetConnectNodeDev (see commit decaeb288) in order to
process deleting an NPIV vport.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
src/storage/storage_driver.c

index 5e483269b131bc1a94582e38c38fdf2c86625533..bf43d77c8bf8858a016d6e7db802c8683b2077ca 100644 (file)
@@ -81,10 +81,16 @@ storagePoolRefreshFailCleanup(virStorageBackendPtr backend,
                               virStoragePoolObjPtr obj,
                               const char *stateFile)
 {
+    virErrorPtr orig_err = virSaveLastError();
+
     if (stateFile)
         ignore_value(unlink(stateFile));
     if (backend->stopPool)
         backend->stopPool(obj);
+    if (orig_err) {
+        virSetError(orig_err);
+        virFreeError(orig_err);
+    }
 }