[libvirt] [PATCH] Add missing parameter in python Disk IO error callback
by Daniel P. Berrange
The IO error callback was forgetting to pass the action
parameter, causing a stack trace when IO errors arrive
* python/libvirt-override-virConnect.py: Add missing action
parameter in IO error callback
---
python/libvirt-override-virConnect.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/python/libvirt-override-virConnect.py b/python/libvirt-override-virConnect.py
index df39b79..1a1cdd0 100644
--- a/python/libvirt-override-virConnect.py
+++ b/python/libvirt-override-virConnect.py
@@ -94,7 +94,7 @@
cb = cbData["cb"]
opaque = cbData["opaque"]
- cb(self, virDomain(self, _obj=dom), srcPath, devAlias, opaque)
+ cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, opaque)
return 0
except AttributeError:
pass
--
1.6.6.1
14 years, 5 months
[libvirt] [PATCH 0/2][RESEND] Fix problems on using lxc with cgroup ns subsystem
by Ryota Ozaki
The patch set fixes two problems of lxc that happen when ns
subsystem is enabled with memory subsystem at the same time.
The fist problem is that cgroup subdirectories that are
automatically created by ns subsystem remain after domain
shutdown. The second problem is that memory usage is not
properly accounted.
Ryota Ozaki (2):
cgroup: Change virCgroupRemove to remove all child groups at first
cgroup: Enable memory.use_hierarchy of cgroup for domain
14 years, 5 months
[libvirt] [PATCH] Improve some error messages about unsupported APIs/URIs
by Daniel P. Berrange
If there is no driver for a URI we report
"no hypervisor driver available"
This is bad because not all virt drivers are hypervisors (ie container
based virt).
If there is no driver support for an API we report
"this function is not supported by the hypervisor"
This is bad for the same reason, and additionally because it is
also used for the network, interface & storage drivers.
* src/util/virterror.c: Improve error messages
---
src/util/virterror.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 96dd1e7..9f632ec 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -760,15 +760,15 @@ virErrorMsg(virErrorNumber error, const char *info)
break;
case VIR_ERR_NO_SUPPORT:
if (info == NULL)
- errmsg = _("this function is not supported by the hypervisor");
+ errmsg = _("this function is not supported by the connection driver");
else
- errmsg = _("this function is not supported by the hypervisor: %s");
+ errmsg = _("this function is not supported by the connection driver: %s");
break;
case VIR_ERR_NO_CONNECT:
if (info == NULL)
- errmsg = _("no hypervisor driver available");
+ errmsg = _("no connection driver available");
else
- errmsg = _("no hypervisor driver available for %s");
+ errmsg = _("no connection driver available for %s");
break;
case VIR_ERR_INVALID_CONN:
if (info == NULL)
--
1.6.6.1
14 years, 5 months
[libvirt] [PATCH] Fix several undefined symbol errors in loadable driver modules
by Matthias Bolte
Link all loadable driver modules to libvirt.la and libgnu.la.
Add several missing symbols to libvirt_private.syms in order to
have them properly exported.
---
src/Makefile.am | 25 ++++++++++++++++++++++---
src/libvirt_private.syms | 25 +++++++++++++++++++++++++
tests/Makefile.am | 6 +++++-
3 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index ece18a6..588adf5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -456,6 +456,7 @@ libvirt_driver_test_la_CFLAGS = \
-I@top_srcdir@/src/conf
if WITH_DRIVER_MODULES
libvirt_driver_test_la_LDFLAGS = -module -avoid-version
+libvirt_driver_test_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_test_la_SOURCES = $(TEST_DRIVER_SOURCES)
endif
@@ -475,6 +476,7 @@ libvirt_driver_remote_la_LDFLAGS =
libvirt_driver_remote_la_LIBADD = $(GNUTLS_LIBS) $(SASL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_remote_la_LDFLAGS += -module -avoid-version
+libvirt_driver_remote_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_remote_la_SOURCES = $(REMOTE_DRIVER_SOURCES)
@@ -525,6 +527,7 @@ libvirt_driver_xen_la_LDFLAGS =
libvirt_driver_xen_la_LIBADD = $(XEN_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_xen_la_LDFLAGS += -module -avoid-version
+libvirt_driver_xen_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_xen_la_SOURCES = $(XEN_DRIVER_SOURCES)
endif
@@ -539,6 +542,10 @@ endif
libvirt_driver_phyp_la_LIBADD = $(LIBSSH2_LIBS)
libvirt_driver_phyp_la_CFLAGS = $(LIBSSH2_CFLAGS) \
-I@top_srcdir@/src/conf
+if WITH_DRIVER_MODULES
+libvirt_driver_phyp_la_LDFLAGS = -module -avoid-version
+libvirt_driver_phyp_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
+endif
libvirt_driver_phyp_la_SOURCES = $(PHYP_DRIVER_SOURCES)
endif
@@ -553,6 +560,7 @@ libvirt_driver_openvz_la_CFLAGS = \
-I@top_srcdir@/src/conf
if WITH_DRIVER_MODULES
libvirt_driver_openvz_la_LDFLAGS = -module -avoid-version
+libvirt_driver_openvz_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_openvz_la_SOURCES = $(OPENVZ_DRIVER_SOURCES)
endif
@@ -566,10 +574,11 @@ libvirt_la_BUILT_LIBADD += libvirt_driver_vbox.la
endif
libvirt_driver_vbox_la_CFLAGS = \
-I@top_srcdir@/src/conf
+libvirt_driver_vbox_la_LIBADD = $(DLOPEN_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version
+libvirt_driver_vbox_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
-libvirt_driver_vbox_la_LIBADD = $(DLOPEN_LIBS)
libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES)
endif
@@ -586,6 +595,7 @@ libvirt_driver_xenapi_la_LDFLAGS =
libvirt_driver_xenapi_la_LIBADD = $(LIBXENSERVER_LIBS) $(LIBCURL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_xenapi_la_LDFLAGS += -module -avoid-version
+libvirt_driver_xenapi_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
endif
@@ -604,6 +614,7 @@ libvirt_driver_qemu_la_LDFLAGS =
libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_qemu_la_LDFLAGS += -module -avoid-version
+libvirt_driver_qemu_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_qemu_la_SOURCES = $(QEMU_DRIVER_SOURCES)
@@ -629,6 +640,7 @@ libvirt_driver_lxc_la_CFLAGS = \
-I@top_srcdir@/src/conf
if WITH_DRIVER_MODULES
libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version
+libvirt_driver_lxc_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
@@ -654,6 +666,7 @@ libvirt_driver_uml_la_LDFLAGS =
libvirt_driver_uml_la_LIBADD = $(NUMACTL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_uml_la_LDFLAGS += -module -avoid-version
+libvirt_driver_uml_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_uml_la_SOURCES = $(UML_DRIVER_SOURCES)
endif
@@ -673,6 +686,7 @@ libvirt_driver_one_la_LIBADD = $(XMLRPC_LIBS)
#libvirt_driver_one_la_CFLAGS = "-DWITH_ONE"
if WITH_DRIVER_MODULES
libvirt_driver_one_la_LDFLAGS += -module -avoid-version
+libvirt_driver_one_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_one_la_SOURCES = $(ONE_DRIVER_SOURCES)
endif
@@ -696,6 +710,7 @@ libvirt_driver_esx_la_LDFLAGS =
libvirt_driver_esx_la_LIBADD = $(LIBCURL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_esx_la_LDFLAGS += -module -avoid-version
+libvirt_driver_esx_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_esx_la_SOURCES = $(ESX_DRIVER_SOURCES)
libvirt_driver_esx_la_DEPENDENCIES = $(ESX_DRIVER_GENERATED)
@@ -713,6 +728,7 @@ libvirt_driver_network_la_CFLAGS = \
-I@top_srcdir@/src/conf
if WITH_DRIVER_MODULES
libvirt_driver_network_la_LDFLAGS = -module -avoid-version
+libvirt_driver_network_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_network_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
endif
@@ -734,6 +750,7 @@ libvirt_driver_interface_la_LDFLAGS =
libvirt_driver_interface_la_LIBADD = $(NETCF_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_interface_la_LDFLAGS += -module -avoid-version
+libvirt_driver_interface_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES)
endif
@@ -750,7 +767,7 @@ libvirt_driver_secret_la_CFLAGS = \
-I@top_srcdir@/src/conf
if WITH_DRIVER_MODULES
libvirt_driver_secret_la_LDFLAGS = -module -avoid-version
-libvirt_driver_secret_la_LIBADD = ../gnulib/lib/libgnu.la
+libvirt_driver_secret_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_secret_la_SOURCES = $(SECRET_DRIVER_SOURCES)
endif
@@ -771,6 +788,7 @@ noinst_LTLIBRARIES += libvirt_driver_storage.la
endif
if WITH_DRIVER_MODULES
libvirt_driver_storage_la_LDFLAGS += -module -avoid-version
+libvirt_driver_storage_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
@@ -826,6 +844,7 @@ endif
if WITH_DRIVER_MODULES
libvirt_driver_nodedev_la_LDFLAGS += -module -avoid-version
+libvirt_driver_nodedev_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
endif
@@ -843,7 +862,7 @@ libvirt_driver_nwfilter_la_LDFLAGS =
libvirt_driver_nwfilter_la_LIBADD = $(LIBPCAP_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_nwfilter_la_LDFLAGS += -module -avoid-version
-libvirt_driver_nwfilter_la_LIBADD += ../gnulib/lib/libgnu.la
+libvirt_driver_nwfilter_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la
endif
libvirt_driver_nwfilter_la_SOURCES = $(NWFILTER_DRIVER_SOURCES)
endif
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4e61e55..b6d36a2 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -4,6 +4,11 @@
#
+# authhelper.h
+virRequestUsername;
+virRequestPassword;
+
+
# bitmap.h
virBitmapAlloc;
virBitmapFree;
@@ -17,6 +22,8 @@ virBufferVSprintf;
virBufferEscapeString;
virBufferAdd;
virBufferAddChar;
+virBufferStrcat;
+virBufferUse;
virBufferContentAndReset;
virBufferError;
virBufferURIEncodeString;
@@ -139,7 +146,9 @@ virDomainDeleteConfig;
virDomainDeviceDefFree;
virDomainDeviceDefParse;
virDomainDeviceTypeToString;
+virDomainDiskTypeToString;
virDomainDiskBusTypeToString;
+virDomainDiskCacheTypeToString;
virDomainDiskDefFree;
virDomainDiskDeviceTypeToString;
virDomainDiskInsert;
@@ -222,6 +231,7 @@ virDomainSnapshotHasChildren;
virDomainSnapshotObjUnref;
virDomainSnapshotDefParseString;
virDomainSnapshotDefFormat;
+virDomainSnapshotDefFree;
virDomainSnapshotAssignDef;
virDomainObjAssignDef;
@@ -494,6 +504,8 @@ virNodeDeviceObjListFree;
virNodeDeviceDefFree;
virNodeDevCapsDefFree;
virNodeDeviceDefFormat;
+virNodeDeviceDefParseFile;
+virNodeDeviceDefParseNode;
virNodeDeviceDefParseString;
virNodeDeviceObjLock;
virNodeDeviceObjUnlock;
@@ -633,6 +645,7 @@ virStorageFileIsSharedFS;
# threads.h
virMutexInit;
+virMutexInitRecursive;
virMutexDestroy;
virMutexLock;
virMutexUnlock;
@@ -645,13 +658,20 @@ virCondSignal;
virCondBroadcast;
# util.h
+virBuildPathInternal;
+virDirCreate;
+virFileOperation;
virFileReadAll;
virFileWriteStr;
+virFileStripSuffix;
+virFork;
virStrToLong_i;
virStrToLong_ll;
virStrToLong_ull;
virStrToLong_ui;
virStrToDouble;
+virStrcpy;
+virStrncpy;
virFileLinkPointsTo;
virFileResolveLink;
saferead;
@@ -687,6 +707,7 @@ virParseVersionString;
virPipeReadUntilEOF;
virAsprintf;
virRun;
+virRunWithHook;
virSkipSpaces;
virKillProcess;
virGetUserDirectory;
@@ -697,6 +718,10 @@ virFileFindMountPoint;
virFileWaitForDevices;
virFileMatchesNameSuffix;
virArgvToString;
+virRandom;
+virRandomInitialize;
+virIndexToDiskName;
+
# interface.h
ifaceCtrl;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a3661f6..a6a8fea 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -39,6 +39,10 @@ LDADDS = \
$(LIBSOCKET) \
$(COVERAGE_LDFLAGS)
+if WITH_DRIVER_MODULES
+LDADDS += ../src/libvirt.la
+endif
+
EXTRA_DIST = \
oomtrace.pl \
test-lib.sh \
@@ -329,7 +333,7 @@ nodeinfotest_LDADD = $(LDADDS)
statstest_SOURCES = \
statstest.c testutils.h testutils.c
-statstest_LDADD = $(LDADDS)
+statstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
if WITH_SECDRIVER_SELINUX
seclabeltest_SOURCES = \
--
1.7.0.4
14 years, 5 months
[libvirt] Comments on the libvirt java changes
by Bryan Kearney
Luis:
I have looked over the patches which you have posted up at
http://github.com/LuisCM/libvirt-java-0.4.6/commits/master. First and
formost, thank you for your interest in libvirt and hte java bindings.
A couple of minor comments. It would be easier for me if the repo did
not have a version number, and if it were just a clone of the main repo
with changes on top of it. Second, please try and remove trailing white
spaces from flies you check in. Most IDE's allow this by default.
Finally, please try and seperate out style/formatting chnages from
functional ones. It makes it easier to know what to bring in.
Now..
Commit fc394b15e6e1f0f5135bdfd3335b6cc26b635ae7
===============================================
This was a big change, but the pattern I see is:
1) Make everything final
2) ( xxxx ) instead of (xxx)
3) Comment clean up.
4) Explict use of this.
Is that correct? Are there other items in there? If so, on (1) what is
the reason for maknig everything final? Is this a performance choice? I
personally tend to make nothing private since it limits what others can
do with the code. Final seems to add in similar contraints.
Commit 44055c0ab13c56190e9cc00f71b71e23b2fc7c9b
===============================================
This looks like adding some better toStrings. Is that correct?
-- bk
14 years, 5 months
[libvirt] how to setup libvirt development environment...
by Avdhoot Joshi
Hi,
Installed RHEL 5.5 on AMD Opteron.
[root@wlng-ppcore-nd3 ~]# uname -a
Linux wlng-ppcore-nd3 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010
x86_64 x86_64 x86_64 GNU/Linux
[root@wlng-ppcore-nd3 ~]# virsh version
Compiled against library: libvir 0.6.3
Using library: libvir 0.6.3
Using API: QEMU 0.6.3
Running hypervisor: QEMU 0.9.1
This is the default version of virsh using libvirt 0.6.3.
Downloaded libvirt 0.8.1, configured it as follows:
$ configure
$ make
$ make install
What should be done so that virsh uses the latest 0.8.1 libvirtd binary, how
to completely stop 0.6.3?
I want to execute a program using virDomainMemoryStats which is not
available in 0.6.3 libvirt.
Thanks,
Avdhoot
14 years, 5 months
[libvirt] [PATCH] Don't leak open fd to virsh in libvirt-guests init script
by Jiri Denemark
Running virsh while having /var/lib/libvirt/libvirt-guests file open
makes SELinux emit messages about preventing virsh from reading that
file. Since virsh doesn't really want to read anything, it's better to
run it with /dev/null on stdin to prevent those messages.
---
daemon/libvirt-guests.init.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemon/libvirt-guests.init.in b/daemon/libvirt-guests.init.in
index 17e6824..f99c070 100644
--- a/daemon/libvirt-guests.init.in
+++ b/daemon/libvirt-guests.init.in
@@ -61,7 +61,7 @@ run_virsh() {
conn="-c $uri"
fi
- virsh $conn "$@"
+ virsh $conn "$@" </dev/null
}
run_virsh_c() {
--
1.7.1
14 years, 5 months
[libvirt] [PATCH v3] nwfilter: fix loadable module support
by Stefan Berger
Following Daniel Berrange's multiple helpful suggestions for improving
this patch and introducing another driver interface, I now wrote the
below patch where the nwfilter driver registers the functions to
instantiate and teardown the nwfilters with a function in
conf/domain_nwfilter.c called virDomainConfNWFilterRegister. Previous
helper functions that were called from qemu_driver.c and qemu_conf.c
were move into conf/domain_nwfilter.h with slight renaming done for
consistency. Those functions now call the function expored by
domain_nwfilter.c, which in turn call the functions of the new driver
interface, if available.
V3: no more inline functions
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
---
src/Makefile.am | 3 +
src/conf/domain_nwfilter.c | 61
+++++++++++++++++++++++++++++++++
src/conf/domain_nwfilter.h | 43 +++++++++++++++++++++++
src/libvirt_private.syms | 5 ++
src/nwfilter/nwfilter_driver.c | 23 ++++++++++++
src/nwfilter/nwfilter_gentech_driver.h | 17 ---------
src/qemu/qemu_conf.c | 17 ++++-----
src/qemu/qemu_driver.c | 10 ++---
8 files changed, 148 insertions(+), 31 deletions(-)
Index: libvirt-acl/src/nwfilter/nwfilter_gentech_driver.h
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_gentech_driver.h
+++ libvirt-acl/src/nwfilter/nwfilter_gentech_driver.h
@@ -67,21 +67,4 @@ void virNWFilterDomainFWUpdateCB(void *p
const char *name ATTRIBUTE_UNUSED,
void *data);
-
-/* tear down an interface's filter before tearing down the interface */
-static inline void
-virNWFilterTearNWFilter(virDomainNetDefPtr net) {
- if ((net->filter) && (net->ifname))
- virNWFilterTeardownFilter(net);
-}
-
-
-static inline void
-virNWFilterTearVMNWFilters(virDomainObjPtr vm) {
- int i;
-
- for (i = 0; i < vm->def->nnets; i++)
- virNWFilterTearNWFilter(vm->def->nets[i]);
-}
-
#endif
Index: libvirt-acl/src/qemu/qemu_conf.c
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_conf.c
+++ libvirt-acl/src/qemu/qemu_conf.c
@@ -54,7 +54,7 @@
#include "network.h"
#include "macvtap.h"
#include "cpu/cpu.h"
-#include "nwfilter/nwfilter_gentech_driver.h"
+#include "domain_nwfilter.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -1514,9 +1514,10 @@ int qemudExtractVersion(struct qemud_dri
/**
* qemudPhysIfaceConnect:
* @conn: pointer to virConnect object
+ * @driver: pointer to the qemud_driver
* @net: pointer to he VM's interface description with direct device type
- * @linkdev: The name of the physical interface to link the macvtap to
- * @brmode: The mode to put the macvtap device into
+ * @qemuCmdFlags: flags for qemu
+ * @vmuuid: The UUID of the VM (needed by 802.1Qbh)
*
* Returns a filedescriptor on success or -1 in case of error.
*/
@@ -1555,7 +1556,7 @@ qemudPhysIfaceConnect(virConnectPtr conn
if (rc >= 0) {
if ((net->filter) && (net->ifname)) {
- err = virNWFilterInstantiateFilter(conn, net);
+ err = virDomainConfNWFilterInstantiate(conn, net);
if (err) {
close(rc);
rc = -1;
@@ -1688,7 +1689,7 @@ qemudNetworkIfaceConnect(virConnectPtr c
if (tapfd >= 0) {
if ((net->filter) && (net->ifname)) {
- err = virNWFilterInstantiateFilter(conn, net);
+ err = virDomainConfNWFilterInstantiate(conn, net);
if (err) {
close(tapfd);
tapfd = -1;
@@ -4207,7 +4208,7 @@ int qemudBuildCommandLine(virConnectPtr
goto error;
if (VIR_REALLOC_N(*vmfds, (*nvmfds)+1) < 0) {
- virNWFilterTearNWFilter(net);
+ virDomainConfNWFilterTeardown(net);
close(tapfd);
goto no_memory;
}
@@ -4226,7 +4227,7 @@ int qemudBuildCommandLine(virConnectPtr
goto error;
if (VIR_REALLOC_N(*vmfds, (*nvmfds)+1) < 0) {
- virNWFilterTearNWFilter(net);
+ virDomainConfNWFilterTeardown(net);
close(tapfd);
goto no_memory;
}
@@ -4766,7 +4767,7 @@ int qemudBuildCommandLine(virConnectPtr
virReportOOMError();
error:
for (i = 0; i <= last_good_net; i++)
- virNWFilterTearNWFilter(def->nets[i]);
+ virDomainConfNWFilterTeardown(def->nets[i]);
if (vmfds &&
*vmfds) {
for (i = 0; i < *nvmfds; i++)
Index: libvirt-acl/src/qemu/qemu_driver.c
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_driver.c
+++ libvirt-acl/src/qemu/qemu_driver.c
@@ -81,7 +81,7 @@
#include "xml.h"
#include "cpu/cpu.h"
#include "macvtap.h"
-#include "nwfilter/nwfilter_gentech_driver.h"
+#include "domain_nwfilter.h"
#include "hooks.h"
#include "storage_file.h"
@@ -3576,7 +3576,7 @@ static int qemudStartVMDaemon(virConnect
VIR_FREE(progenv);
if (ret == -1) /* The VM failed to start; tear filters before taps */
- virNWFilterTearVMNWFilters(vm);
+ virDomainConfVMNWFilterTeardown(vm);
if (vmfds) {
for (i = 0 ; i < nvmfds ; i++) {
@@ -3668,7 +3668,7 @@ static void qemudShutdownVMDaemon(struct
* reporting so we don't squash a legit error. */
orig_err = virSaveLastError();
- virNWFilterTearVMNWFilters(vm);
+ virDomainConfVMNWFilterTeardown(vm);
if (driver->macFilter) {
def = vm->def;
@@ -7640,7 +7640,7 @@ cleanup:
VIR_WARN0("Unable to release PCI address on NIC");
if (ret != 0)
- virNWFilterTearNWFilter(net);
+ virDomainConfNWFilterTeardown(net);
VIR_FREE(nicstr);
VIR_FREE(netstr);
@@ -8609,7 +8609,7 @@ qemudDomainDetachNetDevice(struct qemud_
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
- virNWFilterTearNWFilter(detach);
+ virDomainConfNWFilterTeardown(detach);
#if WITH_MACVTAP
if (detach->type == VIR_DOMAIN_NET_TYPE_DIRECT) {
Index: libvirt-acl/src/Makefile.am
===================================================================
--- libvirt-acl.orig/src/Makefile.am
+++ libvirt-acl/src/Makefile.am
@@ -97,7 +97,8 @@ DRIVER_SOURCES = \
# Domain driver generic impl APIs
DOMAIN_CONF_SOURCES = \
conf/capabilities.c conf/capabilities.h \
- conf/domain_conf.c conf/domain_conf.h
+ conf/domain_conf.c conf/domain_conf.h \
+ conf/domain_nwfilter.c conf/domain_nwfilter.h
DOMAIN_EVENT_SOURCES = \
conf/domain_event.c conf/domain_event.h
Index: libvirt-acl/src/conf/domain_nwfilter.h
===================================================================
--- /dev/null
+++ libvirt-acl/src/conf/domain_nwfilter.h
@@ -0,0 +1,43 @@
+/*
+ * domain_nwfilter.h:
+ *
+ * Copyright (C) 2010 IBM Corporation
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Stefan Berger <stefanb(a)us.ibm.com>
+ */
+#ifndef DOMAIN_NWFILTER_H
+# define DOMAIN_NWFILTER_H
+
+typedef int (*virDomainConfInstantiateNWFilter)(virConnectPtr conn,
+ virDomainNetDefPtr net);
+typedef void (*virDomainConfTeardownNWFilter)(virDomainNetDefPtr net);
+
+typedef struct {
+ virDomainConfInstantiateNWFilter instantiateFilter;
+ virDomainConfTeardownNWFilter teardownFilter;
+} virDomainConfNWFilterDriver;
+typedef virDomainConfNWFilterDriver *virDomainConfNWFilterDriverPtr;
+
+void virDomainConfNWFilterRegister(virDomainConfNWFilterDriverPtr driver);
+
+int virDomainConfNWFilterInstantiate(virConnectPtr conn,
+ virDomainNetDefPtr net);
+void virDomainConfNWFilterTeardown(virDomainNetDefPtr net);
+void virDomainConfVMNWFilterTeardown(virDomainObjPtr vm);
+
+#endif /* DOMAIN_NWFILTER_H */
Index: libvirt-acl/src/conf/domain_nwfilter.c
===================================================================
--- /dev/null
+++ libvirt-acl/src/conf/domain_nwfilter.c
@@ -0,0 +1,61 @@
+/*
+ * domain_nwfilter.c:
+ *
+ * Copyright (C) 2010 IBM Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Stefan Berger <stefanb(a)us.ibm.com>
+ */
+
+#include <config.h>
+
+#include "internal.h"
+
+#include "datatypes.h"
+#include "domain_conf.h"
+#include "domain_nwfilter.h"
+
+static virDomainConfNWFilterDriverPtr nwfilterDriver;
+
+void
+virDomainConfNWFilterRegister(virDomainConfNWFilterDriverPtr driver) {
+ nwfilterDriver = driver;
+}
+
+int
+virDomainConfNWFilterInstantiate(virConnectPtr conn,
+ virDomainNetDefPtr net) {
+ if (nwfilterDriver != NULL)
+ return nwfilterDriver->instantiateFilter(conn, net);
+ /* driver module not available -- don't indicate failure */
+ return 0;
+}
+
+void
+virDomainConfNWFilterTeardown(virDomainNetDefPtr net) {
+ if (nwfilterDriver != NULL)
+ nwfilterDriver->teardownFilter(net);
+}
+
+void
+virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) {
+ int i;
+
+ if (nwfilterDriver != NULL) {
+ for (i = 0; i < vm->def->nnets; i++)
+ virDomainConfNWFilterTeardown(vm->def->nets[i]);
+ }
+}
Index: libvirt-acl/src/libvirt_private.syms
===================================================================
--- libvirt-acl.orig/src/libvirt_private.syms
+++ libvirt-acl/src/libvirt_private.syms
@@ -264,6 +264,11 @@ virDomainEventDispatchDefaultFunc;
virDomainEventDispatch;
virDomainEventQueueDispatch;
+# domain_nwfilter.h
+virDomainConfNWFilterRegister;
+virDomainConfNWFilterInstantiate;
+virDomainConfNWFilterTeardown;
+virDomainConfVMNWFilterTeardown;
# ebtables.h
ebtablesAddForwardAllowIn;
Index: libvirt-acl/src/nwfilter/nwfilter_driver.c
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_driver.c
+++ libvirt-acl/src/nwfilter/nwfilter_driver.c
@@ -33,6 +33,7 @@
#include "datatypes.h"
#include "memory.h"
#include "domain_conf.h"
+#include "domain_nwfilter.h"
#include "nwfilter_driver.h"
#include "nwfilter_gentech_driver.h"
@@ -410,6 +411,20 @@ cleanup:
}
+static int
+nwfilterInstantiateFilter(virConnectPtr conn,
+ virDomainNetDefPtr net) {
+ return virNWFilterInstantiateFilter(conn, net);
+}
+
+
+static void
+nwfilterTeardownFilter(virDomainNetDefPtr net) {
+ if ((net->ifname) && (net->filter))
+ virNWFilterTeardownFilter(net);
+}
+
+
static virNWFilterDriver nwfilterDriver = {
.name = "nwfilter",
.open = nwfilterOpen,
@@ -432,8 +447,16 @@ static virStateDriver stateDriver = {
.active = nwfilterDriverActive,
};
+
+static virDomainConfNWFilterDriver domainNWFilterDriver = {
+ .instantiateFilter = nwfilterInstantiateFilter,
+ .teardownFilter = nwfilterTeardownFilter,
+};
+
+
int nwfilterRegister(void) {
virRegisterNWFilterDriver(&nwfilterDriver);
virRegisterStateDriver(&stateDriver);
+ virDomainConfNWFilterRegister(&domainNWFilterDriver);
return 0;
}
14 years, 5 months
[libvirt] New release 0.4.6
by Luis Carlos Moreira da Costa
/Dear List,
/
/Thu Jun 17 2010 Luis Carlos Moreira da Costa <tcljava(a)gmail.com>/
/ * Refactored the all code of the libvirt.
* Modify the method toString() to String.format in all classes
contains.
* Add final in classes, methods and attributes.
* Alter of test JUnit.
* Add .project and .classpath in Eclipse Galileo IDE./
*/
Atention: And eventually transforming it to an OSGi version!/*
/Luís Carlos Moreira da Costa
Eclipse RAP, RCP, eRCP, GMF, OSGI, Spring-DM and Pentaho Developer
Regional Communities/Brazil
http://wiki.eclipse.org/Regional_Communities/Brazil/
14 years, 5 months
[libvirt] [PATCH 0/4] Change per-connection hashes to be indexed by UUIDs
by Jiri Denemark
While working at the area, I also made few other cleanups...
Jiri Denemark (4):
Index hashes by UUID instead of name
Remove unnecessary check for non-NULL uuid
Do not free static buffer with UUID
Misc cleanups
src/datatypes.c | 83 ++++++++++++++++++++++++++++--------------------------
1 files changed, 43 insertions(+), 40 deletions(-)
14 years, 5 months