If pool refresh failed, then the internal table of volumes is
probably left in inconsistent or incomplete state anyways. Clear
it out then. This has an advantage that we can move the
virStoragePoolObjClearVols() from those very few backends that
do call it.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
if (dir)
glfs_closedir(dir);
virStorageBackendGlusterClose(state);
- if (ret < 0)
- virStoragePoolObjClearVols(pool);
return ret;
}
2
};
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
- int ret = -1;
VIR_AUTOPTR(virCommand) cmd = NULL;
virWaitForDevices();
/* Get list of all logical volumes */
if (virStorageBackendLogicalFindLVs(pool, NULL) < 0)
- goto cleanup;
+ return -1;
cmd = virCommandNewArgList(VGS,
"--separator", ":",
pool,
"vgs",
NULL) < 0)
- goto cleanup;
-
- ret = 0;
+ return -1;
- cleanup:
- if (ret < 0)
- virStoragePoolObjClearVols(pool);
- return ret;
+ return 0;
}
/*
goto cleanup;
}
- if (virStoragePoolObjAddVol(pool, vol) < 0) {
- virStoragePoolObjClearVols(pool);
+ if (virStoragePoolObjAddVol(pool, vol) < 0)
goto cleanup;
- }
vol = NULL;
}
{
virErrorPtr orig_err = virSaveLastError();
+ virStoragePoolObjClearVols(obj);
+
if (stateFile)
unlink(stateFile);
if (backend->stopPool)
ret = 0;
cleanup:
VIR_DIR_CLOSE(dir);
- if (ret < 0)
- virStoragePoolObjClearVols(pool);
return ret;
}