[libvirt] [PATCH 2/2]: Remove getURI internal driver call
by Chris Lalancette
This patch removes the internal getURI() driver callback. It was *never*
overridden by any of the drivers, so it seems kind of pointless (I even checked
the "in-progress" VirtualBox, OpenNebula, and Power Hypervisor drivers). In
addition, the code to actually use it in src/libvirt.c:virConnectGetURI() was
buggy; if a driver did decide to have their own callback, then their callback
would be called, and then immediately overwritten by the generic stuff. This
wouldn't do what the driver expected, and would also probably leak memory. Just
rip out this internal callback; if a future driver ever needs it, we can add it
back in.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
15 years, 8 months
[libvirt] [PATCH 1/2]: Convert internal drivers to old style struct initializers
by Chris Lalancette
This patch converts the internal drivers to use the old-style struct
initializers, which kind of gives us a self-documenting TODO list for each of
the drivers. It also fixes up some bad comments in the internal driver list.
It does not touch the storage or network driver initializers.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
15 years, 8 months
[libvirt] Patch to allow setting of svirt XML.
by Daniel J Walsh
This patch fixes the seclabel handling in domain_conf.c to allow
virt-manager to set the seclabel model, type and label.
Also adds missing error messages when the xml is incorrect.
How much verification should we be doing on this? I have another patch
that verifies the model as being a known model and a patch to verify the
label is a correct label. (IE SELinux verifies the label is understood
by the kernel.)
The problem with this second patch is it sucks in security.[ch],
security_selinux.[ch] into the libvirt_lxc. Should I be doing this?
15 years, 8 months
[libvirt] Upcoming 0.6.2 release
by Daniel Veillard
I would like to make a new release mid or end of next week, considering
the number of fixes accumulated in CVS compared to 0.6.1, I guess 0.6.2
makes sense.
I think we should look at integrating the new SCSI pool patch, hopefully
there is no big issues.
If there are mails or patchs which are pending and we forgot to review
or ACK, please raise them again so that we can try to get them in time
for next release,
thanks,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
15 years, 8 months
[libvirt] PATCH: Misc error handling / OOM fixes
by Daniel P. Berrange
I ran the OOM checking test suite again and uncovered a handful of
pretty minor bugs - no crashers in real code - just forgetting to
report OOM correctly
* src/datatypes.c: Convert to use the virReportErrorHelper macro
instead of a static function, so we get correct function/line
number info
* src/domain_conf.c: Fix OOM handling in virXPathNodeSet() call
so it reports OOM error, instead of ignoring
* src/nodeinfo.c: Use _(...) for error message strings
* src/xend_internal.c: Add missing check of virBufferError() func
and report OOM error
* tests/sexpr2xmltest.c: Reset error object between tests, free
capabilities object, don't unref a NULL connection object
* tests/testutils.c: Fix crash in OOM testing if single threaded
* tests/xml2sexprtest.c: Reset error object between tests
Daniel
Index: src/datatypes.c
===================================================================
RCS file: /data/cvs/libvirt/src/datatypes.c,v
retrieving revision 1.9
diff -u -p -r1.9 datatypes.c
--- src/datatypes.c 29 Jan 2009 12:10:32 -0000 1.9
+++ src/datatypes.c 30 Mar 2009 11:47:05 -0000
@@ -28,31 +28,15 @@
#define VIR_FROM_THIS VIR_FROM_NONE
+#define virLibConnError(conn, code, fmt...) \
+ virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \
+ __FUNCTION__, __LINE__, fmt)
+
/************************************************************************
* *
* Domain and Connections allocations *
* *
************************************************************************/
-/**
- * virLibConnError:
- * @conn: the connection if available
- * @error: the error number
- * @info: extra information string
- *
- * Handle an error at the connection level
- */
-static void
-virLibConnError(virConnectPtr conn, virErrorNumber error, const char *info)
-{
- const char *errmsg;
-
- if (error == VIR_ERR_OK)
- return;
-
- errmsg = virErrorMsg(error, info);
- virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_ERROR,
- errmsg, info, NULL, 0, 0, errmsg, info);
-}
/**
* virDomainFreeName:
Index: src/domain_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/domain_conf.c,v
retrieving revision 1.72
diff -u -p -r1.72 domain_conf.c
--- src/domain_conf.c 24 Mar 2009 11:16:29 -0000 1.72
+++ src/domain_conf.c 30 Mar 2009 11:47:05 -0000
@@ -2068,7 +2068,10 @@ static virDomainDefPtr virDomainDefParse
VIR_FREE(tmp);
}
- if ((n = virXPathNodeSet(conn, "./features/*", ctxt, &nodes)) > 0) {
+ n = virXPathNodeSet(conn, "./features/*", ctxt, &nodes);
+ if (n < 0)
+ goto error;
+ if (n) {
for (i = 0 ; i < n ; i++) {
int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
if (val < 0) {
@@ -2079,8 +2082,8 @@ static virDomainDefPtr virDomainDefParse
}
def->features |= (1 << val);
}
+ VIR_FREE(nodes);
}
- VIR_FREE(nodes);
if (virDomainLifecycleParseXML(conn, ctxt, "string(./on_reboot[1])",
&def->onReboot, VIR_DOMAIN_LIFECYCLE_RESTART) < 0)
Index: src/nodeinfo.c
===================================================================
RCS file: /data/cvs/libvirt/src/nodeinfo.c,v
retrieving revision 1.17
diff -u -p -r1.17 nodeinfo.c
--- src/nodeinfo.c 20 Jan 2009 17:13:33 -0000 1.17
+++ src/nodeinfo.c 30 Mar 2009 11:47:05 -0000
@@ -74,8 +74,8 @@ int linuxNodeInfoCPUPopulate(virConnectP
buf++;
if (*buf != ':') {
virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
- VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "parsing cpuinfo processor");
+ VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
+ "%s", _("parsing cpuinfo processor"));
return -1;
}
nodeinfo->cpus++;
@@ -87,8 +87,8 @@ int linuxNodeInfoCPUPopulate(virConnectP
buf++;
if (*buf != ':' || !buf[1]) {
virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
- VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "parsing cpuinfo cpu MHz");
+ VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
+ "%s", _("parsing cpuinfo cpu MHz"));
return -1;
}
if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0
@@ -103,8 +103,8 @@ int linuxNodeInfoCPUPopulate(virConnectP
buf++;
if (*buf != ':' || !buf[1]) {
virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
- VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "parsing cpuinfo cpu cores %c", *buf);
+ VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
+ "parsing cpuinfo cpu cores %c", *buf);
return -1;
}
if (virStrToLong_ui(buf+1, &p, 10, &id) == 0
@@ -116,8 +116,8 @@ int linuxNodeInfoCPUPopulate(virConnectP
if (!nodeinfo->cpus) {
virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
- VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "no cpus found");
+ VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
+ "%s", _("no cpus found"));
return -1;
}
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.253
diff -u -p -r1.253 xend_internal.c
--- src/xend_internal.c 10 Mar 2009 11:13:32 -0000 1.253
+++ src/xend_internal.c 30 Mar 2009 11:47:06 -0000
@@ -5540,6 +5540,11 @@ xenDaemonFormatSxpr(virConnectPtr conn,
virBufferAddLit(&buf, ")"); /* closes (vm */
+ if (virBufferError(&buf)) {
+ virReportOOMError(conn);
+ return NULL;
+ }
+
return virBufferContentAndReset(&buf);
error:
Index: tests/sexpr2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmltest.c,v
retrieving revision 1.36
diff -u -p -r1.36 sexpr2xmltest.c
--- tests/sexpr2xmltest.c 29 Jan 2009 17:02:00 -0000 1.36
+++ tests/sexpr2xmltest.c 30 Mar 2009 11:47:06 -0000
@@ -64,7 +64,8 @@ static int testCompareFiles(const char *
fail:
free(gotxml);
virDomainDefFree(def);
- virUnrefConnect(conn);
+ if (conn)
+ virUnrefConnect(conn);
return ret;
}
@@ -115,6 +116,7 @@ mymain(int argc, char **argv)
#define DO_TEST(in, out, version) \
do { \
struct testInfo info = { in, out, version }; \
+ virResetLastError(); \
if (virtTestRun("Xen SEXPR-2-XML " in " -> " out, \
1, testCompareHelper, &info) < 0) \
ret = -1; \
@@ -163,6 +165,8 @@ mymain(int argc, char **argv)
DO_TEST("fv-sound", "fv-sound", 1);
DO_TEST("fv-sound-all", "fv-sound-all", 1);
+ virCapabilitiesFree(caps);
+
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
Index: tests/testutils.c
===================================================================
RCS file: /data/cvs/libvirt/tests/testutils.c,v
retrieving revision 1.26
diff -u -p -r1.26 testutils.c
--- tests/testutils.c 2 Feb 2009 20:35:14 -0000 1.26
+++ tests/testutils.c 30 Mar 2009 11:47:06 -0000
@@ -409,7 +435,8 @@ int virtTestMain(int argc,
/* Run once for each alloc, failing a different one
and validating that the test case failed */
for (n = 0; n < approxAlloc && (!mp || worker) ; n++) {
- if ((n % mp) != (worker - 1))
+ if (mp &&
+ (n % mp) != (worker - 1))
continue;
if (!testDebug) {
if (mp)
Index: tests/xml2sexprtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprtest.c,v
retrieving revision 1.34
diff -u -p -r1.34 xml2sexprtest.c
--- tests/xml2sexprtest.c 23 Jan 2009 01:48:47 -0000 1.34
+++ tests/xml2sexprtest.c 30 Mar 2009 11:47:06 -0000
@@ -95,6 +95,7 @@ mymain(int argc, char **argv)
#define DO_TEST(in, out, name, version) \
do { \
struct testInfo info = { in, out, name, version }; \
+ virResetLastError(); \
if (virtTestRun("Xen XML-2-SEXPR " in " -> " out, \
1, testCompareHelper, &info) < 0) \
ret = -1; \
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
15 years, 8 months
[libvirt] [PATCH 0/2]: Cleanup driver initializers
by Chris Lalancette
All,
This is a small series to cleanup the internal driver initializers. The
drivers were using an annoying combination of C-99 style initialization and
old-style (C89?) initialization. On top of that, the indentation on some of
these was wacky, making it even harder to read. After some discussion with
DanB, we determined to go with the old-style initializers because it is sort of
a self-documenting TODO list. The first patch converts the internal drivers to
all use this style of initialization, and fixes up a few wrong comments along
the way. Note that this doesn't cleanup the storage or network initializers;
assuming this patch is acceptable, we can do those next.
The second patch rips out the internal "getURI" callbacks, since they were
never, ever used (and buggy to boot). More details in the second patch.
--
Chris Lalancette
15 years, 8 months
[libvirt] [PATCH 1/2] OpenNebula driver, libvirt-0.6.1
by "Abel Míguez Rodríguez"
Hi all,
We have updated the OpenNebula Driver to libvirt version 0.6.1.
Now, the ONE driver is build at the libvirtd daemon, that is the natural place for it.
Please feel free to make any comment, to improve the driver's coherence with libvirt's structure.
I split the Patches in two e-mais:
[PATCH 1/2] includes the patches to be applied to libvirt's sources and building files.
[PATCH 2/2] attached the "one driver" source files.
All
the patches are made to be applied at the git commit:
"025b62" (Fix subsystem lookup for older HAL releases)
Thanks,
Abel Miguez
diff --git a/configure.in b/configure.in
index 413d27c..fd75a8d 100644
--- a/configure.in
+++ b/configure.in
@@ -184,6 +184,8 @@ AC_ARG_WITH([openvz],
[ --with-openvz add OpenVZ support (on)],[],[with_openvz=yes])
AC_ARG_WITH([lxc],
[ --with-lxc add Linux Container support (on)],[],[with_lxc=yes])
+AC_ARG_WITH([one],
+[ --with-one add ONE support (on)],[],[with_one=no])
AC_ARG_WITH([test],
[ --with-test add test driver support (on)],[],[with_test=yes])
AC_ARG_WITH([remote],
@@ -399,6 +401,17 @@ dnl check for kvm headers
dnl
AC_CHECK_HEADERS([linux/kvm.h])
+dnl OpenNebula driver Compilation setting
+dnl
+
+if test "$with_one" = "yes" ; then
+ LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_ONE -I$ONE_LOCATION/include"
+
ONE_LIBS="-L/usr/local/lib -lxmlrpc_client++ -lxmlrpc -lxmlrpc_util
-lxmlrpc_xmlparse -lxmlrpc_xmltok -lxmlrpc++ -lxmlrpc_client
-L$ONE_LOCATION/lib -loneapi"
+ AC_SUBST([ONE_LIBS])
+ AC_DEFINE_UNQUOTED([WITH_ONE],1,[whether Open Nebula Driver is enabled])
+fi
+AM_CONDITIONAL([WITH_ONE],[test "$with_one" = "yes"])
+
dnl Need to test if pkg-config exists
PKG_PROG_PKG_CONFIG
@@ -1345,6 +1358,7 @@ AC_MSG_NOTICE([ QEMU: $with_qemu])
AC_MSG_NOTICE([ UML: $with_uml])
AC_MSG_NOTICE([ OpenVZ: $with_openvz])
AC_MSG_NOTICE([ LXC: $with_lxc])
+AC_MSG_NOTICE([ ONE: $with_one])
AC_MSG_NOTICE([ Test: $with_test])
AC_MSG_NOTICE([ Remote: $with_remote])
AC_MSG_NOTICE([ Network: $with_network])
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 2c3777d..cc98e45 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -61,6 +61,7 @@ typedef enum {
VIR_FROM_UML, /* Error at the UML driver */
VIR_FROM_NODEDEV, /* Error from node device monitor */
VIR_FROM_XEN_INOTIFY, /* Error from xen inotify layer */
+ VIR_FROM_ONE, /* Error from ONE driver */
VIR_FROM_SECURITY, /* Error from security framework */
} virErrorDomain;
diff --git a/qemud/Makefile.am b/qemud/Makefile.am
index 924e8ad..9d7f61f 100644
--- a/qemud/Makefile.am
+++ b/qemud/Makefile.am
@@ -120,6 +120,10 @@ if WITH_UML
libvirtd_LDADD += ../src/libvirt_driver_uml.la
endif
+if WITH_ONE
+ libvirtd_LDADD += ../src/libvirt_driver_one.la
+endif
+
if WITH_STORAGE_DIR
libvirtd_LDADD += ../src/libvirt_driver_storage.la
endif
diff --git a/qemud/qemud.c b/qemud/qemud.c
index 4f04355..e1d6113 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -78,6 +78,9 @@
#ifdef WITH_NETWORK
#include "network_driver.h"
#endif
+#ifdef WITH_ONE
+#include "one_driver.h"
+#endif
#ifdef WITH_STORAGE_DIR
#include "storage_driver.h"
#endif
@@ -841,6 +844,8 @@ static struct qemud_server *qemudInitialize(int sigread) {
virDriverLoadModule("qemu");
virDriverLoadModule("lxc");
virDriverLoadModule("uml");
+ virDriverLoadModule("one");
+
#else
#ifdef WITH_NETWORK
networkRegister();
@@ -861,6 +866,10 @@ static struct qemud_server *qemudInitialize(int sigread) {
#ifdef WITH_UML
umlRegister();
#endif
+#ifdef WITH_ONE
+ oneRegister ();
+#endif
+
#endif
virEventRegisterImpl(virEventAddHandleImpl,
diff --git a/src/Makefile.am b/src/Makefile.am
index d5aac11..a5c2084 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -137,6 +137,10 @@ UML_DRIVER_SOURCES = \
uml_conf.c uml_conf.h \
uml_driver.c uml_driver.h
+ONE_DRIVER_SOURCES = \
+ one_conf.c one_conf.h \
+ one_driver.c one_driver.h
+
NETWORK_DRIVER_SOURCES = \
network_driver.h network_driver.c
@@ -314,6 +318,22 @@ endif
libvirt_driver_uml_la_SOURCES = $(UML_DRIVER_SOURCES)
endif
+if WITH_ONE
+if WITH_DRIVER_MODULES
+mod_LTLIBRARIES += libvirt_driver_one.la
+else
+noinst_LTLIBRARIES += libvirt_driver_one.la
+# Stateful, so linked to daemon instead
+#libvirt_la_LIBADD += libvirt_driver_one.la
+endif
+libvirt_driver_one_la_LDFLAGS = $(ONE_LIBS)
+libvirt_driver_one_la_CFLAGS = "-DWITH_ONE"
+if WITH_DRIVER_MODULES
+libvirt_driver_one_la_LDFLAGS += -module -avoid-version
+endif
+libvirt_driver_one_la_SOURCES = $(ONE_DRIVER_SOURCES)
+endif
+
if WITH_NETWORK
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_network.la
@@ -402,6 +422,7 @@ EXTRA_DIST += \
$(QEMU_DRIVER_SOURCES) \
$(LXC_DRIVER_SOURCES) \
$(UML_DRIVER_SOURCES) \
+ $(ONE_DRIVER_SOURCES) \
$(OPENVZ_DRIVER_SOURCES) \
$(NETWORK_DRIVER_SOURCES) \
$(STORAGE_DRIVER_SOURCES) \
diff --git a/src/domain_conf.c b/src/domain_conf.c
index 5bf3483..e4d3249 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -54,7 +54,9 @@ VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST,
"ldom",
"test",
"vmware",
- "hyperv")
+ "hyperv",
+ "one")
+
VIR_ENUM_IMPL(virDomainBoot, VIR_DOMAIN_BOOT_LAST,
"fd",
diff --git a/src/domain_conf.h b/src/domain_conf.h
index dd61467..e8a2bff 100644
--- a/src/domain_conf.h
+++ b/src/domain_conf.h
@@ -48,6 +48,7 @@ enum virDomainVirtType {
VIR_DOMAIN_VIRT_TEST,
VIR_DOMAIN_VIRT_VMWARE,
VIR_DOMAIN_VIRT_HYPERV,
+ VIR_DOMAIN_VIRT_ONE,
VIR_DOMAIN_VIRT_LAST,
};
diff --git a/src/driver.h b/src/driver.h
index 62d6fbc..ed3eef7 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -20,6 +20,7 @@ typedef enum {
VIR_DRV_OPENVZ = 5,
VIR_DRV_LXC = 6,
VIR_DRV_UML = 7,
+ VIR_DRV_ONE = 8,
} virDrvNo;
diff --git a/src/libvirt.c b/src/libvirt.c
index bf3453a..cd4b5b7 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -830,6 +830,10 @@ virGetVersion(unsigned long *libVer, const char *type,
if (STRCASEEQ(type, "OpenVZ"))
*typeVer = LIBVIR_VERSION_NUMBER;
#endif
+#if WITH_ONE
+ if (STRCASEEQ(type, "ONE"))
+ *typeVer = LIBVIR_VERSION_NUMBER;
+#endif
#if WITH_UML
if (STRCASEEQ(type, "UML"))
*typeVer = LIBVIR_VERSION_NUMBER;
----
Distributed System Architecture Group
(http://dsa-research.org)
GridWay, http://www.gridway.org
OpenNEbula, http://www.opennebula.org
15 years, 8 months
[libvirt] KVM update
by Zvi Dubitzky
I am trying to update the kvm driver and userspace using existing kernel
1) using the tar ball from kvm at sourceforge I can do it , but only kvm
-84 is there
2) if i try the latest version from the git tree I am able to do the first
2 steps (make --kerneldir=<exisitng kernel headers> , make sync )
. but the final make fails during compile of libkvm.c. results in
the file below (dated 3/29/09)
Am I missing something Should I recompile the whole kerenl as a
3) Was the live migrate fixed and tested in the latest kernel version
thanks
Zvi Dubitzky
Virtualization and System Architecture Email:dubi@il.ibm.com
IBM Haifa Research Laboratory Phone: +972-4-8296182
Haifa, 31905, ISRAEL
15 years, 8 months