From: John Ferlan Date: Wed, 12 Sep 2018 12:29:32 +0000 (-0400) Subject: storage: Clean up stateFile if refreshPool fails X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=49c322145b1096652b08b6e6bbd53e68f7ceab21;p=libvirt.git storage: Clean up stateFile if refreshPool fails 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 ACKed-by: Michal Privoznik --- diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index e0023cf035..301a9d7292 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1171,8 +1171,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,