mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
network_conf: Make virNetworkObj actually virObject
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@redhat.com>
This commit is contained in:
parent
8529d5ec6b
commit
ea57049156
2
cfg.mk
2
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)
|
||||
|
@ -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),
|
||||
@ -95,11 +103,30 @@ static int virNetworkObjOnceInit(void)
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(virNetworkObj)
|
||||
|
||||
static void
|
||||
virNetworkObjListDataFree(void *payload, const void *name ATTRIBUTE_UNUSED)
|
||||
virNetworkObjPtr
|
||||
virNetworkObjNew(void)
|
||||
{
|
||||
virNetworkObjPtr obj = payload;
|
||||
virNetworkObjFree(obj);
|
||||
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)
|
||||
@ -112,7 +139,7 @@ virNetworkObjListPtr virNetworkObjListNew(void)
|
||||
if (!(nets = virObjectNew(virNetworkObjListClass)))
|
||||
return NULL;
|
||||
|
||||
if (!(nets->objs = virHashCreate(50, virNetworkObjListDataFree))) {
|
||||
if (!(nets->objs = virHashCreate(50, virObjectFreeHashData))) {
|
||||
virObjectUnref(nets);
|
||||
return NULL;
|
||||
}
|
||||
@ -130,7 +157,7 @@ virNetworkObjPtr virNetworkObjFindByUUID(virNetworkObjListPtr nets,
|
||||
|
||||
ret = virHashLookup(nets->objs, uuidstr);
|
||||
if (ret)
|
||||
virNetworkObjLock(ret);
|
||||
virObjectLock(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -142,10 +169,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 +183,7 @@ virNetworkObjPtr virNetworkObjFindByName(virNetworkObjListPtr nets,
|
||||
|
||||
ret = virHashSearch(nets->objs, virNetworkObjSearchName, name);
|
||||
if (ret)
|
||||
virNetworkObjLock(ret);
|
||||
virObjectLock(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -318,18 +345,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 +450,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 +633,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 +3035,7 @@ virNetworkLoadAllState(virNetworkObjListPtr nets,
|
||||
continue;
|
||||
|
||||
if ((net = virNetworkLoadState(nets, stateDir, entry->d_name)))
|
||||
virNetworkObjUnlock(net);
|
||||
virObjectUnlock(net);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
@ -3067,7 +3076,7 @@ int virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
|
||||
autostartDir,
|
||||
entry->d_name);
|
||||
if (net)
|
||||
virNetworkObjUnlock(net);
|
||||
virObjectUnlock(net);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
@ -3129,12 +3138,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;
|
||||
}
|
||||
|
||||
@ -4252,21 +4261,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,
|
||||
@ -4321,7 +4320,7 @@ virNetworkObjListPopulate(void *payload,
|
||||
if (data->error)
|
||||
return;
|
||||
|
||||
virNetworkObjLock(obj);
|
||||
virObjectLock(obj);
|
||||
|
||||
if (data->filter &&
|
||||
!data->filter(data->conn, obj->def))
|
||||
@ -4343,7 +4342,7 @@ virNetworkObjListPopulate(void *payload,
|
||||
data->nets[data->nnets++] = net;
|
||||
|
||||
cleanup:
|
||||
virNetworkObjUnlock(obj);
|
||||
virObjectUnlock(obj);
|
||||
}
|
||||
|
||||
int
|
||||
@ -4443,7 +4442,7 @@ virNetworkObjListGetHelper(void *payload,
|
||||
data->got == data->nnames)
|
||||
return;
|
||||
|
||||
virNetworkObjLock(obj);
|
||||
virObjectLock(obj);
|
||||
|
||||
if (data->filter &&
|
||||
!data->filter(data->conn, obj->def))
|
||||
@ -4460,7 +4459,7 @@ virNetworkObjListGetHelper(void *payload,
|
||||
}
|
||||
|
||||
cleanup:
|
||||
virNetworkObjUnlock(obj);
|
||||
virObjectUnlock(obj);
|
||||
}
|
||||
|
||||
int
|
||||
@ -4517,9 +4516,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;
|
||||
}
|
||||
|
||||
|
@ -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 \
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ let lockedObjMethods = [
|
||||
*)
|
||||
let objectLockMethods = [
|
||||
"virDomainObjLock";
|
||||
"virNetworkObjLock";
|
||||
"virStoragePoolObjLock";
|
||||
"virNodeDevObjLock"
|
||||
]
|
||||
@ -99,7 +98,6 @@ let objectLockMethods = [
|
||||
*)
|
||||
let objectUnlockMethods = [
|
||||
"virDomainObjUnlock";
|
||||
"virNetworkObjUnlock";
|
||||
"virStoragePoolObjUnlock";
|
||||
"virNodeDevObjUnlock"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user