[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/2] (Updated & fixed) OpenNebula driver, libvirt-0.6.2



Hi all,

Here is the One driver & patches for the current git's master commit "9e9527 - Remove stale QEMU pidfiles".

[PATCH 1/2] Patch to be applied to libvirt-0.6.2 sources and building files.
[PATCH 2/2] Driver source code.

Thanks for all the comments about the patches.
We waited for the libvirt's release to update the driver's structure to 0.6.2 and apply the improvements. 
Here is a short list of the main changes applied:

- Included driver's files in a different directory "src/opennebula"

- Added Capabilities "virCapabilitiesAddGuest" for "x86_64" and "i686" guests and used "one" as hypervisor at "virCapabilitiesAddGuestDomain".

- Instead creating a temporal file to send the VM definition we have updated the API we were using to being able to do everything in memory, so making use of "virBuffer" to create the VM definition Template.

- Added previously unsupported features to the ONE Template, other types of disks and graphics (vnc,sdl) settings.

- Fixed up warnings at compilation and make 'syntax-check' test passed.

thanks,
Abel Miguez.

[PATCH 1/2]

diff --git a/configure.in b/configure.in
index dcacc7f..ab14303 100644
--- a/configure.in
+++ b/configure.in
@@ -186,6 +186,8 @@ AC_ARG_WITH([vbox],
 [  --with-vbox             add VirtualBox support (on)],[],[with_vbox=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],
@@ -305,6 +307,11 @@ if test "$with_uml" = "yes" ; then
 fi
 AM_CONDITIONAL([WITH_UML], [test "$with_uml" = "yes"])
 
+if test "$with_one" = "yes" ; then
+    AC_DEFINE_UNQUOTED([WITH_ONE],1,[whether ONE driver is enabled])
+fi
+AM_CONDITIONAL([WITH_ONE],[test "$with_one" = "yes"])
+
 if test "$with_test" = "yes" ; then
     AC_DEFINE_UNQUOTED([WITH_TEST], 1, [whether Test driver is enabled])
 fi
@@ -406,6 +413,15 @@ dnl check for kvm headers
 dnl
 AC_CHECK_HEADERS([linux/kvm.h])
 
+dnl OpenNebula driver Compilation setting
+dnl
+
+if test "$with_one" = "yes" ; then
+ CFLAGS="$CFLAGS -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])
+fi
+
 dnl Need to test if pkg-config exists
 PKG_PROG_PKG_CONFIG
 
@@ -1372,6 +1388,7 @@ AC_MSG_NOTICE([     UML: $with_uml])
 AC_MSG_NOTICE([  OpenVZ: $with_openvz])
 AC_MSG_NOTICE([    VBox: $with_vbox])
 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 faf3f61..abe54b2 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -63,6 +63,7 @@ typedef enum {
     VIR_FROM_XEN_INOTIFY, /* Error from xen inotify layer */
     VIR_FROM_SECURITY,  /* Error from security framework */
     VIR_FROM_VBOX,    /* Error from VirtualBox driver */
+    VIR_FROM_ONE,	   /* Error from ONE driver */
 } 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 829a4bc..a069f38 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -75,6 +75,9 @@
 #ifdef WITH_UML
 #include "uml_driver.h"
 #endif
+#ifdef WITH_ONE
+#include "opennebula/one_driver.h"
+#endif
 #ifdef WITH_NETWORK
 #include "network_driver.h"
 #endif
@@ -841,6 +844,7 @@ static struct qemud_server *qemudInitialize(int sigread) {
     virDriverLoadModule("qemu");
     virDriverLoadModule("lxc");
     virDriverLoadModule("uml");
+    virDriverLoadModule("one");
 #else
 #ifdef WITH_NETWORK
     networkRegister();
@@ -861,6 +865,9 @@ 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 fd692b4..17ae0e7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -144,6 +144,12 @@ UML_DRIVER_SOURCES =						\
 		uml_conf.c uml_conf.h				\
 		uml_driver.c uml_driver.h
 
+ONE_DRIVER_SOURCES =					\
+		./opennebula/one_conf.c			\
+		./opennebula/one_conf.h			\
+		./opennebula/one_driver.c		\
+		./opennebula/one_driver.h
+
 NETWORK_DRIVER_SOURCES =					\
 		network_driver.h network_driver.c
 
@@ -337,6 +342,25 @@ 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)
+
+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
@@ -429,6 +453,7 @@ EXTRA_DIST +=							\
 		$(QEMU_DRIVER_SOURCES)				\
 		$(LXC_DRIVER_SOURCES)				\
 		$(UML_DRIVER_SOURCES)				\
+		$(ONE_DRIVER_SOURCES)				\
 		$(OPENVZ_DRIVER_SOURCES)			\
 		$(VBOX_DRIVER_SOURCES)				\
 		$(NETWORK_DRIVER_SOURCES)			\
diff --git a/src/domain_conf.c b/src/domain_conf.c
index 648d9e9..06b9713 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -55,7 +55,8 @@ VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST,
               "test",
               "vmware",
               "hyperv",
-              "vbox")
+              "vbox",
+              "one")
 
 VIR_ENUM_IMPL(virDomainBoot, VIR_DOMAIN_BOOT_LAST,
               "fd",
diff --git a/src/domain_conf.h b/src/domain_conf.h
index f4eea6b..c91a245 100644
--- a/src/domain_conf.h
+++ b/src/domain_conf.h
@@ -49,6 +49,7 @@ enum virDomainVirtType {
     VIR_DOMAIN_VIRT_VMWARE,
     VIR_DOMAIN_VIRT_HYPERV,
     VIR_DOMAIN_VIRT_VBOX,
+    VIR_DOMAIN_VIRT_ONE,
 
     VIR_DOMAIN_VIRT_LAST,
 };
diff --git a/src/driver.h b/src/driver.h
index 39dc413..5685783 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -21,6 +21,7 @@ typedef enum {
     VIR_DRV_LXC = 6,
     VIR_DRV_UML = 7,
     VIR_DRV_VBOX = 8,
+    VIR_DRV_ONE = 9,
 } virDrvNo;
 
 
diff --git a/src/libvirt.c b/src/libvirt.c
index 95a861e..4b1610a 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -845,6 +845,10 @@ virGetVersion(unsigned long *libVer, const char *type,
         if (STRCASEEQ(type, "UML"))
             *typeVer = LIBVIR_VERSION_NUMBER;
 #endif
+#if WITH_ONE
+        if (STRCASEEQ(type, "ONE"))
+            *typeVer = LIBVIR_VERSION_NUMBER;
+#endif
 #if WITH_REMOTE
         if (STRCASEEQ(type, "Remote"))
             *typeVer = remoteVersion();
diff --git a/src/virterror.c b/src/virterror.c
index 2d34ed7..d4b429c 100644
--- a/src/virterror.c
+++ b/src/virterror.c
@@ -156,6 +156,8 @@ static const char *virErrorDomainName(virErrorDomain domain) {
             break;
         case VIR_FROM_VBOX:
             dom = "VBOX ";
+        case VIR_FROM_ONE:
+            dom = "ONE ";
             break;
     }
     return(dom);


----
 Distributed System Architecture Group  
 (http://dsa-research.org)

 GridWay, http://www.gridway.org
 OpenNEbula, http://www.opennebula.org





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]