mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
storage: Clean up storagePoolUpdateStateCallback processing
Alter the code path to remove the need to to go cleanup and thus remove the label completely. Signed-off-by: John Ferlan <jferlan@redhat.com> ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
49c322145b
commit
4a7abc67d5
@ -108,15 +108,15 @@ storagePoolUpdateStateCallback(virStoragePoolObjPtr obj,
|
|||||||
virStorageBackendPtr backend;
|
virStorageBackendPtr backend;
|
||||||
char *stateFile;
|
char *stateFile;
|
||||||
|
|
||||||
if (!(stateFile = virFileBuildPath(driver->stateDir, def->name, ".xml")))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if ((backend = virStorageBackendForType(def->type)) == NULL) {
|
if ((backend = virStorageBackendForType(def->type)) == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Missing backend %d"), def->type);
|
_("Missing backend %d"), def->type);
|
||||||
goto cleanup;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(stateFile = virFileBuildPath(driver->stateDir, def->name, ".xml")))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Backends which do not support 'checkPool' are considered
|
/* Backends which do not support 'checkPool' are considered
|
||||||
* inactive by default. */
|
* inactive by default. */
|
||||||
if (backend->checkPool &&
|
if (backend->checkPool &&
|
||||||
@ -148,8 +148,7 @@ storagePoolUpdateStateCallback(virStoragePoolObjPtr obj,
|
|||||||
if (!virStoragePoolObjIsActive(obj))
|
if (!virStoragePoolObjIsActive(obj))
|
||||||
virStoragePoolUpdateInactive(&obj);
|
virStoragePoolUpdateInactive(&obj);
|
||||||
|
|
||||||
cleanup:
|
if (!active)
|
||||||
if (!active && stateFile)
|
|
||||||
ignore_value(unlink(stateFile));
|
ignore_value(unlink(stateFile));
|
||||||
VIR_FREE(stateFile);
|
VIR_FREE(stateFile);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user