Remove unnecessary curly brackets in src/test/test_driver.c

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-11-13 15:24:39 +01:00
parent e7a1da8aeb
commit c651e08c94

View File

@ -960,9 +960,8 @@ testParseNodeInfo(virNodeInfoPtr nodeInfo, xmlXPathContextPtr ctxt)
nodeInfo->sockets * nodeInfo->nodes); nodeInfo->sockets * nodeInfo->nodes);
ret = virXPathLong("string(/node/cpu/active[1])", ctxt, &l); ret = virXPathLong("string(/node/cpu/active[1])", ctxt, &l);
if (ret == 0) { if (ret == 0) {
if (l < nodeInfo->cpus) { if (l < nodeInfo->cpus)
nodeInfo->cpus = l; nodeInfo->cpus = l;
}
} else if (ret == -2) { } else if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
_("invalid node cpu active value")); _("invalid node cpu active value"));
@ -1070,9 +1069,8 @@ testParseDomains(testConnPtr privconn,
virDomainObjPtr obj; virDomainObjPtr obj;
num = virXPathNodeSet("/node/domain", ctxt, &nodes); num = virXPathNodeSet("/node/domain", ctxt, &nodes);
if (num < 0) { if (num < 0)
goto error; goto error;
}
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
virDomainDefPtr def; virDomainDefPtr def;
@ -1137,9 +1135,8 @@ testParseNetworks(testConnPtr privconn,
virNetworkObjPtr obj; virNetworkObjPtr obj;
num = virXPathNodeSet("/node/network", ctxt, &nodes); num = virXPathNodeSet("/node/network", ctxt, &nodes);
if (num < 0) { if (num < 0)
goto error; goto error;
}
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
virNetworkDefPtr def; virNetworkDefPtr def;
@ -1177,9 +1174,8 @@ testParseInterfaces(testConnPtr privconn,
virInterfaceObjPtr obj; virInterfaceObjPtr obj;
num = virXPathNodeSet("/node/interface", ctxt, &nodes); num = virXPathNodeSet("/node/interface", ctxt, &nodes);
if (num < 0) { if (num < 0)
goto error; goto error;
}
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
virInterfaceDefPtr def; virInterfaceDefPtr def;
@ -1225,9 +1221,8 @@ testOpenVolumesForPool(const char *file,
num = virXPathNodeSet(vol_xpath, ctxt, &nodes); num = virXPathNodeSet(vol_xpath, ctxt, &nodes);
VIR_FREE(vol_xpath); VIR_FREE(vol_xpath);
if (num < 0) { if (num < 0)
goto error; goto error;
}
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
xmlNodePtr node = testParseXMLDocFromFile(nodes[i], file, xmlNodePtr node = testParseXMLDocFromFile(nodes[i], file,
@ -1275,9 +1270,8 @@ testParseStorage(testConnPtr privconn,
virStoragePoolObjPtr obj; virStoragePoolObjPtr obj;
num = virXPathNodeSet("/node/pool", ctxt, &nodes); num = virXPathNodeSet("/node/pool", ctxt, &nodes);
if (num < 0) { if (num < 0)
goto error; goto error;
}
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
virStoragePoolDefPtr def; virStoragePoolDefPtr def;
@ -1328,9 +1322,8 @@ testParseNodedevs(testConnPtr privconn,
virNodeDeviceObjPtr obj; virNodeDeviceObjPtr obj;
num = virXPathNodeSet("/node/device", ctxt, &nodes); num = virXPathNodeSet("/node/device", ctxt, &nodes);
if (num < 0) { if (num < 0)
goto error; goto error;
}
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
virNodeDeviceDefPtr def; virNodeDeviceDefPtr def;
@ -1430,9 +1423,8 @@ testOpenFromFile(virConnectPtr conn, const char *file)
if (!(privconn->eventState = virObjectEventStateNew())) if (!(privconn->eventState = virObjectEventStateNew()))
goto error; goto error;
if (!(doc = virXMLParseFileCtxt(file, &ctxt))) { if (!(doc = virXMLParseFileCtxt(file, &ctxt)))
goto error; goto error;
}
if (!xmlStrEqual(ctxt->node->name, BAD_CAST "node")) { if (!xmlStrEqual(ctxt->node->name, BAD_CAST "node")) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
@ -2713,9 +2705,8 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
case VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG: case VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG:
ret = testDomainUpdateVCPUs(privconn, privdom, nrCpus, 0); ret = testDomainUpdateVCPUs(privconn, privdom, nrCpus, 0);
if (ret == 0) { if (ret == 0)
persistentDef->vcpus = nrCpus; persistentDef->vcpus = nrCpus;
}
break; break;
} }
@ -2806,9 +2797,8 @@ static int testDomainGetVcpus(virDomainPtr domain,
unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v); unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v);
for (i = 0; i < maxcpu; i++) { for (i = 0; i < maxcpu; i++) {
if (VIR_CPU_USABLE(privdomdata->cpumaps, privmaplen, v, i)) { if (VIR_CPU_USABLE(privdomdata->cpumaps, privmaplen, v, i))
VIR_USE_CPU(cpumap, i); VIR_USE_CPU(cpumap, i);
}
} }
} }
} }
@ -2866,9 +2856,8 @@ static int testDomainPinVcpu(virDomainPtr domain,
memset(privcpumap, 0, privmaplen); memset(privcpumap, 0, privmaplen);
for (i = 0; i < maxcpu; i++) { for (i = 0; i < maxcpu; i++) {
if (VIR_CPU_USABLE(cpumap, maplen, 0, i)) { if (VIR_CPU_USABLE(cpumap, maplen, 0, i))
VIR_USE_CPU(privcpumap, i); VIR_USE_CPU(privcpumap, i);
}
} }
ret = 0; ret = 0;
@ -4064,9 +4053,8 @@ static int testConnectNumOfInterfaces(virConnectPtr conn)
testDriverLock(privconn); testDriverLock(privconn);
for (i = 0; (i < privconn->ifaces.count); i++) { for (i = 0; (i < privconn->ifaces.count); i++) {
virInterfaceObjLock(privconn->ifaces.objs[i]); virInterfaceObjLock(privconn->ifaces.objs[i]);
if (virInterfaceObjIsActive(privconn->ifaces.objs[i])) { if (virInterfaceObjIsActive(privconn->ifaces.objs[i]))
count++; count++;
}
virInterfaceObjUnlock(privconn->ifaces.objs[i]); virInterfaceObjUnlock(privconn->ifaces.objs[i]);
} }
testDriverUnlock(privconn); testDriverUnlock(privconn);
@ -4111,9 +4099,8 @@ static int testConnectNumOfDefinedInterfaces(virConnectPtr conn)
testDriverLock(privconn); testDriverLock(privconn);
for (i = 0; i < privconn->ifaces.count; i++) { for (i = 0; i < privconn->ifaces.count; i++) {
virInterfaceObjLock(privconn->ifaces.objs[i]); virInterfaceObjLock(privconn->ifaces.objs[i]);
if (!virInterfaceObjIsActive(privconn->ifaces.objs[i])) { if (!virInterfaceObjIsActive(privconn->ifaces.objs[i]))
count++; count++;
}
virInterfaceObjUnlock(privconn->ifaces.objs[i]); virInterfaceObjUnlock(privconn->ifaces.objs[i]);
} }
testDriverUnlock(privconn); testDriverUnlock(privconn);
@ -6058,14 +6045,12 @@ testNodeDeviceCreateXML(virConnectPtr conn,
testDriverLock(driver); testDriverLock(driver);
def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, NULL); def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, NULL);
if (def == NULL) { if (def == NULL)
goto cleanup; goto cleanup;
}
/* We run these next two simply for validation */ /* We run these next two simply for validation */
if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1) { if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
goto cleanup; goto cleanup;
}
if (virNodeDeviceGetParentHost(&driver->devs, if (virNodeDeviceGetParentHost(&driver->devs,
def->name, def->name,
@ -6093,9 +6078,8 @@ testNodeDeviceCreateXML(virConnectPtr conn,
} }
if (!(obj = virNodeDeviceAssignDef(&driver->devs, def))) { if (!(obj = virNodeDeviceAssignDef(&driver->devs, def)))
goto cleanup; goto cleanup;
}
virNodeDeviceObjUnlock(obj); virNodeDeviceObjUnlock(obj);
dev = virGetNodeDevice(conn, def->name); dev = virGetNodeDevice(conn, def->name);
@ -6126,9 +6110,8 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
goto out; goto out;
} }
if (virNodeDeviceGetWWNs(obj->def, &wwnn, &wwpn) == -1) { if (virNodeDeviceGetWWNs(obj->def, &wwnn, &wwpn) == -1)
goto out; goto out;
}
if (VIR_STRDUP(parent_name, obj->def->parent) < 0) if (VIR_STRDUP(parent_name, obj->def->parent) < 0)
goto out; goto out;
@ -7033,9 +7016,8 @@ testDomainSnapshotReparentChildren(void *payload,
virDomainSnapshotObjPtr snap = payload; virDomainSnapshotObjPtr snap = payload;
testSnapReparentDataPtr rep = data; testSnapReparentDataPtr rep = data;
if (rep->err < 0) { if (rep->err < 0)
return; return;
}
VIR_FREE(snap->def->parent); VIR_FREE(snap->def->parent);
snap->parent = rep->parent; snap->parent = rep->parent;
@ -7077,9 +7059,8 @@ testDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
testDomainSnapshotDiscardAll, testDomainSnapshotDiscardAll,
&rem); &rem);
if (rem.current) { if (rem.current) {
if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) { if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)
snap->def->current = true; snap->def->current = true;
}
vm->current_snapshot = snap; vm->current_snapshot = snap;
} }
} else if (snap->nchildren) { } else if (snap->nchildren) {