VMware Studio Tricks and Tips

Version 5

    1. Perl module installation through RPM

      1. You can able to install Perl module through command line, using  (perl Makefile.pl; make; make install), because all the required files  are present in the same folder.
      2. But all the Makefiles are not written with full absolute path. Due  to that while installing the Perl module through rpm you will get the  path not found or file not found errors, even that file exists in the  same folder.
      3. So workaround for this is; you can do the first two steps i.e. perl  Makefile.pl; make; manually in local system and then copy the whole dir  in rpm package. Don't do the make install step in your local machine.  Please make sure the local machine the guest OS should be same.
    Following is the procedure for one Perl module installation through RPM.
      • Download the perl-GD module from CPAN.
      • mkdir -p /root/perl-GD/perl-GD/
      • tar -xvf gd-2.44.tar -C /root/perl-GD/perl-GD/
      • perl Makefile.PL
      • make
      • cd /root/perl-GD/
      • tar -cvf gd-2.44-Update.tar perl-GD
      • Now you can use this tar file in building RPM package. Following are the entries in spec file. 
        • %post
        • tar -xvf gd-2.44-Update.tar -C /tmp/
        • cd /tmp/perl-GD/
        • make install

     

    2. How to set Windows environment variables.

    Following is the procedure.
      • Create one .bat file for windows executable.
      • Write setx command to set the variable in environvement variable. 
        • Eg. setx JAVA_HOME "C:\Program Files\Java\jdk1.5.0_06\bin"

     

    3. How to add firstboot script in Windows VA.

     

     

    1. Write the batch (.bat) program or VB script (.vbs) and put it inside  the C:\Documents and Settings\Administrator\Start Menu\Programs\Startup  folder.

     

    2. Write a command in the end to delete itself from given path.

     

     

     

     

     

    Following is the sample VB script, which will delete itself after first execution.

    'Store the data in file

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Set objTextFile = objFSO.CreateTextFile("c:\input.txt", True)

    sUserID1 = InputBox("Enter the Hostname :", "Hostname", "hostname")

    sUserID2 = InputBox("Enter the Port Number :", "PortNumber", "port number")

    sUserID = "hostname=" & sUserID1 & ",portNumber=" & sUserID2

    objTextFile.WriteLine "hostname=" & sUserID1

    objTextFile.WriteLine "portNumber=" & sUserID2

    'Delete the script from startup

    set filesys = CreateObject ("Scripting.FileSystemObject")

    set demofile = filesys.GetFile("C:\Documents and Settings\Administrator\Start Menu\Programs\Startup\question.vbs")

    demofile.Delete

     

    4. Adding Linux Management Service to Virtual Appliance

     

    You can refer the following URL to create Linux Management Service.

     

    http://blogs.vmware.com/vapp/2010/01/adding-linux-management-service-to-virtual-appliance.html

     

    Suppose in your Linux Management Service there is a index page which  contains static IP address. Then while booting the VA in different  environment you have to edit this page for IP address. To make it  automated you can add following script in your rpm.

     

    <snip>

     

    #!/usr/bin/perl

     

     

    $IP = $ARGV[0];

     

     

    open(FHO, "> /tmp/index.html ") || die "can't open file \n";

     

    open(FHI, "< /opt/vmware/share/htdocs/service/esxtop-service/index.html ") || die "can't open file index.html \n";

     

    while ($line = <FHI>) {

     

    chomp $line;

     

    $line =~ s/(\d+)\.(\d+)\.(\d+)\.(\d+)/$IP/ ;

     

    print FHO "$line\n" ;

     

    }

     

    close(FHI);

     

    close(FHO);

     

    system("mv /tmp/index.html /opt/vmware/share/htdocs/service/esxtop-service/index.html");

     

    </snip>

     

     

    And you can call this program from first and subsequent boot as follows:

     

     

    <snip>

     

    cat /opt/vmware/share/htdocs/service/esxtop-service/index.html | grep -x $IP

     

    if \[ "$?" -eq $SUCCESS ]

     

    then

     

    echo "Nothing to change"

     

    else

     

    perl /ISV_Validation/other/changeIP_Management_Index.pl $IP

     

    fi

     

    </snip>

     


    5. How to build VA with VmxNet3 type?

    We can just change it in the build profile located in  /opt/vmware/var/lib/build/profiles/ directory, change the  ResourceSubtype from PCNet32 to VmxNet3. The generated OVF will have the  change. Of course you do need to ensure that Hardware version 7 is  chosen.

    Ref: http://communities.vmware.com/thread/247138

    6. Configuring high memory for Guest OS in VMWare Studio

    Edit /opt/vmware/share/ovftool/env/ovftool-hw4-config-option.xml, go to  line 2444, change <max>3600</max> to say  <max>65536</max> (for 64GB max limit).

    Edit /opt/vmware/share/ovftool/env/ovftool-hw7-config-option.xml, go
    to line 2541, change <max>8192</max> to say
    <max>261120</max> (for 255GB max limit).

    Now try building your appliance with either hardware version 4 or 7 and  see if you could get pass the 3.6GB and 8GB limitation before.

    Ref: http://communities.vmware.com/thread/244562

    7. Tuning tips for Provisioning with VMware Studio

    http://communities.vmware.com/message/1608611#1608611