So far it's just a structure which happens to have 'Obj' in its
name, but otherwise it not related to virObject at all. No
reference counting, not virObjectLock(), nothing.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
cfg.mk | 2 -
src/conf/network_conf.c | 126 ++++++++++++++++++++------------------
src/conf/network_conf.h | 8 +--
src/libvirt_private.syms | 4 +-
src/network/bridge_driver.c | 56 ++++++++---------
src/parallels/parallels_network.c | 16 ++---
src/test/test_driver.c | 32 +++++-----
tests/networkxml2conftest.c | 4 +-
tests/objectlocking.ml | 2 -
9 files changed, 125 insertions(+), 125 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 07a794a..6885f9e 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -160,7 +160,6 @@ useless_free_options = \
--name=virNWFilterRuleDefFree \
--name=virNWFilterRuleInstFree \
--name=virNetworkDefFree \
- --name=virNetworkObjFree \
--name=virNodeDeviceDefFree \
--name=virNodeDeviceObjFree \
--name=virObjectUnref \
@@ -249,7 +248,6 @@ useless_free_options = \
# y virNetworkDefFree
# n virNetworkFree (returns int)
# n virNetworkFreeName (returns int)
-# y virNetworkObjFree
# n virNodeDevCapsDefFree FIXME
# y virNodeDeviceDefFree
# n virNodeDeviceFree (returns int)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index b3c0ac7..8f140d2 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -80,11 +80,19 @@ VIR_ENUM_IMPL(virNetworkForwardDriverName,
VIR_ENUM_IMPL(virNetworkTaint, VIR_NETWORK_TAINT_LAST,
"hook-script");
+static virClassPtr virNetworkObjClass;
static virClassPtr virNetworkObjListClass;
+static void virNetworkObjDispose(void *obj);
static void virNetworkObjListDispose(void *obj);
static int virNetworkObjOnceInit(void)
{
+ if (!(virNetworkObjClass = virClassNew(virClassForObjectLockable(),
+ "virNetworkObj",
+ sizeof(virNetworkObj),
+ virNetworkObjDispose)))
+ return -1;
+
if (!(virNetworkObjListClass = virClassNew(virClassForObject(),
"virNetworkObjList",
sizeof(virNetworkObjList),
@@ -96,6 +104,32 @@ static int virNetworkObjOnceInit(void)
VIR_ONCE_GLOBAL_INIT(virNetworkObj)
+virNetworkObjPtr
+virNetworkObjNew(void)
+{
+ virNetworkObjPtr net;
+
+ if (virNetworkObjInitialize() < 0)
+ return NULL;
+
+ if (!(net = virObjectLockableNew(virNetworkObjClass)))
+ return NULL;
+
+ if (!(net->class_id = virBitmapNew(CLASS_ID_BITMAP_SIZE)))
+ goto error;
+
+ /* The first three class IDs are already taken */
+ ignore_value(virBitmapSetBit(net->class_id, 0));
+ ignore_value(virBitmapSetBit(net->class_id, 1));
+ ignore_value(virBitmapSetBit(net->class_id, 2));
+
+ return net;
+
+ error:
+ virObjectUnref(net);
+ return NULL;
+}
+
virNetworkObjListPtr virNetworkObjListNew(void)
{
virNetworkObjListPtr nets;
@@ -115,10 +149,10 @@ virNetworkObjPtr virNetworkObjFindByUUID(virNetworkObjListPtr nets,
size_t i;
for (i = 0; i < nets->count; i++) {
- virNetworkObjLock(nets->objs[i]);
+ virObjectLock(nets->objs[i]);
if (!memcmp(nets->objs[i]->def->uuid, uuid, VIR_UUID_BUFLEN))
return nets->objs[i];
- virNetworkObjUnlock(nets->objs[i]);
+ virObjectUnlock(nets->objs[i]);
}
return NULL;
@@ -130,10 +164,10 @@ virNetworkObjPtr virNetworkObjFindByName(virNetworkObjListPtr nets,
size_t i;
for (i = 0; i < nets->count; i++) {
- virNetworkObjLock(nets->objs[i]);
+ virObjectLock(nets->objs[i]);
if (STREQ(nets->objs[i]->def->name, name))
return nets->objs[i];
- virNetworkObjUnlock(nets->objs[i]);
+ virObjectUnlock(nets->objs[i]);
}
return NULL;
@@ -297,18 +331,14 @@ virNetworkDefFree(virNetworkDefPtr def)
VIR_FREE(def);
}
-void virNetworkObjFree(virNetworkObjPtr net)
+static void
+virNetworkObjDispose(void *obj)
{
- if (!net)
- return;
+ virNetworkObjPtr net = obj;
virNetworkDefFree(net->def);
virNetworkDefFree(net->newDef);
virBitmapFree(net->class_id);
-
- virMutexDestroy(&net->lock);
-
- VIR_FREE(net);
}
static void
@@ -318,7 +348,7 @@ virNetworkObjListDispose(void *obj)
size_t i;
for (i = 0; i < nets->count; i++)
- virNetworkObjFree(nets->objs[i]);
+ virObjectUnref(nets->objs[i]);
VIR_FREE(nets->objs);
}
@@ -409,32 +439,20 @@ virNetworkAssignDef(virNetworkObjListPtr nets,
return network;
}
- if (VIR_ALLOC(network) < 0)
+ if (!(network = virNetworkObjNew()))
return NULL;
- if (virMutexInit(&network->lock) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot initialize mutex"));
- VIR_FREE(network);
- return NULL;
- }
- virNetworkObjLock(network);
+ virObjectLock(network);
- if (VIR_APPEND_ELEMENT_COPY(nets->objs, nets->count, network) < 0 ||
- !(network->class_id = virBitmapNew(CLASS_ID_BITMAP_SIZE)))
+ if (VIR_APPEND_ELEMENT_COPY(nets->objs, nets->count, network) < 0)
goto error;
- /* The first three class IDs are already taken */
- ignore_value(virBitmapSetBit(network->class_id, 0));
- ignore_value(virBitmapSetBit(network->class_id, 1));
- ignore_value(virBitmapSetBit(network->class_id, 2));
-
network->def = def;
network->persistent = !live;
return network;
error:
- virNetworkObjUnlock(network);
- virNetworkObjFree(network);
+ virObjectUnlock(network);
+ virObjectUnref(network);
return NULL;
}
@@ -602,17 +620,17 @@ void virNetworkRemoveInactive(virNetworkObjListPtr nets,
{
size_t i;
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
for (i = 0; i < nets->count; i++) {
- virNetworkObjLock(nets->objs[i]);
+ virObjectLock(nets->objs[i]);
if (nets->objs[i] == net) {
- virNetworkObjUnlock(nets->objs[i]);
- virNetworkObjFree(nets->objs[i]);
+ virObjectUnlock(nets->objs[i]);
+ virObjectUnref(nets->objs[i]);
VIR_DELETE_ELEMENT(nets->objs, i, nets->count);
break;
}
- virNetworkObjUnlock(nets->objs[i]);
+ virObjectUnlock(nets->objs[i]);
}
}
@@ -3014,7 +3032,7 @@ virNetworkLoadAllState(virNetworkObjListPtr nets,
continue;
if ((net = virNetworkLoadState(nets, stateDir, entry->d_name)))
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
}
closedir(dir);
@@ -3055,7 +3073,7 @@ int virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
autostartDir,
entry->d_name);
if (net)
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
}
closedir(dir);
@@ -3110,12 +3128,12 @@ int virNetworkBridgeInUse(virNetworkObjListPtr nets,
unsigned int ret = 0;
for (i = 0; i < nets->count; i++) {
- virNetworkObjLock(nets->objs[i]);
+ virObjectLock(nets->objs[i]);
if (nets->objs[i]->def->bridge &&
STREQ(nets->objs[i]->def->bridge, bridge) &&
!(skipname && STREQ(nets->objs[i]->def->name, skipname)))
ret = 1;
- virNetworkObjUnlock(nets->objs[i]);
+ virObjectUnlock(nets->objs[i]);
}
return ret;
@@ -4223,21 +4241,11 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr nets,
cleanup:
if (net)
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return ret;
}
-void virNetworkObjLock(virNetworkObjPtr obj)
-{
- virMutexLock(&obj->lock);
-}
-
-void virNetworkObjUnlock(virNetworkObjPtr obj)
-{
- virMutexUnlock(&obj->lock);
-}
-
#define MATCH(FLAG) (flags & (FLAG))
static bool
virNetworkMatch(virNetworkObjPtr netobj,
@@ -4289,21 +4297,21 @@ virNetworkObjListExport(virConnectPtr conn,
for (i = 0; i < netobjs->count; i++) {
virNetworkObjPtr netobj = netobjs->objs[i];
- virNetworkObjLock(netobj);
+ virObjectLock(netobj);
if ((!filter || filter(conn, netobj->def)) &&
virNetworkMatch(netobj, flags)) {
if (nets) {
if (!(net = virGetNetwork(conn,
netobj->def->name,
netobj->def->uuid))) {
- virNetworkObjUnlock(netobj);
+ virObjectUnlock(netobj);
goto cleanup;
}
tmp_nets[nnets] = net;
}
nnets++;
}
- virNetworkObjUnlock(netobj);
+ virObjectUnlock(netobj);
}
if (tmp_nets) {
@@ -4360,21 +4368,21 @@ virNetworkObjListGetNames(virNetworkObjListPtr nets,
for (i = 0; i < nets->count && got < nnames; i++) {
virNetworkObjPtr obj = nets->objs[i];
- virNetworkObjLock(obj);
+ virObjectLock(obj);
if (filter && !filter(conn, obj->def)) {
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
continue;
}
if ((active && virNetworkObjIsActive(obj)) ||
(!active && !virNetworkObjIsActive(obj))) {
if (VIR_STRDUP(names[got], obj->def->name) < 0) {
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
goto error;
}
got++;
}
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
}
return got;
@@ -4396,16 +4404,16 @@ virNetworkObjListNumOfNetworks(virNetworkObjListPtr nets,
for (i = 0; i < nets->count; i++) {
virNetworkObjPtr obj = nets->objs[i];
- virNetworkObjLock(obj);
+ virObjectLock(obj);
if (filter && !filter(conn, obj->def)) {
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
continue;
}
if ((active && virNetworkObjIsActive(obj)) ||
(!active && !virNetworkObjIsActive(obj)))
count++;
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
}
return count;
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index f7ab2cf..7f48b9a 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -258,7 +258,7 @@ struct _virNetworkDef {
typedef struct _virNetworkObj virNetworkObj;
typedef virNetworkObj *virNetworkObjPtr;
struct _virNetworkObj {
- virMutex lock;
+ virObjectLockable parent;
pid_t dnsmasqPid;
pid_t radvdPid;
@@ -275,6 +275,8 @@ struct _virNetworkObj {
unsigned int taint;
};
+virNetworkObjPtr virNetworkObjNew(void);
+
typedef struct _virNetworkObjList virNetworkObjList;
typedef virNetworkObjList *virNetworkObjListPtr;
@@ -305,7 +307,6 @@ bool virNetworkObjTaint(virNetworkObjPtr obj,
virNetworkTaintFlags taint);
void virNetworkDefFree(virNetworkDefPtr def);
-void virNetworkObjFree(virNetworkObjPtr net);
typedef bool (*virNetworkObjListFilter)(virConnectPtr conn,
virNetworkDefPtr def);
@@ -412,9 +413,6 @@ int virNetworkObjIsDuplicate(virNetworkObjListPtr nets,
virNetworkDefPtr def,
bool check_active);
-void virNetworkObjLock(virNetworkObjPtr obj);
-void virNetworkObjUnlock(virNetworkObjPtr obj);
-
VIR_ENUM_DECL(virNetworkForward)
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE \
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a9ce2cd..660579c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -566,7 +566,6 @@ virNetworkLoadAllState;
virNetworkObjAssignDef;
virNetworkObjFindByName;
virNetworkObjFindByUUID;
-virNetworkObjFree;
virNetworkObjGetPersistentDef;
virNetworkObjIsDuplicate;
virNetworkObjListExport;
@@ -574,11 +573,10 @@ virNetworkObjListForEach;
virNetworkObjListGetNames;
virNetworkObjListNew;
virNetworkObjListNumOfNetworks;
-virNetworkObjLock;
+virNetworkObjNew;
virNetworkObjReplacePersistentDef;
virNetworkObjSetDefTransient;
virNetworkObjTaint;
-virNetworkObjUnlock;
virNetworkObjUnsetDefTransient;
virNetworkObjUpdate;
virNetworkRemoveInactive;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 0bde89d..2d4a6c5 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -348,9 +348,9 @@ networkUpdateAllState(virNetworkObjPtr obj,
{
int ret = -1;
- virNetworkObjLock(obj);
+ virObjectLock(obj);
if (!virNetworkObjIsActive(obj)) {
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return 0;
}
@@ -407,7 +407,7 @@ networkUpdateAllState(virNetworkObjPtr obj,
if (!obj->persistent && !obj->active)
networkRemoveInactive(obj);
else
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -417,7 +417,7 @@ networkAutostartConfigs(virNetworkObjPtr net,
{
int ret = -1;
- virNetworkObjLock(net);
+ virObjectLock(net);
if (net->autostart &&
!virNetworkObjIsActive(net) &&
networkStartNetwork(net) < 0)
@@ -425,7 +425,7 @@ networkAutostartConfigs(virNetworkObjPtr net,
ret = 0;
cleanup:
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return ret;
}
@@ -1746,7 +1746,7 @@ networkRefreshDaemonsHelper(virNetworkObjPtr net,
void *opaque ATTRIBUTE_UNUSED)
{
- virNetworkObjLock(net);
+ virObjectLock(net);
if (virNetworkObjIsActive(net) &&
((net->def->forward.type == VIR_NETWORK_FORWARD_NONE) ||
(net->def->forward.type == VIR_NETWORK_FORWARD_NAT) ||
@@ -1760,7 +1760,7 @@ networkRefreshDaemonsHelper(virNetworkObjPtr net,
networkRefreshDhcpDaemon(net);
networkRefreshRadvd(net);
}
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return 0;
}
@@ -1781,7 +1781,7 @@ networkReloadFirewallRulesHelper(virNetworkObjPtr net,
void *opaque ATTRIBUTE_UNUSED)
{
- virNetworkObjLock(net);
+ virObjectLock(net);
if (virNetworkObjIsActive(net) &&
((net->def->forward.type == VIR_NETWORK_FORWARD_NONE) ||
(net->def->forward.type == VIR_NETWORK_FORWARD_NAT) ||
@@ -1794,7 +1794,7 @@ networkReloadFirewallRulesHelper(virNetworkObjPtr net,
/* failed to add but already logged */
}
}
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return 0;
}
@@ -2496,7 +2496,7 @@ static virNetworkPtr networkLookupByUUID(virConnectPtr conn,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -2522,7 +2522,7 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -2670,7 +2670,7 @@ static int networkIsActive(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -2689,7 +2689,7 @@ static int networkIsPersistent(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -2959,7 +2959,7 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char
*xml)
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3016,7 +3016,7 @@ static virNetworkPtr networkDefineXML(virConnectPtr conn, const char
*xml)
if (freeDef)
virNetworkDefFree(def);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3077,7 +3077,7 @@ networkUndefine(virNetworkPtr net)
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3249,7 +3249,7 @@ networkUpdate(virNetworkPtr net,
ret = 0;
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3284,7 +3284,7 @@ static int networkCreate(virNetworkPtr net)
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3335,7 +3335,7 @@ static int networkDestroy(virNetworkPtr net)
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3364,7 +3364,7 @@ static char *networkGetXMLDesc(virNetworkPtr net,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -3389,7 +3389,7 @@ static char *networkGetBridgeName(virNetworkPtr net) {
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return bridge;
}
@@ -3410,7 +3410,7 @@ static int networkGetAutostart(virNetworkPtr net,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -3478,7 +3478,7 @@ static int networkSetAutostart(virNetworkPtr net,
VIR_FREE(configFile);
VIR_FREE(autostartLink);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3651,7 +3651,7 @@ networkGetDHCPLeases(virNetworkPtr network,
virJSONValueFree(leases_array);
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return rv;
@@ -4124,7 +4124,7 @@ networkAllocateActualDevice(virDomainDefPtr dom,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
error:
@@ -4327,7 +4327,7 @@ networkNotifyActualDevice(virDomainDefPtr dom,
ret = 0;
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
error:
@@ -4477,7 +4477,7 @@ networkReleaseActualDevice(virDomainDefPtr dom,
ret = 0;
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
virDomainActualNetDefFree(iface->data.network.actual);
iface->data.network.actual = NULL;
@@ -4581,7 +4581,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
ret = 0;
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c
index e626ff6..3c879e4 100644
--- a/src/parallels/parallels_network.c
+++ b/src/parallels/parallels_network.c
@@ -230,7 +230,7 @@ parallelsLoadNetwork(parallelsConnPtr privconn, virJSONValuePtr jobj)
goto cleanup;
net->active = 1;
net->autostart = 1;
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return net;
cleanup:
@@ -265,7 +265,7 @@ parallelsAddRoutedNetwork(parallelsConnPtr privconn)
}
net->active = 1;
net->autostart = 1;
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return net;
@@ -433,7 +433,7 @@ static virNetworkPtr parallelsNetworkLookupByUUID(virConnectPtr conn,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -457,7 +457,7 @@ static virNetworkPtr parallelsNetworkLookupByName(virConnectPtr conn,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -484,7 +484,7 @@ static char *parallelsNetworkGetXMLDesc(virNetworkPtr net,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -505,7 +505,7 @@ static int parallelsNetworkIsActive(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -526,7 +526,7 @@ static int parallelsNetworkIsPersistent(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -551,7 +551,7 @@ static int parallelsNetworkGetAutostart(virNetworkPtr net,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 4b3aa24..3703d00 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -787,7 +787,7 @@ testOpenDefault(virConnectPtr conn)
goto error;
}
netobj->active = 1;
- virNetworkObjUnlock(netobj);
+ virObjectUnlock(netobj);
if (!(interfacedef = virInterfaceDefParseString(defaultInterfaceXML)))
goto error;
@@ -1155,7 +1155,7 @@ testParseNetworks(testConnPtr privconn,
}
obj->active = 1;
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
}
ret = 0;
@@ -3508,7 +3508,7 @@ static virNetworkPtr testNetworkLookupByUUID(virConnectPtr conn,
cleanup:
if (net)
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return ret;
}
@@ -3532,7 +3532,7 @@ static virNetworkPtr testNetworkLookupByName(virConnectPtr conn,
cleanup:
if (net)
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return ret;
}
@@ -3621,7 +3621,7 @@ static int testNetworkIsActive(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -3642,7 +3642,7 @@ static int testNetworkIsPersistent(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -3675,7 +3675,7 @@ static virNetworkPtr testNetworkCreateXML(virConnectPtr conn, const
char *xml)
if (event)
testObjectEventQueue(privconn, event);
if (net)
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
testDriverUnlock(privconn);
return ret;
}
@@ -3708,7 +3708,7 @@ virNetworkPtr testNetworkDefineXML(virConnectPtr conn, const char
*xml)
if (event)
testObjectEventQueue(privconn, event);
if (net)
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
testDriverUnlock(privconn);
return ret;
}
@@ -3746,7 +3746,7 @@ static int testNetworkUndefine(virNetworkPtr network)
if (event)
testObjectEventQueue(privconn, event);
if (privnet)
- virNetworkObjUnlock(privnet);
+ virObjectUnlock(privnet);
testDriverUnlock(privconn);
return ret;
}
@@ -3796,7 +3796,7 @@ testNetworkUpdate(virNetworkPtr net,
ret = 0;
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
testDriverUnlock(privconn);
return ret;
}
@@ -3833,7 +3833,7 @@ static int testNetworkCreate(virNetworkPtr network)
if (event)
testObjectEventQueue(privconn, event);
if (privnet)
- virNetworkObjUnlock(privnet);
+ virObjectUnlock(privnet);
return ret;
}
@@ -3866,7 +3866,7 @@ static int testNetworkDestroy(virNetworkPtr network)
if (event)
testObjectEventQueue(privconn, event);
if (privnet)
- virNetworkObjUnlock(privnet);
+ virObjectUnlock(privnet);
testDriverUnlock(privconn);
return ret;
}
@@ -3893,7 +3893,7 @@ static char *testNetworkGetXMLDesc(virNetworkPtr network,
cleanup:
if (privnet)
- virNetworkObjUnlock(privnet);
+ virObjectUnlock(privnet);
return ret;
}
@@ -3922,7 +3922,7 @@ static char *testNetworkGetBridgeName(virNetworkPtr network) {
cleanup:
if (privnet)
- virNetworkObjUnlock(privnet);
+ virObjectUnlock(privnet);
return bridge;
}
@@ -3947,7 +3947,7 @@ static int testNetworkGetAutostart(virNetworkPtr network,
cleanup:
if (privnet)
- virNetworkObjUnlock(privnet);
+ virObjectUnlock(privnet);
return ret;
}
@@ -3972,7 +3972,7 @@ static int testNetworkSetAutostart(virNetworkPtr network,
cleanup:
if (privnet)
- virNetworkObjUnlock(privnet);
+ virObjectUnlock(privnet);
return ret;
}
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 280db30..6df161f 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -40,7 +40,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
dnsmasqCapsPtr
if (!(dev = virNetworkDefParseString(inXmlData)))
goto fail;
- if (VIR_ALLOC(obj) < 0)
+ if (!(obj = virNetworkObjNew()))
goto fail;
obj->def = dev;
@@ -66,7 +66,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
dnsmasqCapsPtr
VIR_FREE(actual);
VIR_FREE(pidfile);
virCommandFree(cmd);
- virNetworkObjFree(obj);
+ virObjectUnref(obj);
dnsmasqContextFree(dctx);
return ret;
}
diff --git a/tests/objectlocking.ml b/tests/objectlocking.ml
index 2476731..2fa33e4 100644
--- a/tests/objectlocking.ml
+++ b/tests/objectlocking.ml
@@ -84,7 +84,6 @@ let lockedObjMethods = [
*)
let objectLockMethods = [
"virDomainObjLock";
- "virNetworkObjLock";
"virStoragePoolObjLock";
"virNodeDevObjLock"
]
@@ -99,7 +98,6 @@ let objectLockMethods = [
*)
let objectUnlockMethods = [
"virDomainObjUnlock";
- "virNetworkObjUnlock";
"virStoragePoolObjUnlock";
"virNodeDevObjUnlock"
]
--
2.0.5