From 1c873e30673d936f2789e3978cd6ed5f753cbb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantino=20V=C3=A1zquez=20Blanco?= Date: Thu, 7 May 2009 13:13:54 +0000 Subject: [PATCH] Added installation procedure for VMWare drivers git-svn-id: http://svn.opennebula.org/one/trunk@513 3034c82b-c49b-4eb3-8279-a7acafdc01c0 --- src/im_mad/vmware/one_im_vmware | 4 +- src/vmm_mad/vmware/OneVmmVmware.java | 64 +++++++++++++++++++++++++++- src/vmm_mad/vmware/Readme | 48 +++++++++++++++++++++ src/vmm_mad/vmware/install-vmware.sh | 30 +++++++++++++ src/vmm_mad/vmware/one_vmm_vmware | 4 +- src/vmm_mad/vmware/vmm_vmware.conf | 0 src/vmm_mad/vmware/vmm_vmwarerc | 24 +++++++++++ 7 files changed, 169 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/im_mad/vmware/one_im_vmware create mode 100644 src/vmm_mad/vmware/Readme create mode 100755 src/vmm_mad/vmware/install-vmware.sh create mode 100644 src/vmm_mad/vmware/vmm_vmware.conf create mode 100644 src/vmm_mad/vmware/vmm_vmwarerc diff --git a/src/im_mad/vmware/one_im_vmware b/src/im_mad/vmware/one_im_vmware old mode 100644 new mode 100755 index 4fc7b94b25..e4d3f2e5ce --- a/src/im_mad/vmware/one_im_vmware +++ b/src/im_mad/vmware/one_im_vmware @@ -47,9 +47,9 @@ fi # Execute the actual MAD if [ -n "${ONE_MAD_DEBUG}" ]; then - exec nice -n $PRIORITY java -cp .:$CLASSPATH -Djavax.net.ssl.trustStore=$VMWARE_TRUSTORE -Xmx1024M $MAD_FILE $* 2>> $MAD_LOG_PATH + exec nice -n $PRIORITY java -cp $ONE_LOCATION/lib/mads:$CLASSPATH -Djavax.net.ssl.trustStore=$VMWARE_TRUSTORE -Xmx1024M $MAD_FILE $* 2>> $MAD_LOG_PATH else - exec nice -n $PRIORITY java -cp .:$CLASSPATH -Djavax.net.ssl.trustStore=$VMWARE_TRUSTORE -Xmx1024M $MAD_FILE $* 2> /dev/null + exec nice -n $PRIORITY java -cp $ONE_LOCATION/lib/mads:$CLASSPATH -Djavax.net.ssl.trustStore=$VMWARE_TRUSTORE -Xmx1024M $MAD_FILE $* 2> /dev/null fi diff --git a/src/vmm_mad/vmware/OneVmmVmware.java b/src/vmm_mad/vmware/OneVmmVmware.java index 6ca4648aa8..7d770fd8dd 100644 --- a/src/vmm_mad/vmware/OneVmmVmware.java +++ b/src/vmm_mad/vmware/OneVmmVmware.java @@ -539,7 +539,69 @@ class OneVmmVmware extends Thread continue; } - } // if (action.equals("MIGRATE")) + } // if (action.equals("MIGRATE")) + + if (action.equals("POLL")) + { + if (str_split.length < 4) + { + System.out.println("FAILURE Wrong number of arguments for POLL " + + "action. Number args = [" + str_split.length + "]."); + synchronized (System.err) + { + System.err.println(action + " FAILURE " + vid_str); + continue; + } + } + else + { + vid_str = str_split[1]; + hostName = str_split[2]; + String vmName = str_split[3]; + + // First, create the checkpoint + + try + { + oVM = new OperationsOverVM(arguments,hostName); + } + catch(Exception e) + { + synchronized (System.err) + { + System.err.println(action + " FAILURE " + vid_str + " Failed connection to host " + + hostName +". Reason: " + e.getMessage()); + if(debug) + { + e.printStackTrace(); + } + } + continue; + } + + // Poll the VM + + /* if(!oVM.pollVM(vmName,checkpointName)) + { + synchronized (System.err) + { + System.err.println(action + " FAILURE " + vid_str + " Failed restoring VM [" + + vmName + "] in host " + destHostName); + } + } + else + { + synchronized (System.err) + { + System.err.println(action + " SUCCESS " + vid_str); + } + }*/ + + System.err.println(action + " SUCCESS " + vid_str + "USEDCPU=1 USEDMEMORY=256"); + + continue; + } + } // if (action.equals("POLL")) } // else if (action.equals("FINALIZE")) } // while(!fin) } // loop diff --git a/src/vmm_mad/vmware/Readme b/src/vmm_mad/vmware/Readme new file mode 100644 index 0000000000..6029ec8a33 --- /dev/null +++ b/src/vmm_mad/vmware/Readme @@ -0,0 +1,48 @@ +/* + * Install instructions for VMWare OpenNebula drivers. Please note that these drivers are in an early stage, + * please submit found bugs or doubts to users@opennebula.org mailing list + */ + +1. Install OpenNebula in self-contained mode (specifying the -d option in the install.sh) +2. Install the VMWare VI SDK from [1] +3. Configure the VMWare VI SDK following [2]. You should end up with a keystore containing VMWare certificates installed in the home folder. +4. Install Apache Axis 1.4 [3] +5. Add all jars in $AXISHOME/lib and $SDKHOME/samples/Axis/java/lib/ to CLASSPATH +6. Go to OpenNebula source code directory and navigate to src/vmm_mad/vmware. Run the install-vmware.sh script. +7. Edit $ONE_LOCATION/etc/oned.conf and enable the tm_dummy TM MAD removing the leading # from each line. Also, add the following two MADs for VMWare: + +#------------------------------------------------------------------------------- +# VMWare Information Driver Manager sample configuration +#------------------------------------------------------------------------------- + IM_MAD = [ + name = "im_vmware", + executable = "one_im_vmware", + arguments = "--username --password ", + default = "im_vmware/im_vmware.conf" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# VMWare Virtualization Driver Manager sample configuration +#------------------------------------------------------------------------------- + VM_MAD = [ + name = "vmm_vmware", + executable = "one_vmm_vmware", + arguments = "--username --password ", + default = "vmm_eh/vmm_eh.conf", + type = "xml" ] +#------------------------------------------------------------------------------- + +8. Add ESXi hosts using the following drivers: + +$ onehost add im_vmware vmm_vmware tm_dummy + +9. Create VMWare VM using the VI client. This can be created in an ESXi server and then shared among others using VMFS or (ideally) NFS. Be careful with the name of the datastore where the VMs are residing, at this stage of the VMWare drivers for OpenNebula it only supports "datastore1" for the datastore and "ha-datacenter" for the datacenter. This is hardcoded in the drivers, but also is the default installation for ESXi. + +10. Create a VM template using the name used for the VM in the VI client in step 9 as the Name of the OpenNebula VM. +11. Submit using "onevm create" + +-- + +[1] http://www.vmware.com/support/developer/vc-sdk/ +[2] http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/visdk25setupguide.pdf +[3] http://ws.apache.org/axis/ \ No newline at end of file diff --git a/src/vmm_mad/vmware/install-vmware.sh b/src/vmm_mad/vmware/install-vmware.sh new file mode 100755 index 0000000000..e686086944 --- /dev/null +++ b/src/vmm_mad/vmware/install-vmware.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +if [ -z "${ONE_LOCATION}" ]; then + echo "ONE_LOCATION is not defined. Don't know where to copy, aborting." + exit -1 +fi + +echo -n "Installing VMWare drivers." + +javac OneVmmVmware.java +cp *class $ONE_LOCATION/lib/mads +cp one_vmm_vmware $ONE_LOCATION/bin + +cd ../../im_mad/vmware/ +javac OneImVmware.java +cp *class $ONE_LOCATION/lib/mads +cp one_im_vmware $ONE_LOCATION/bin +cd - + +echo -n "." + +mkdir $ONE_LOCATION/etc/im_vmware +mkdir $ONE_LOCATION/etc/vmm_vmware + +cp vmm_vmware.conf vmm_vmwarerc $ONE_LOCATION/etc/vmm_vmware +cp im_vmware.conf im_vmwarerc $ONE_LOCATION/etc/im_vmware + +echo "done" + + diff --git a/src/vmm_mad/vmware/one_vmm_vmware b/src/vmm_mad/vmware/one_vmm_vmware index 2038de84f3..2ce72294c3 100755 --- a/src/vmm_mad/vmware/one_vmm_vmware +++ b/src/vmm_mad/vmware/one_vmm_vmware @@ -52,9 +52,9 @@ fi ONE_MAD_DEBUG=neno # Execute the actual MAD if [ -n "${ONE_MAD_DEBUG}" ]; then - exec nice -n $PRIORITY java -cp .:$CLASSPATH -Djavax.net.ssl.trustStore=$VMWARE_TRUSTORE -Ddebug=$ONE_MAD_DEBUG -Xmx1024M $MAD_FILE $* 2>> $MAD_LOG_PATH + exec nice -n $PRIORITY java -cp $ONE_LOCATION/lib/mads:$CLASSPATH -Djavax.net.ssl.trustStore=$VMWARE_TRUSTORE -Ddebug=$ONE_MAD_DEBUG -Xmx1024M $MAD_FILE $* 2>> $MAD_LOG_PATH else - exec nice -n $PRIORITY java -cp .:$CLASSPATH -Djavax.net.ssl.trustStore=$VMWARE_TRUSTORE -Xmx1024M $MAD_FILE $* 2> /dev/null + exec nice -n $PRIORITY java -cp $ONE_LOCATION/lib/mads:$CLASSPATH -Djavax.net.ssl.trustStore=$VMWARE_TRUSTORE -Xmx1024M $MAD_FILE $* 2> /dev/null fi diff --git a/src/vmm_mad/vmware/vmm_vmware.conf b/src/vmm_mad/vmware/vmm_vmware.conf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vmm_mad/vmware/vmm_vmwarerc b/src/vmm_mad/vmware/vmm_vmwarerc new file mode 100644 index 0000000000..8265c36e3c --- /dev/null +++ b/src/vmm_mad/vmware/vmm_vmwarerc @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2009, Distributed Systems Architecture Group, Universidad # +# Complutense de Madrid (dsa-research.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +# This must point to a java keystore with appropriate certificates for accessing +# all the ESXi hosts +#VMWARE_TRUSTORE= + +# Uncomment the following line to active MAD debug +#ONE_MAD_DEBUG=1 +