goto cleanup;
}
+ if (VIR_REALLOC_N(pool->volumes.objs,
+ pool->volumes.count+1) < 0)
+ goto cleanup;
if (!backend->createVol) {
virReportError(VIR_ERR_NO_SUPPORT,
if (backend->createVol(obj->conn, pool, voldef) < 0)
goto cleanup;
+ pool->volumes.objs[pool->volumes.count++] = voldef;
+ volobj = virGetStorageVol(obj->conn, pool->def->name, voldef->name,
+ voldef->key, NULL, NULL);
+ if (!volobj) {
+ pool->volumes.count--;
+ goto cleanup;
+ }
+
if (VIR_ALLOC(buildvoldef) < 0) {
voldef = NULL;
goto cleanup;
voldef->building = false;
pool->asyncjobs--;
- if (buildret < 0)
+ if (buildret < 0) {
+ VIR_FREE(buildvoldef);
+ storageVolDeleteInternal(volobj, backend, pool, voldef,
+ 0, false);
+ voldef = NULL;
goto cleanup;
- }
-
- if (VIR_REALLOC_N(pool->volumes.objs,
- pool->volumes.count+1) < 0)
- goto cleanup;
+ }
- pool->volumes.objs[pool->volumes.count++] = voldef;
- if (!(volobj = virGetStorageVol(obj->conn, pool->def->name, voldef->name,
- voldef->key, NULL, NULL)))
- goto cleanup;
+ }
if (backend->refreshVol &&
backend->refreshVol(obj->conn, pool, voldef) < 0)