Now that the nwfilter driver keeps a list of bindings that it has
created, there is no need for the complex virt driver callbacks. It is
possible to simply iterate of the list of recorded filter bindings.
This means that rebuilding filters no longer has to acquire any locks on
the virDomainObj objects, as they're never touched.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/conf/nwfilter_conf.c | 169 ++++++++++-----------------------
src/conf/nwfilter_conf.h | 51 +---------
src/conf/virnwfilterobj.c | 4 +-
src/libvirt_private.syms | 3 +-
src/lxc/lxc_driver.c | 28 ------
src/nwfilter/nwfilter_driver.c | 22 +++--
src/nwfilter/nwfilter_gentech_driver.c | 169 ++++++++++++++++++++-------------
src/nwfilter/nwfilter_gentech_driver.h | 4 +-
src/qemu/qemu_driver.c | 25 -----
src/uml/uml_driver.c | 29 ------
10 files changed, 175 insertions(+), 329 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 3d2ae9d0f3..83c9ff920f 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2819,121 +2819,6 @@ virNWFilterSaveConfig(const char *configDir,
}
-int nCallbackDriver;
-#define MAX_CALLBACK_DRIVER 10
-static virNWFilterCallbackDriverPtr callbackDrvArray[MAX_CALLBACK_DRIVER];
-
-void
-virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
-{
- if (nCallbackDriver < MAX_CALLBACK_DRIVER)
- callbackDrvArray[nCallbackDriver++] = cbd;
-}
-
-
-void
-virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
-{
- size_t i = 0;
-
- while (i < nCallbackDriver && callbackDrvArray[i] != cbd)
- i++;
-
- if (i < nCallbackDriver) {
- memmove(&callbackDrvArray[i], &callbackDrvArray[i+1],
- (nCallbackDriver - i - 1) * sizeof(callbackDrvArray[i]));
- callbackDrvArray[i] = 0;
- nCallbackDriver--;
- }
-}
-
-
-void
-virNWFilterCallbackDriversLock(void)
-{
- size_t i;
-
- for (i = 0; i < nCallbackDriver; i++)
- callbackDrvArray[i]->vmDriverLock();
-}
-
-
-void
-virNWFilterCallbackDriversUnlock(void)
-{
- size_t i;
-
- for (i = 0; i < nCallbackDriver; i++)
- callbackDrvArray[i]->vmDriverUnlock();
-}
-
-
-static virDomainObjListIterator virNWFilterDomainFWUpdateCB;
-static void *virNWFilterDomainFWUpdateOpaque;
-
-/**
- * virNWFilterInstFiltersOnAllVMs:
- * Apply all filters on all running VMs. Don't terminate in case of an
- * error. This should be called upon reloading of the driver.
- */
-int
-virNWFilterInstFiltersOnAllVMs(void)
-{
- size_t i;
- struct domUpdateCBStruct cb = {
- .opaque = virNWFilterDomainFWUpdateOpaque,
- .step = STEP_APPLY_CURRENT,
- .skipInterfaces = NULL, /* not needed */
- };
-
- for (i = 0; i < nCallbackDriver; i++)
- callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB,
- &cb);
-
- return 0;
-}
-
-
-int
-virNWFilterTriggerVMFilterRebuild(void)
-{
- size_t i;
- int ret = 0;
- struct domUpdateCBStruct cb = {
- .opaque = virNWFilterDomainFWUpdateOpaque,
- .step = STEP_APPLY_NEW,
- .skipInterfaces = virHashCreate(0, NULL),
- };
-
- if (!cb.skipInterfaces)
- return -1;
-
- for (i = 0; i < nCallbackDriver; i++) {
- if (callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB,
- &cb) < 0)
- ret = -1;
- }
-
- if (ret < 0) {
- cb.step = STEP_TEAR_NEW; /* rollback */
-
- for (i = 0; i < nCallbackDriver; i++)
- callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB,
- &cb);
- } else {
- cb.step = STEP_TEAR_OLD; /* switch over */
-
- for (i = 0; i < nCallbackDriver; i++)
- callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB,
- &cb);
- }
-
- virHashFree(cb.skipInterfaces);
-
- return ret;
-}
-
-
int
virNWFilterDeleteDef(const char *configDir,
virNWFilterDefPtr def)
@@ -3204,16 +3089,18 @@ virNWFilterDefFormat(const virNWFilterDef *def)
return NULL;
}
+static virNWFilterTriggerRebuildCallback rebuildCallback;
+static void *rebuildOpaque;
int
-virNWFilterConfLayerInit(virDomainObjListIterator domUpdateCB,
+virNWFilterConfLayerInit(virNWFilterTriggerRebuildCallback cb,
void *opaque)
{
if (initialized)
return -1;
- virNWFilterDomainFWUpdateCB = domUpdateCB;
- virNWFilterDomainFWUpdateOpaque = opaque;
+ rebuildCallback = cb;
+ rebuildOpaque = opaque;
initialized = true;
@@ -3233,8 +3120,50 @@ virNWFilterConfLayerShutdown(void)
virRWLockDestroy(&updateLock);
initialized = false;
- virNWFilterDomainFWUpdateOpaque = NULL;
- virNWFilterDomainFWUpdateCB = NULL;
+ rebuildCallback = NULL;
+ rebuildOpaque = NULL;
+}
+
+int
+virNWFilterTriggerRebuild(void)
+{
+#if 0
+ size_t i;
+ int ret = 0;
+ struct domUpdateCBStruct cb = {
+ .opaque = virNWFilterDomainFWUpdateOpaque,
+ .step = STEP_APPLY_NEW,
+ .skipInterfaces = virHashCreate(0, NULL),
+ };
+
+ if (!cb.skipInterfaces)
+ return -1;
+
+ for (i = 0; i < nCallbackDriver; i++) {
+ if (callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB,
+ &cb) < 0)
+ ret = -1;
+ }
+
+ if (ret < 0) {
+ cb.step = STEP_TEAR_NEW; /* rollback */
+
+ for (i = 0; i < nCallbackDriver; i++)
+ callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB,
+ &cb);
+ } else {
+ cb.step = STEP_TEAR_OLD; /* switch over */
+
+ for (i = 0; i < nCallbackDriver; i++)
+ callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB,
+ &cb);
+ }
+
+ virHashFree(cb.skipInterfaces);
+
+ return ret;
+#endif
+ return rebuildCallback(rebuildOpaque);
}
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 8c5421ee62..3b36a02a78 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -559,20 +559,6 @@ struct virNWFilterBinding {
};
-typedef enum {
- STEP_APPLY_NEW,
- STEP_TEAR_NEW,
- STEP_TEAR_OLD,
- STEP_APPLY_CURRENT,
-} UpdateStep;
-
-struct domUpdateCBStruct {
- void *opaque;
- UpdateStep step;
- virHashTablePtr skipInterfaces;
-};
-
-
void
virNWFilterRuleDefFree(virNWFilterRuleDefPtr def);
@@ -580,7 +566,7 @@ void
virNWFilterDefFree(virNWFilterDefPtr def);
int
-virNWFilterTriggerVMFilterRebuild(void);
+virNWFilterTriggerRebuild(void);
int
virNWFilterDeleteDef(const char *configDir,
@@ -612,44 +598,15 @@ virNWFilterReadLockFilterUpdates(void);
void
virNWFilterUnlockFilterUpdates(void);
+typedef int (*virNWFilterTriggerRebuildCallback)(void *opaque);
+
int
-virNWFilterConfLayerInit(virDomainObjListIterator domUpdateCB,
+virNWFilterConfLayerInit(virNWFilterTriggerRebuildCallback cb,
void *opaque);
void
virNWFilterConfLayerShutdown(void);
-int
-virNWFilterInstFiltersOnAllVMs(void);
-
-typedef int
-(*virNWFilterRebuild)(virDomainObjListIterator domUpdateCB,
- void *data);
-
-typedef void
-(*virNWFilterVoidCall)(void);
-
-typedef struct _virNWFilterCallbackDriver virNWFilterCallbackDriver;
-typedef virNWFilterCallbackDriver *virNWFilterCallbackDriverPtr;
-struct _virNWFilterCallbackDriver {
- const char *name;
-
- virNWFilterRebuild vmFilterRebuild;
- virNWFilterVoidCall vmDriverLock;
- virNWFilterVoidCall vmDriverUnlock;
-};
-
-void
-virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr);
-
-void
-virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr);
-
-void
-virNWFilterCallbackDriversLock(void);
-
-void
-virNWFilterCallbackDriversUnlock(void);
char *
virNWFilterPrintTCPFlags(uint8_t flags);
diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index 87d7e72703..0136a0d56c 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -276,7 +276,7 @@ virNWFilterObjTestUnassignDef(virNWFilterObjPtr obj)
obj->wantRemoved = true;
/* trigger the update on VMs referencing the filter */
- if (virNWFilterTriggerVMFilterRebuild() < 0)
+ if (virNWFilterTriggerRebuild() < 0)
rc = -1;
obj->wantRemoved = false;
@@ -358,7 +358,7 @@ virNWFilterObjListAssignDef(virNWFilterObjListPtr nwfilters,
obj->newDef = def;
/* trigger the update on VMs referencing the filter */
- if (virNWFilterTriggerVMFilterRebuild() < 0) {
+ if (virNWFilterTriggerRebuild() < 0) {
obj->newDef = NULL;
virNWFilterObjUnlock(obj);
return NULL;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9fc0aa470d..fd5edc86ad 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -792,7 +792,6 @@ virNWFilterDefFree;
virNWFilterDefParseFile;
virNWFilterDefParseString;
virNWFilterDeleteDef;
-virNWFilterInstFiltersOnAllVMs;
virNWFilterJumpTargetTypeToString;
virNWFilterPrintStateMatchFlags;
virNWFilterPrintTCPFlags;
@@ -805,7 +804,7 @@ virNWFilterRuleIsProtocolIPv4;
virNWFilterRuleIsProtocolIPv6;
virNWFilterRuleProtocolTypeToString;
virNWFilterSaveConfig;
-virNWFilterTriggerVMFilterRebuild;
+virNWFilterTriggerRebuild;
virNWFilterUnlockFilterUpdates;
virNWFilterUnRegisterCallbackDriver;
virNWFilterWriteLockFilterUpdates;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index ca01d369d5..a6b689aef0 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -66,7 +66,6 @@
#include "virfdstream.h"
#include "domain_audit.h"
#include "domain_nwfilter.h"
-#include "nwfilter_conf.h"
#include "virinitctl.h"
#include "virnetdev.h"
#include "virnetdevtap.h"
@@ -95,31 +94,6 @@ static int lxcStateInitialize(bool privileged,
static int lxcStateCleanup(void);
virLXCDriverPtr lxc_driver = NULL;
-/* callbacks for nwfilter */
-static int
-lxcVMFilterRebuild(virDomainObjListIterator iter, void *data)
-{
- return virDomainObjListForEach(lxc_driver->domains, iter, data);
-}
-
-static void
-lxcVMDriverLock(void)
-{
- lxcDriverLock(lxc_driver);
-}
-
-static void
-lxcVMDriverUnlock(void)
-{
- lxcDriverUnlock(lxc_driver);
-}
-
-static virNWFilterCallbackDriver lxcCallbackDriver = {
- .name = "LXC",
- .vmFilterRebuild = lxcVMFilterRebuild,
- .vmDriverLock = lxcVMDriverLock,
- .vmDriverUnlock = lxcVMDriverUnlock,
-};
/**
* lxcDomObjFromDomain:
@@ -1691,7 +1665,6 @@ static int lxcStateInitialize(bool privileged,
NULL, NULL) < 0)
goto cleanup;
- virNWFilterRegisterCallbackDriver(&lxcCallbackDriver);
virObjectUnref(caps);
return 0;
@@ -1764,7 +1737,6 @@ static int lxcStateCleanup(void)
if (lxc_driver == NULL)
return -1;
- virNWFilterUnRegisterCallbackDriver(&lxcCallbackDriver);
virObjectUnref(lxc_driver->domains);
virObjectUnref(lxc_driver->domainEventState);
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index ccbcfbbf67..92389840fd 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -170,6 +170,15 @@ static void virNWFilterBindingDataFree(void *payload, const void
*name ATTRIBUTE
virNWFilterBindingFree(binding);
}
+
+static int virNWFilterTriggerRebuildImpl(void *opaque)
+{
+ virNWFilterDriverStatePtr nwdriver = opaque;
+
+ return virNWFilterBuildAll(nwdriver, true);
+}
+
+
/**
* nwfilterStateInitialize:
*
@@ -216,7 +225,7 @@ nwfilterStateInitialize(bool privileged,
if (virNWFilterTechDriversInit(privileged) < 0)
goto err_dhcpsnoop_shutdown;
- if (virNWFilterConfLayerInit(virNWFilterDomainFWUpdateCB,
+ if (virNWFilterConfLayerInit(virNWFilterTriggerRebuildImpl,
driver) < 0)
goto err_techdrivers_shutdown;
@@ -306,15 +315,14 @@ nwfilterStateReload(void)
nwfilterDriverLock();
virNWFilterWriteLockFilterUpdates();
- virNWFilterCallbackDriversLock();
virNWFilterObjListLoadAllConfigs(driver->nwfilters, driver->configDir);
- virNWFilterCallbackDriversUnlock();
virNWFilterUnlockFilterUpdates();
- nwfilterDriverUnlock();
- virNWFilterInstFiltersOnAllVMs();
+ virNWFilterBuildAll(driver, false);
+
+ nwfilterDriverUnlock();
return 0;
}
@@ -550,7 +558,6 @@ nwfilterDefineXML(virConnectPtr conn,
nwfilterDriverLock();
virNWFilterWriteLockFilterUpdates();
- virNWFilterCallbackDriversLock();
if (!(def = virNWFilterDefParseString(xml)))
goto cleanup;
@@ -575,7 +582,6 @@ nwfilterDefineXML(virConnectPtr conn,
if (obj)
virNWFilterObjUnlock(obj);
- virNWFilterCallbackDriversUnlock();
virNWFilterUnlockFilterUpdates();
nwfilterDriverUnlock();
return nwfilter;
@@ -591,7 +597,6 @@ nwfilterUndefine(virNWFilterPtr nwfilter)
nwfilterDriverLock();
virNWFilterWriteLockFilterUpdates();
- virNWFilterCallbackDriversLock();
if (!(obj = nwfilterObjFromNWFilter(nwfilter->uuid)))
goto cleanup;
@@ -618,7 +623,6 @@ nwfilterUndefine(virNWFilterPtr nwfilter)
if (obj)
virNWFilterObjUnlock(obj);
- virNWFilterCallbackDriversUnlock();
virNWFilterUnlockFilterUpdates();
nwfilterDriverUnlock();
return ret;
diff --git a/src/nwfilter/nwfilter_gentech_driver.c
b/src/nwfilter/nwfilter_gentech_driver.c
index 0dc51d16c5..5c83b06504 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -153,9 +153,9 @@ virNWFilterVarHashmapAddStdValues(virHashTablePtr table,
if (!val)
return -1;
- if (virHashAddEntry(table,
- NWFILTER_STD_VAR_MAC,
- val) < 0) {
+ if (virHashUpdateEntry(table,
+ NWFILTER_STD_VAR_MAC,
+ val) < 0) {
virNWFilterVarValueFree(val);
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Could not add variable 'MAC'
to hashmap"));
@@ -168,9 +168,9 @@ virNWFilterVarHashmapAddStdValues(virHashTablePtr table,
if (!val)
return -1;
- if (virHashAddEntry(table,
- NWFILTER_STD_VAR_IP,
- val) < 0) {
+ if (virHashUpdateEntry(table,
+ NWFILTER_STD_VAR_IP,
+ val) < 0) {
virNWFilterVarValueFree(val);
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Could not add variable 'IP' to
hashmap"));
@@ -1000,72 +1000,111 @@ virNWFilterTeardownFilter(virNWFilterBindingPtr binding)
return ret;
}
+enum {
+ STEP_APPLY_NEW,
+ STEP_TEAR_NEW,
+ STEP_TEAR_OLD,
+ STEP_APPLY_CURRENT,
+};
-int
-virNWFilterDomainFWUpdateCB(virDomainObjPtr obj,
- void *data)
+static int
+virNWFilterBuildOne(virNWFilterDriverStatePtr driver,
+ virNWFilterBindingPtr binding,
+ virHashTablePtr skipInterfaces,
+ int step)
{
- virDomainDefPtr vm = obj->def;
- struct domUpdateCBStruct *cb = data;
- size_t i;
bool skipIface;
int ret = 0;
-
- virObjectLock(obj);
-
- if (virDomainObjIsActive(obj)) {
- for (i = 0; i < vm->nnets; i++) {
- virDomainNetDefPtr net = vm->nets[i];
- virNWFilterBinding binding = {
- .ownername = vm->name,
- .portdevname = net->ifname,
- .linkdevname = (net->type == VIR_DOMAIN_NET_TYPE_DIRECT ?
- net->data.direct.linkdev : NULL),
- .mac = net->mac,
- .filter = net->filter,
- .filterparams = net->filterparams,
- };
- memcpy(binding.owneruuid, vm->uuid, sizeof(binding.owneruuid));
- if ((net->filter) && (net->ifname)) {
- switch (cb->step) {
- case STEP_APPLY_NEW:
- ret = virNWFilterUpdateInstantiateFilter(cb->opaque,
- &binding,
- &skipIface);
- if (ret == 0 && skipIface) {
- /* filter tree unchanged -- no update needed */
- ret = virHashAddEntry(cb->skipInterfaces,
- net->ifname,
- (void *)~0);
- }
- break;
-
- case STEP_TEAR_NEW:
- if (!virHashLookup(cb->skipInterfaces, net->ifname))
- ret = virNWFilterRollbackUpdateFilter(&binding);
- break;
-
- case STEP_TEAR_OLD:
- if (!virHashLookup(cb->skipInterfaces, net->ifname))
- ret = virNWFilterTearOldFilter(&binding);
- break;
-
- case STEP_APPLY_CURRENT:
- ret = virNWFilterInstantiateFilter(cb->opaque,
- &binding);
- if (ret)
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failure while applying current filter on
"
- "VM %s"), vm->name);
- break;
- }
- if (ret)
- break;
- }
+ VIR_DEBUG("Building filter for portdev=%s step=%d",
binding->portdevname, step);
+
+ switch (step) {
+ case STEP_APPLY_NEW:
+ ret = virNWFilterUpdateInstantiateFilter(driver,
+ binding,
+ &skipIface);
+ if (ret == 0 && skipIface) {
+ /* filter tree unchanged -- no update needed */
+ ret = virHashAddEntry(skipInterfaces,
+ binding->portdevname,
+ (void *)~0);
}
+ break;
+
+ case STEP_TEAR_NEW:
+ if (!virHashLookup(skipInterfaces, binding->portdevname))
+ ret = virNWFilterRollbackUpdateFilter(binding);
+ break;
+
+ case STEP_TEAR_OLD:
+ if (!virHashLookup(skipInterfaces, binding->portdevname))
+ ret = virNWFilterTearOldFilter(binding);
+ break;
+
+ case STEP_APPLY_CURRENT:
+ ret = virNWFilterInstantiateFilter(driver,
+ binding);
+ break;
}
- virObjectUnlock(obj);
+ return ret;
+}
+
+
+struct virNWFilterBuildData {
+ virNWFilterDriverStatePtr driver;
+ virHashTablePtr skipInterfaces;
+ int step;
+};
+
+static int
+virNWFilterBuildIter(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaque)
+{
+ virNWFilterBindingPtr binding = payload;
+ struct virNWFilterBuildData *data = opaque;
+
+ return virNWFilterBuildOne(data->driver, binding,
+ data->skipInterfaces, data->step);
+}
+
+int
+virNWFilterBuildAll(virNWFilterDriverStatePtr driver,
+ bool newFilters)
+{
+ struct virNWFilterBuildData data = {
+ .driver = driver,
+ };
+ int ret = 0;
+
+ VIR_DEBUG("Build all filters newFilters=%d", newFilters);
+
+ if (newFilters) {
+ if (!(data.skipInterfaces = virHashCreate(0, NULL)))
+ return -1;
+
+ data.step = STEP_APPLY_NEW;
+ if (virHashForEach(driver->bindings,
+ virNWFilterBuildIter,
+ &data) < 0)
+ ret = -1;
+
+ if (ret == -1) {
+ data.step = STEP_TEAR_NEW;
+ virHashForEach(driver->bindings,
+ virNWFilterBuildIter,
+ &data);
+ } else {
+ data.step = STEP_TEAR_OLD;
+ virHashForEach(driver->bindings,
+ virNWFilterBuildIter,
+ &data);
+ }
+ } else {
+ data.step = STEP_APPLY_CURRENT;
+ if (virHashForEach(driver->bindings,
+ virNWFilterBuildIter,
+ &data) < 0)
+ ret = -1;
+ }
return ret;
}
diff --git a/src/nwfilter/nwfilter_gentech_driver.h
b/src/nwfilter/nwfilter_gentech_driver.h
index 0d846dc92f..8bfc323808 100644
--- a/src/nwfilter/nwfilter_gentech_driver.h
+++ b/src/nwfilter/nwfilter_gentech_driver.h
@@ -52,8 +52,8 @@ int virNWFilterTeardownFilter(virNWFilterBindingPtr binding);
virHashTablePtr virNWFilterCreateVarHashmap(const char *macaddr,
const virNWFilterVarValue *value);
-int virNWFilterDomainFWUpdateCB(virDomainObjPtr vm,
- void *data);
+int virNWFilterBuildAll(virNWFilterDriverStatePtr driver,
+ bool newFilters);
virNWFilterBindingPtr virNWFilterBindingForNet(const char *vmname,
const unsigned char *vmuuid,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7484b00e23..668891a119 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -84,7 +84,6 @@
#include "cpu/cpu.h"
#include "virsysinfo.h"
#include "domain_nwfilter.h"
-#include "nwfilter_conf.h"
#include "virhook.h"
#include "virstoragefile.h"
#include "virfile.h"
@@ -164,28 +163,6 @@ static int qemuARPGetInterfaces(virDomainObjPtr vm,
static virQEMUDriverPtr qemu_driver;
-
-static void
-qemuVMDriverLock(void)
-{}
-static void
-qemuVMDriverUnlock(void)
-{}
-
-static int
-qemuVMFilterRebuild(virDomainObjListIterator iter, void *data)
-{
- return virDomainObjListForEach(qemu_driver->domains, iter, data);
-}
-
-static virNWFilterCallbackDriver qemuCallbackDriver = {
- .name = QEMU_DRIVER_NAME,
- .vmFilterRebuild = qemuVMFilterRebuild,
- .vmDriverLock = qemuVMDriverLock,
- .vmDriverUnlock = qemuVMDriverUnlock,
-};
-
-
/**
* qemuDomObjFromDomain:
* @domain: Domain pointer that has to be looked up
@@ -938,7 +915,6 @@ qemuStateInitialize(bool privileged,
if (!qemu_driver->workerPool)
goto error;
- virNWFilterRegisterCallbackDriver(&qemuCallbackDriver);
return 0;
error:
@@ -1078,7 +1054,6 @@ qemuStateCleanup(void)
if (!qemu_driver)
return -1;
- virNWFilterUnRegisterCallbackDriver(&qemuCallbackDriver);
virThreadPoolFree(qemu_driver->workerPool);
virObjectUnref(qemu_driver->config);
virObjectUnref(qemu_driver->hostdevMgr);
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index b50ba1ba64..4da8fdf473 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -55,7 +55,6 @@
#include "datatypes.h"
#include "virlog.h"
#include "domain_nwfilter.h"
-#include "nwfilter_conf.h"
#include "virfile.h"
#include "virfdstream.h"
#include "configmake.h"
@@ -145,25 +144,6 @@ static int umlMonitorCommand(const struct uml_driver *driver,
static struct uml_driver *uml_driver;
-static int
-umlVMFilterRebuild(virDomainObjListIterator iter, void *data)
-{
- return virDomainObjListForEach(uml_driver->domains, iter, data);
-}
-
-static void
-umlVMDriverLock(void)
-{
- umlDriverLock(uml_driver);
-}
-
-static void
-umlVMDriverUnlock(void)
-{
- umlDriverUnlock(uml_driver);
-}
-
-
static virDomainObjPtr
umlDomObjFromDomainLocked(struct uml_driver *driver,
const unsigned char *uuid)
@@ -196,13 +176,6 @@ umlDomObjFromDomain(struct uml_driver *driver,
}
-static virNWFilterCallbackDriver umlCallbackDriver = {
- .name = "UML",
- .vmFilterRebuild = umlVMFilterRebuild,
- .vmDriverLock = umlVMDriverLock,
- .vmDriverUnlock = umlVMDriverUnlock,
-};
-
struct umlAutostartData {
struct uml_driver *driver;
virConnectPtr conn;
@@ -615,7 +588,6 @@ umlStateInitialize(bool privileged,
VIR_FREE(userdir);
- virNWFilterRegisterCallbackDriver(¨CallbackDriver);
return 0;
out_of_memory:
@@ -709,7 +681,6 @@ umlStateCleanup(void)
return -1;
umlDriverLock(uml_driver);
- virNWFilterRegisterCallbackDriver(¨CallbackDriver);
if (uml_driver->inotifyWatch != -1)
virEventRemoveHandle(uml_driver->inotifyWatch);
VIR_FORCE_CLOSE(uml_driver->inotifyFD);
--
2.14.3