提交 5e54361c 编写于 作者: J John Ferlan

storage: Need to clear pool prior to calling the refreshPool

Prior to calling the 'refreshPool' during CreatePool or UploadPool
operations, we need to clear the pool; otherwise, the pool will
have duplicated entries.
上级 2c52ec43
...@@ -727,6 +727,7 @@ storagePoolCreateXML(virConnectPtr conn, ...@@ -727,6 +727,7 @@ storagePoolCreateXML(virConnectPtr conn,
stateFile = virFileBuildPath(driver->stateDir, stateFile = virFileBuildPath(driver->stateDir,
pool->def->name, ".xml"); pool->def->name, ".xml");
virStoragePoolObjClearVols(pool);
if (!stateFile || virStoragePoolSaveState(stateFile, pool->def) < 0 || if (!stateFile || virStoragePoolSaveState(stateFile, pool->def) < 0 ||
backend->refreshPool(conn, pool) < 0) { backend->refreshPool(conn, pool) < 0) {
if (stateFile) if (stateFile)
...@@ -918,6 +919,7 @@ storagePoolCreate(virStoragePoolPtr obj, ...@@ -918,6 +919,7 @@ storagePoolCreate(virStoragePoolPtr obj,
stateFile = virFileBuildPath(driver->stateDir, stateFile = virFileBuildPath(driver->stateDir,
pool->def->name, ".xml"); pool->def->name, ".xml");
virStoragePoolObjClearVols(pool);
if (!stateFile || virStoragePoolSaveState(stateFile, pool->def) < 0 || if (!stateFile || virStoragePoolSaveState(stateFile, pool->def) < 0 ||
backend->refreshPool(obj->conn, pool) < 0) { backend->refreshPool(obj->conn, pool) < 0) {
if (stateFile) if (stateFile)
...@@ -2363,6 +2365,7 @@ storageVolUpload(virStorageVolPtr obj, ...@@ -2363,6 +2365,7 @@ storageVolUpload(virStorageVolPtr obj,
* interaction and we can just lookup the backend in the callback * interaction and we can just lookup the backend in the callback
* routine in order to call the refresh API. * routine in order to call the refresh API.
*/ */
virStoragePoolObjClearVols(pool);
if (backend->refreshPool) { if (backend->refreshPool) {
if (VIR_ALLOC(cbdata) < 0 || if (VIR_ALLOC(cbdata) < 0 ||
VIR_STRDUP(cbdata->pool_name, pool->def->name) < 0) VIR_STRDUP(cbdata->pool_name, pool->def->name) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册