parallels_network: Drop parallelsDriverLock() from everywhere.

While in previous commits there were some places that relied on
the big lock, in this file there's no such place and the big
driver lock can be dropped completely. Yay!

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2015-02-26 14:36:47 +01:00
parent b464fd7ed9
commit baf8cf9c80

View File

@ -349,9 +349,7 @@ int parallelsNetworkClose(virConnectPtr conn)
if (!privconn) if (!privconn)
return 0; return 0;
parallelsDriverLock(privconn);
virObjectUnref(privconn->networks); virObjectUnref(privconn->networks);
parallelsDriverUnlock(privconn);
return 0; return 0;
} }
@ -360,11 +358,8 @@ static int parallelsConnectNumOfNetworks(virConnectPtr conn)
int nactive; int nactive;
parallelsConnPtr privconn = conn->privateData; parallelsConnPtr privconn = conn->privateData;
parallelsDriverLock(privconn);
nactive = virNetworkObjListNumOfNetworks(privconn->networks, nactive = virNetworkObjListNumOfNetworks(privconn->networks,
true, NULL, conn); true, NULL, conn);
parallelsDriverUnlock(privconn);
return nactive; return nactive;
} }
@ -375,11 +370,8 @@ static int parallelsConnectListNetworks(virConnectPtr conn,
parallelsConnPtr privconn = conn->privateData; parallelsConnPtr privconn = conn->privateData;
int got; int got;
parallelsDriverLock(privconn);
got = virNetworkObjListGetNames(privconn->networks, got = virNetworkObjListGetNames(privconn->networks,
true, names, nnames, NULL, conn); true, names, nnames, NULL, conn);
parallelsDriverUnlock(privconn);
return got; return got;
} }
@ -388,11 +380,8 @@ static int parallelsConnectNumOfDefinedNetworks(virConnectPtr conn)
int ninactive; int ninactive;
parallelsConnPtr privconn = conn->privateData; parallelsConnPtr privconn = conn->privateData;
parallelsDriverLock(privconn);
ninactive = virNetworkObjListNumOfNetworks(privconn->networks, ninactive = virNetworkObjListNumOfNetworks(privconn->networks,
false, NULL, conn); false, NULL, conn);
parallelsDriverUnlock(privconn);
return ninactive; return ninactive;
} }
@ -403,10 +392,8 @@ static int parallelsConnectListDefinedNetworks(virConnectPtr conn,
parallelsConnPtr privconn = conn->privateData; parallelsConnPtr privconn = conn->privateData;
int got; int got;
parallelsDriverLock(privconn);
got = virNetworkObjListGetNames(privconn->networks, got = virNetworkObjListGetNames(privconn->networks,
false, names, nnames, NULL, conn); false, names, nnames, NULL, conn);
parallelsDriverUnlock(privconn);
return got; return got;
} }
@ -415,15 +402,10 @@ static int parallelsConnectListAllNetworks(virConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
parallelsConnPtr privconn = conn->privateData; parallelsConnPtr privconn = conn->privateData;
int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1); virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1);
parallelsDriverLock(privconn); return virNetworkObjListExport(conn, privconn->networks, nets, NULL, flags);
ret = virNetworkObjListExport(conn, privconn->networks, nets, NULL, flags);
parallelsDriverUnlock(privconn);
return ret;
} }
static virNetworkPtr parallelsNetworkLookupByUUID(virConnectPtr conn, static virNetworkPtr parallelsNetworkLookupByUUID(virConnectPtr conn,
@ -433,9 +415,7 @@ static virNetworkPtr parallelsNetworkLookupByUUID(virConnectPtr conn,
virNetworkObjPtr network; virNetworkObjPtr network;
virNetworkPtr ret = NULL; virNetworkPtr ret = NULL;
parallelsDriverLock(privconn);
network = virNetworkObjFindByUUID(privconn->networks, uuid); network = virNetworkObjFindByUUID(privconn->networks, uuid);
parallelsDriverUnlock(privconn);
if (!network) { if (!network) {
virReportError(VIR_ERR_NO_NETWORK, virReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching uuid")); "%s", _("no network with matching uuid"));
@ -456,9 +436,7 @@ static virNetworkPtr parallelsNetworkLookupByName(virConnectPtr conn,
virNetworkObjPtr network; virNetworkObjPtr network;
virNetworkPtr ret = NULL; virNetworkPtr ret = NULL;
parallelsDriverLock(privconn);
network = virNetworkObjFindByName(privconn->networks, name); network = virNetworkObjFindByName(privconn->networks, name);
parallelsDriverUnlock(privconn);
if (!network) { if (!network) {
virReportError(VIR_ERR_NO_NETWORK, virReportError(VIR_ERR_NO_NETWORK,
_("no network with matching name '%s'"), name); _("no network with matching name '%s'"), name);
@ -481,10 +459,7 @@ static char *parallelsNetworkGetXMLDesc(virNetworkPtr net,
virCheckFlags(VIR_NETWORK_XML_INACTIVE, NULL); virCheckFlags(VIR_NETWORK_XML_INACTIVE, NULL);
parallelsDriverLock(privconn);
network = virNetworkObjFindByUUID(privconn->networks, net->uuid); network = virNetworkObjFindByUUID(privconn->networks, net->uuid);
parallelsDriverUnlock(privconn);
if (!network) { if (!network) {
virReportError(VIR_ERR_NO_NETWORK, virReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching uuid")); "%s", _("no network with matching uuid"));
@ -504,9 +479,7 @@ static int parallelsNetworkIsActive(virNetworkPtr net)
virNetworkObjPtr obj; virNetworkObjPtr obj;
int ret = -1; int ret = -1;
parallelsDriverLock(privconn);
obj = virNetworkObjFindByUUID(privconn->networks, net->uuid); obj = virNetworkObjFindByUUID(privconn->networks, net->uuid);
parallelsDriverUnlock(privconn);
if (!obj) { if (!obj) {
virReportError(VIR_ERR_NO_NETWORK, NULL); virReportError(VIR_ERR_NO_NETWORK, NULL);
goto cleanup; goto cleanup;
@ -524,9 +497,7 @@ static int parallelsNetworkIsPersistent(virNetworkPtr net)
virNetworkObjPtr obj; virNetworkObjPtr obj;
int ret = -1; int ret = -1;
parallelsDriverLock(privconn);
obj = virNetworkObjFindByUUID(privconn->networks, net->uuid); obj = virNetworkObjFindByUUID(privconn->networks, net->uuid);
parallelsDriverUnlock(privconn);
if (!obj) { if (!obj) {
virReportError(VIR_ERR_NO_NETWORK, NULL); virReportError(VIR_ERR_NO_NETWORK, NULL);
goto cleanup; goto cleanup;
@ -545,9 +516,7 @@ static int parallelsNetworkGetAutostart(virNetworkPtr net,
virNetworkObjPtr network; virNetworkObjPtr network;
int ret = -1; int ret = -1;
parallelsDriverLock(privconn);
network = virNetworkObjFindByUUID(privconn->networks, net->uuid); network = virNetworkObjFindByUUID(privconn->networks, net->uuid);
parallelsDriverUnlock(privconn);
if (!network) { if (!network) {
virReportError(VIR_ERR_NO_NETWORK, virReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching uuid")); "%s", _("no network with matching uuid"));