10 October, 2008

Building Appliances without VMware Guest software

By default VMware Studio will build appliances with a number of software components added into the appliance itself. If you already build hardware appliances then you probably have most of your in-guest software needs already taken care of.

The software components that Studio adds into each VA it creates are:

- command line network and timezone setup
- EULA acceptance/handling
- a simple web GUI
- software update support
- CIM stack for managing the appliance (similar to SNMP)

All this is very useful stuff but not all of this is for everyone and each component has its own dependencies so keeping all that will add to virtual disk bloat.

So to take control of this you can customize the OS provisioning template (XSL) used to install the OS and apps on your appliances.

First login to the Studio web GUI and create an appliance and build it once. This will require a VMware Server instance and SSH service running on its host OS. Read the bundled developers guide to get you going. There are hoops to jump through but it's worth it :)

Once you have an appliance defined you can customize how the OS and applications are installed by copying & editing the OS provisioning template file.

Template files are found in the directory tree /opt/vmware/etc/build/templates/

For this example I'll assume you're building a Red Hat or CentOS-based appliance. The OS template used for this is redhat5.xsl, so copy that and edit the copy:


mkdir /root/templates

cp /opt/vmware/etc/build/profiles/redhat/5/redhat5.xsl \
/root/templates/custom_redhat5.xsl


(For Ubuntu and Suse builds the XSL file containing this shell code is called post.xsl, paired with ubuntu.xsl and suse.xsl)

The XSL template contains some shell code and we can simply delete the section that installs the guest software components. I've a diff here that shows what to delete:


root@localhost:~/templates# diff -u redhat5.xsl.orig redhat5.xsl
--- redhat5.xsl.orig 2008-10-10 11:04:52.000000000 -0700
+++ redhat5.xsl 2008-10-10 11:05:48.000000000 -0700
@@ -401,37 +401,6 @@
# Install VADK Guest software
#
installdir=/tmp/vabs; export installdir
-
-
-# create a sandbox
-mkdir -p $installdir
-
-# download packages
-wget $WGET_TIMEOUT -nv -nd --no-parent -r -A .deb,.rpm,.sh -l1 -P $installdir
-if [ $? -ne 0 ]
-then
- abort Downloading of VMware Studio runtime packages from failed.
-fi
-
-# search for install.sh bash files and execute them
-find $installdir -name install.sh |
-while read i
-do
- bash $i || abort Execution of VMware Studio runtime install.sh file failed.
-done
-
-#
-# Install all .rpm packages
-#
-pkglist=`find $installdir -name "*.rpm"`
-if [ "$pkglist" ]
-then
- rpm -Uvh $pkglist || abort Installation of VMware Studio runtime packages failed.
-fi
-
-# cleanup
-rm -rf $installdir
-


#
# Load ISV software


Now edit the appliance profile XML file to use this alternate OS provisioning template. Your profile is found in /opt/vmware/var/lib/build/profiles/

Edit the XML file and change the value of from the old /opt/vmare/etc/build/templates/redhat/5/redhat5.xsl to /root/templates/custom_redhat5.xsl

Save the XML file and fire off a build:

# vadkstudio -cvp /opt/vmare/var/lib/build/profiles/myappliance.xml

And hey look, the resulting VA has no extra guest software.

1 comment:

Unknown said...

Hi , I am getting below two problem, could you please help.
sukantasingur@gmail.com



Issue related to VMstudio build

1. stduiocli command throwing error when building via ssh

"Failure: Unable to reset process group id"

2. with help of vabs.pl we able create OVFs, but when trying to create OVA consists of four OVF, getting below error .

/opt/vmware/share/build/vabs.pl -c -p /opt/vmware/var/lib/build/vapp_profiles/RMS-Provisioning-Solution.xml
Using build instance name: RMS-Provisioning-Solution.5
Failure: Aborted by user or system intervention (signal Element '{http://www.vmware.com/schema/vadk}MultiVM': No matching global declaration available for the validation root.
was caught).
Cleaning up ...Build/Validation process has successfully aborted.