[libvirt] [PATCH 1/2] VirtualBox support

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

 



Hi All,

I have attached a patch which when applied on the HEAD as of today would allow 
virtualbox support in libvirt. It takes cares of all the stuff mentioned on 
the list earlier. Still if I have missed anything, please do tell me.

The patch works very well with the VirtualBox OSE version and the 2.2 release.

[PATCH 1/2] contains diff of files already in libvirt.
[PATCH 2/2] contains new files needed for VirtualBox support.

Regards,
Pritesh
commit 52462104988fc1bcbe62833fb8ea7e759e903e27
Author: Pritesh Kothari <Pritesh.Kothari@xxxxxxx>
Date:   Wed Apr 8 12:13:16 2009 +0200

    patch0

diff --git a/configure.in b/configure.in
index ac2c89e..8f4d9bb 100644
--- a/configure.in
+++ b/configure.in
@@ -182,6 +182,8 @@ AC_ARG_WITH([uml],
 [  --with-uml              add UML support (on)],[],[with_uml=yes])
 AC_ARG_WITH([openvz],
 [  --with-openvz           add OpenVZ support (on)],[],[with_openvz=yes])
+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([test],
@@ -277,6 +279,11 @@ if test "$with_openvz" = "yes"; then
 fi
 AM_CONDITIONAL([WITH_OPENVZ], [test "$with_openvz" = "yes"])
 
+if test "x$with_vbox" = "xyes"; then
+    AC_DEFINE_UNQUOTED([WITH_VBOX], 1, [whether VirtualBox driver is enabled])
+fi
+AM_CONDITIONAL([WITH_VBOX], [test "$with_vbox" = "yes"])
+
 if test "$with_libvirtd" = "no" ; then
   with_lxc=no
 fi
@@ -1362,6 +1369,7 @@ AC_MSG_NOTICE([   Proxy: $with_xen_proxy])
 AC_MSG_NOTICE([    QEMU: $with_qemu])
 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([    Test: $with_test])
 AC_MSG_NOTICE([  Remote: $with_remote])
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 2c3777d..faf3f61 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -62,6 +62,7 @@ typedef enum {
     VIR_FROM_NODEDEV, /* Error from node device monitor */
     VIR_FROM_XEN_INOTIFY, /* Error from xen inotify layer */
     VIR_FROM_SECURITY,  /* Error from security framework */
+    VIR_FROM_VBOX,    /* Error from VirtualBox driver */
 } virErrorDomain;
 
 
diff --git a/src/Makefile.am b/src/Makefile.am
index f176b46..abc825d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -129,6 +129,11 @@ OPENVZ_DRIVER_SOURCES =						\
 		openvz_conf.c openvz_conf.h			\
 		openvz_driver.c openvz_driver.h
 
+VBOX_DRIVER_SOURCES =                                 \
+        vbox/vbox_XPCOMCGlue.c vbox/vbox_XPCOMCGlue.h \
+        vbox/vbox_driver.c vbox/vbox_driver.h         \
+        vbox/vbox_V2_2.c
+
 QEMU_DRIVER_SOURCES =						\
 		qemu_conf.c qemu_conf.h				\
 		qemu_driver.c qemu_driver.h
@@ -271,6 +276,19 @@ endif
 libvirt_driver_openvz_la_SOURCES = $(OPENVZ_DRIVER_SOURCES)
 endif
 
+if WITH_VBOX
+if WITH_DRIVER_MODULES
+mod_LTLIBRARIES += libvirt_driver_vbox.la
+else
+noinst_LTLIBRARIES += libvirt_driver_vbox.la
+libvirt_la_LIBADD += libvirt_driver_vbox.la
+endif
+if WITH_DRIVER_MODULES
+libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version
+endif
+libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES)
+endif
+
 if WITH_QEMU
 if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_qemu.la
@@ -410,6 +428,7 @@ EXTRA_DIST +=							\
 		$(LXC_DRIVER_SOURCES)				\
 		$(UML_DRIVER_SOURCES)				\
 		$(OPENVZ_DRIVER_SOURCES)			\
+		$(VBOX_DRIVER_SOURCES)				\
 		$(NETWORK_DRIVER_SOURCES)			\
 		$(STORAGE_DRIVER_SOURCES)			\
 		$(STORAGE_DRIVER_FS_SOURCES)			\
diff --git a/src/domain_conf.c b/src/domain_conf.c
index 2c339af..cfb8bc5 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -54,7 +54,8 @@ VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST,
               "ldom",
               "test",
               "vmware",
-              "hyperv")
+              "hyperv",
+              "vbox")
 
 VIR_ENUM_IMPL(virDomainBoot, VIR_DOMAIN_BOOT_LAST,
               "fd",
diff --git a/src/domain_conf.h b/src/domain_conf.h
index dd61467..f4eea6b 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_VBOX,
 
     VIR_DOMAIN_VIRT_LAST,
 };
diff --git a/src/driver.h b/src/driver.h
index 88c2b0a..39dc413 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_VBOX = 8,
 } virDrvNo;
 
 
diff --git a/src/libvirt.c b/src/libvirt.c
index d6de773..f79ea5c 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -55,6 +55,9 @@
 #ifdef WITH_OPENVZ
 #include "openvz_driver.h"
 #endif
+#ifdef WITH_VBOX
+#include "vbox/vbox_driver.h"
+#endif
 #endif
 
 #define VIR_FROM_THIS VIR_FROM_NONE
@@ -306,6 +309,7 @@ virInitialize(void)
     virDriverLoadModule("test");
     virDriverLoadModule("xen");
     virDriverLoadModule("openvz");
+    virDriverLoadModule("vbox");
     virDriverLoadModule("remote");
 #else
 #ifdef WITH_TEST
@@ -317,6 +321,9 @@ virInitialize(void)
 #ifdef WITH_OPENVZ
     if (openvzRegister() == -1) return -1;
 #endif
+#ifdef WITH_VBOX
+    if (vboxRegister() == -1) return -1;
+#endif
 #ifdef WITH_REMOTE
     if (remoteRegister () == -1) return -1;
 #endif
@@ -830,6 +837,10 @@ virGetVersion(unsigned long *libVer, const char *type,
         if (STRCASEEQ(type, "OpenVZ"))
             *typeVer = LIBVIR_VERSION_NUMBER;
 #endif
+#if WITH_VBOX
+        if (STRCASEEQ(type, "VBox"))
+            *typeVer = LIBVIR_VERSION_NUMBER;
+#endif
 #if WITH_UML
         if (STRCASEEQ(type, "UML"))
             *typeVer = LIBVIR_VERSION_NUMBER;
diff --git a/src/virterror.c b/src/virterror.c
index d2514db..b4e5e3d 100644
--- a/src/virterror.c
+++ b/src/virterror.c
@@ -153,6 +153,8 @@ static const char *virErrorDomainName(virErrorDomain domain) {
             break;
         case VIR_FROM_SECURITY:
             dom = "Security Labeling ";
+        case VIR_FROM_VBOX:
+            dom = "VBOX ";
             break;
     }
     return(dom);
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]