[PATCH 1/5] storage: Clean up stateFile if refreshPool fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the virStoragePoolRefresh fails and we call stopPool, the
code neglected to clean up the state file leading to the next
libvirtd restart attempting to start the pool. For a transient
pool this could make it unexpectedly reappear.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/storage/storage_driver.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 8943df1f84..1dbeb213e3 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1174,8 +1174,13 @@ storagePoolRefresh(virStoragePoolPtr pool,
 
     virStoragePoolObjClearVols(obj);
     if (backend->refreshPool(obj) < 0) {
+        char *stateFile = virFileBuildPath(driver->stateDir, def->name, ".xml");
+
+        if (stateFile)
+            unlink(stateFile);
         if (backend->stopPool)
             backend->stopPool(obj);
+        VIR_FREE(stateFile);
 
         event = virStoragePoolEventLifecycleNew(def->name,
                                                 def->uuid,
-- 
2.17.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux