1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

test: Rename @vol to @volDef in testOpenVolumesForPool

Make it more obvious as we're about to need to change how
obj->def gets referenced.

Perform a couple of minor cleanups along the way too.
This commit is contained in:
John Ferlan 2017-07-26 13:33:30 -04:00
parent bfcd8fc924
commit 3a867d9e52

View File

@ -1041,7 +1041,7 @@ testOpenVolumesForPool(const char *file,
size_t i;
int num, ret = -1;
xmlNodePtr *nodes = NULL;
virStorageVolDefPtr def = NULL;
virStorageVolDefPtr volDef = NULL;
/* Find storage volumes */
if (virAsprintf(&vol_xpath, "/node/pool[%d]/volume", objidx) < 0)
@ -1058,30 +1058,29 @@ testOpenVolumesForPool(const char *file,
if (!node)
goto error;
def = virStorageVolDefParseNode(obj->def, ctxt->doc, node, 0);
if (!def)
if (!(volDef = virStorageVolDefParseNode(obj->def, ctxt->doc, node, 0)))
goto error;
if (def->target.path == NULL) {
if (virAsprintf(&def->target.path, "%s/%s",
obj->def->target.path, def->name) < 0)
if (!volDef->target.path) {
if (virAsprintf(&volDef->target.path, "%s/%s",
obj->def->target.path, volDef->name) < 0)
goto error;
}
if (!def->key && VIR_STRDUP(def->key, def->target.path) < 0)
if (!volDef->key && VIR_STRDUP(volDef->key, volDef->target.path) < 0)
goto error;
if (virStoragePoolObjAddVol(obj, def) < 0)
if (virStoragePoolObjAddVol(obj, volDef) < 0)
goto error;
obj->def->allocation += def->target.allocation;
obj->def->allocation += volDef->target.allocation;
obj->def->available = (obj->def->capacity - obj->def->allocation);
def = NULL;
volDef = NULL;
}
ret = 0;
error:
virStorageVolDefFree(def);
virStorageVolDefFree(volDef);
VIR_FREE(nodes);
return ret;
}