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 | 110 ++++++++++++++++++++------------------
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, 116 insertions(+), 118 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 ae29c47..609990c 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -79,11 +79,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),
@@ -99,7 +107,33 @@ static void
virNetworkObjListDataFree(void *payload, const void *name ATTRIBUTE_UNUSED)
{
virNetworkObjPtr obj = payload;
- virNetworkObjFree(obj);
+ virObjectUnref(obj);
+}
+
+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)
@@ -130,7 +164,7 @@ virNetworkObjPtr virNetworkObjFindByUUID(virNetworkObjListPtr nets,
ret = virHashLookup(nets->objs, uuidstr);
if (ret)
- virNetworkObjLock(ret);
+ virObjectLock(ret);
return ret;
}
@@ -142,10 +176,10 @@ virNetworkObjSearchName(const void *payload,
virNetworkObjPtr net = (virNetworkObjPtr) payload;
int want = 0;
- virNetworkObjLock(net);
+ virObjectLock(net);
if (STREQ(net->def->name, (const char *)data))
want = 1;
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return want;
}
@@ -156,7 +190,7 @@ virNetworkObjPtr virNetworkObjFindByName(virNetworkObjListPtr nets,
ret = virHashSearch(nets->objs, virNetworkObjSearchName, name);
if (ret)
- virNetworkObjLock(ret);
+ virObjectLock(ret);
return ret;
}
@@ -318,18 +352,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
@@ -427,35 +457,21 @@ 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);
-
- if (!(network->class_id = virBitmapNew(CLASS_ID_BITMAP_SIZE)))
- goto error;
+ virObjectLock(network);
virUUIDFormat(def->uuid, uuidstr);
if (virHashAddEntry(nets->objs, uuidstr, 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;
}
@@ -624,7 +640,7 @@ void virNetworkRemoveInactive(virNetworkObjListPtr nets,
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(net->def->uuid, uuidstr);
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
virHashRemoveEntry(nets->objs, uuidstr);
}
@@ -3026,7 +3042,7 @@ virNetworkLoadAllState(virNetworkObjListPtr nets,
continue;
if ((net = virNetworkLoadState(nets, stateDir, entry->d_name)))
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
}
closedir(dir);
@@ -3067,7 +3083,7 @@ int virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
autostartDir,
entry->d_name);
if (net)
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
}
closedir(dir);
@@ -3128,12 +3144,12 @@ virNetworkBridgeInUseHelper(const void *payload,
virNetworkObjPtr net = (virNetworkObjPtr) payload;
const struct virNetworkBridgeInUseHelperData *data = opaque;
- virNetworkObjLock(net);
+ virObjectLock(net);
if (net->def->bridge &&
STREQ(net->def->bridge, data->bridge) &&
!(data->skipname && STREQ(net->def->name, data->skipname)))
ret = 1;
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return ret;
}
@@ -4251,21 +4267,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,
@@ -4320,7 +4326,7 @@ virNetworkObjListPopulate(void *payload,
if (data->error)
return;
- virNetworkObjLock(obj);
+ virObjectLock(obj);
if (data->filter &&
!data->filter(data->conn, obj->def))
@@ -4342,7 +4348,7 @@ virNetworkObjListPopulate(void *payload,
data->nets[data->nnets++] = net;
cleanup:
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
}
int
@@ -4442,7 +4448,7 @@ virNetworkObjListGetHelper(void *payload,
data->got == data->nnames)
return;
- virNetworkObjLock(obj);
+ virObjectLock(obj);
if (data->filter &&
!data->filter(data->conn, obj->def))
@@ -4459,7 +4465,7 @@ virNetworkObjListGetHelper(void *payload,
}
cleanup:
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
}
int
@@ -4516,9 +4522,9 @@ virNetworkObjListPruneHelper(const void *payload,
virNetworkObjPtr obj = (virNetworkObjPtr) payload;
int want = 0;
- virNetworkObjLock(obj);
+ virObjectLock(obj);
want = virNetworkMatch(obj, data->flags);
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return want;
}
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 3575659..1423676 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 e0d5459..5e78cf7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -565,7 +565,6 @@ virNetworkLoadAllState;
virNetworkObjAssignDef;
virNetworkObjFindByName;
virNetworkObjFindByUUID;
-virNetworkObjFree;
virNetworkObjGetPersistentDef;
virNetworkObjIsDuplicate;
virNetworkObjListExport;
@@ -574,11 +573,10 @@ virNetworkObjListGetNames;
virNetworkObjListNew;
virNetworkObjListNumOfNetworks;
virNetworkObjListPrune;
-virNetworkObjLock;
+virNetworkObjNew;
virNetworkObjReplacePersistentDef;
virNetworkObjSetDefTransient;
virNetworkObjTaint;
-virNetworkObjUnlock;
virNetworkObjUnsetDefTransient;
virNetworkObjUpdate;
virNetworkRemoveInactive;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 5752acb..70467f6 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -348,9 +348,9 @@ networkUpdateState(virNetworkObjPtr obj,
{
int ret = -1;
- virNetworkObjLock(obj);
+ virObjectLock(obj);
if (!virNetworkObjIsActive(obj)) {
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return 0;
}
@@ -403,7 +403,7 @@ networkUpdateState(virNetworkObjPtr obj,
ret = 0;
cleanup:
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -413,7 +413,7 @@ networkAutostartConfig(virNetworkObjPtr net,
{
int ret = -1;
- virNetworkObjLock(net);
+ virObjectLock(net);
if (net->autostart &&
!virNetworkObjIsActive(net) &&
networkStartNetwork(net) < 0)
@@ -421,7 +421,7 @@ networkAutostartConfig(virNetworkObjPtr net,
ret = 0;
cleanup:
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return ret;
}
@@ -1745,7 +1745,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) ||
@@ -1759,7 +1759,7 @@ networkRefreshDaemonsHelper(virNetworkObjPtr net,
networkRefreshDhcpDaemon(net);
networkRefreshRadvd(net);
}
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return 0;
}
@@ -1780,7 +1780,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) ||
@@ -1793,7 +1793,7 @@ networkReloadFirewallRulesHelper(virNetworkObjPtr net,
/* failed to add but already logged */
}
}
- virNetworkObjUnlock(net);
+ virObjectUnlock(net);
return 0;
}
@@ -2497,7 +2497,7 @@ static virNetworkPtr networkLookupByUUID(virConnectPtr conn,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -2523,7 +2523,7 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -2671,7 +2671,7 @@ static int networkIsActive(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -2690,7 +2690,7 @@ static int networkIsPersistent(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -2960,7 +2960,7 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char
*xml)
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3017,7 +3017,7 @@ static virNetworkPtr networkDefineXML(virConnectPtr conn, const char
*xml)
if (freeDef)
virNetworkDefFree(def);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3078,7 +3078,7 @@ networkUndefine(virNetworkPtr net)
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3250,7 +3250,7 @@ networkUpdate(virNetworkPtr net,
ret = 0;
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3285,7 +3285,7 @@ static int networkCreate(virNetworkPtr net)
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3336,7 +3336,7 @@ static int networkDestroy(virNetworkPtr net)
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3365,7 +3365,7 @@ static char *networkGetXMLDesc(virNetworkPtr net,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -3390,7 +3390,7 @@ static char *networkGetBridgeName(virNetworkPtr net) {
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return bridge;
}
@@ -3411,7 +3411,7 @@ static int networkGetAutostart(virNetworkPtr net,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -3479,7 +3479,7 @@ static int networkSetAutostart(virNetworkPtr net,
VIR_FREE(configFile);
VIR_FREE(autostartLink);
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
networkDriverUnlock();
return ret;
}
@@ -3652,7 +3652,7 @@ networkGetDHCPLeases(virNetworkPtr network,
virJSONValueFree(leases_array);
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return rv;
@@ -4125,7 +4125,7 @@ networkAllocateActualDevice(virDomainDefPtr dom,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
error:
@@ -4328,7 +4328,7 @@ networkNotifyActualDevice(virDomainDefPtr dom,
ret = 0;
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
error:
@@ -4478,7 +4478,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;
@@ -4582,7 +4582,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 62ed268..86038bf 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;
@@ -445,7 +445,7 @@ static virNetworkPtr parallelsNetworkLookupByUUID(virConnectPtr conn,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -469,7 +469,7 @@ static virNetworkPtr parallelsNetworkLookupByName(virConnectPtr conn,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -496,7 +496,7 @@ static char *parallelsNetworkGetXMLDesc(virNetworkPtr net,
cleanup:
if (network)
- virNetworkObjUnlock(network);
+ virObjectUnlock(network);
return ret;
}
@@ -517,7 +517,7 @@ static int parallelsNetworkIsActive(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -538,7 +538,7 @@ static int parallelsNetworkIsPersistent(virNetworkPtr net)
cleanup:
if (obj)
- virNetworkObjUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -563,7 +563,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 693b930..20c77de 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 7826148..fd83d6d 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