[libvirt] [Patch v5] Add VMware Workstation and Player driver

2010-12-17 Thread Jean-Baptiste Rouault
* Changes since v4:
Fix a bug and a memory leak in vmwareParsePath()
Remove domainSave/Restore functions because more work is needed on them

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [Patch v5] Add VMware Workstation and Player driver

2010-12-17 Thread Jean-Baptiste Rouault
---
 cfg.mk  |1 +
 configure.ac|7 +
 include/libvirt/virterror.h |1 +
 po/POTFILES.in  |2 +
 src/Makefile.am |   24 +-
 src/driver.h|3 +-
 src/libvirt.c   |   13 +
 src/util/virterror.c|3 +
 src/vmware/vmware_conf.c|  500 +
 src/vmware/vmware_conf.h|   83 
 src/vmware/vmware_driver.c  | 1013 +++
 src/vmware/vmware_driver.h  |   25 +
 12 files changed, 1671 insertions(+), 4 deletions(-)
 create mode 100644 src/vmware/vmware_conf.c
 create mode 100644 src/vmware/vmware_conf.h
 create mode 100644 src/vmware/vmware_driver.c
 create mode 100644 src/vmware/vmware_driver.h

diff --git a/cfg.mk b/cfg.mk
index bda8c57..03186b3 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -388,6 +388,7 @@ msg_gen_function += virXMLError
 msg_gen_function += virXenInotifyError
 msg_gen_function += virXenStoreError
 msg_gen_function += virXendError
+msg_gen_function += vmwareError
 msg_gen_function += xenapiSessionErrorHandler
 msg_gen_function += xenUnifiedError
 msg_gen_function += xenXMError
diff --git a/configure.ac b/configure.ac
index 64e76dc..5ec524d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -227,6 +227,8 @@ AC_ARG_WITH([uml],
   AC_HELP_STRING([--with-uml], [add UML support 
@:@default=check@:@]),[],[with_uml=check])
 AC_ARG_WITH([openvz],
   AC_HELP_STRING([--with-openvz], [add OpenVZ support 
@:@default=yes@:@]),[],[with_openvz=yes])
+AC_ARG_WITH([vmware],
+  AC_HELP_STRING([--with-vmware], [add VMware support 
@:@default=yes@:@]),[],[with_vmware=yes])
 AC_ARG_WITH([libssh2],
   AC_HELP_STRING([--with-libssh2=@:@PFX@:@], [libssh2 location 
@:@default=/usr/local/lib@:@]),[],[with_libssh2=yes])
 AC_ARG_WITH([phyp],
@@ -316,6 +318,10 @@ if test $with_openvz = yes; then
 fi
 AM_CONDITIONAL([WITH_OPENVZ], [test $with_openvz = yes])
 
+if test $with_vmware = yes; then
+AC_DEFINE_UNQUOTED([WITH_VMWARE], 1, [whether VMware driver is enabled])
+fi
+AM_CONDITIONAL([WITH_VMWARE], [test $with_vmware = yes])
 
 dnl
 dnl check for XDR
@@ -2277,6 +2283,7 @@ AC_MSG_NOTICE([ Xen: $with_xen])
 AC_MSG_NOTICE([QEMU: $with_qemu])
 AC_MSG_NOTICE([ UML: $with_uml])
 AC_MSG_NOTICE([  OpenVZ: $with_openvz])
+AC_MSG_NOTICE([  VMware: $with_vmware])
 AC_MSG_NOTICE([VBox: $with_vbox])
 AC_MSG_NOTICE([  XenAPI: $with_xenapi])
 AC_MSG_NOTICE([ LXC: $with_lxc])
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index eaeb477..a1f88f4 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -52,6 +52,7 @@ typedef enum {
 VIR_FROM_TEST, /* Error from test driver */
 VIR_FROM_REMOTE,   /* Error from remote driver */
 VIR_FROM_OPENVZ,/* Error from OpenVZ driver */
+VIR_FROM_VMWARE,/* Error from VMware driver */
 VIR_FROM_XENXM,/* Error at Xen XM layer */
 VIR_FROM_STATS_LINUX,/* Error in the Linux Stats code */
 VIR_FROM_LXC,   /* Error from Linux Container driver */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e7be0d3..5561ace 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -100,6 +100,8 @@ src/util/xml.c
 src/vbox/vbox_XPCOMCGlue.c
 src/vbox/vbox_driver.c
 src/vbox/vbox_tmpl.c
+src/vmware/vmware_conf.c
+src/vmware/vmware_driver.c
 src/xen/xen_driver.c
 src/xen/xen_hypervisor.c
 src/xen/xen_inotify.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 196d8af..8bab5e2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -219,8 +219,6 @@ check-local: remote_protocol-structs
 TEST_DRIVER_SOURCES =  \
test/test_driver.c test/test_driver.h
 
-
-
 # Now the Hypervisor specific drivers
 XEN_DRIVER_SOURCES =   \
xen/sexpr.c xen/sexpr.h \
@@ -256,6 +254,10 @@ OPENVZ_DRIVER_SOURCES =
\
openvz/openvz_conf.c openvz/openvz_conf.h   \
openvz/openvz_driver.c openvz/openvz_driver.h
 
+VMWARE_DRIVER_SOURCES =\
+   vmware/vmware_driver.c vmware/vmware.h  \
+   vmware/vmware_conf.c vmware/vmware_conf.h
+
 VBOX_DRIVER_SOURCES =  \
 vbox/vbox_XPCOMCGlue.c vbox/vbox_XPCOMCGlue.h  \
 vbox/vbox_driver.c vbox/vbox_driver.h  \
@@ -601,6 +603,21 @@ endif
 libvirt_driver_openvz_la_SOURCES = $(OPENVZ_DRIVER_SOURCES)
 endif
 
+if WITH_VMWARE
+if WITH_DRIVER_MODULES
+mod_LTLIBRARIES += libvirt_driver_vmware.la
+else
+noinst_LTLIBRARIES += libvirt_driver_vmware.la
+libvirt_la_BUILT_LIBADD += libvirt_driver_vmware.la
+endif
+libvirt_driver_vmware_la_CFLAGS = \
+   -...@top_srcdir@/src/conf
+if WITH_DRIVER_MODULES
+libvirt_driver_vmware_la_LDFLAGS = -module -avoid-version
+endif

Re: [libvirt] [Patch v5] Add VMware Workstation and Player driver

2010-12-17 Thread Matthias Bolte
2010/12/17 Jean-Baptiste Rouault jean-baptiste.roua...@diateam.net:
 ---

 +int
 +vmwareLoadDomains(struct vmware_driver *driver)
 +{

 +        vmwareDomainConfigDisplay(pDomain, vmdef);
 +
 +        if ((vm-def-id = vmwareExtractPid(vmxPath))  0)
 +            goto cleanup;
 +        //vmrun list only reports running vms
 +        vm-state = VIR_DOMAIN_RUNNING;
 +        vm-persistent = 1;

We prefer C over C++ style comments, so I'll change this comment to /*
*/ style before pushing.

ACK to v5, finally :)

I've pushed this now.

Now I'll move the VMX handling code from the ESX driver to the general
util directory to resolve this inter-driver dependency.

I'd suggest that you provide a patch to update the libvirt website and
include some info about the new driver.

Matthias

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list