0 Replies Latest reply on Apr 20, 2009 10:56 AM by lamw

    Not happy with VI API/RCLI ESXi 3.5u4 lockdown? Worry not, VMware VIX to the rescue ... for now =)

    lamw Guru
    Community WarriorsVMware Employees

      While browsing around the management API forum this morning, I stumbled across a question in the VMware VIX forum regarding the age old question "Will this API/Toolkit continue to work with ESXi 3.5u4 after the read-only fix"? I would have thought the answer was no, the VMware VIX API would be governed in the same manner as the VI API and you would need to have at least the Foundation license to have full read/write capabilities. To my surprise, that was not the case as Carter Shanklin responded in this thread:

       

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

       

       

      It's a separate API. Any licensing it did would have to be implemented within VIX, which is not really a priority. Some day (think far away) we'll be exposing VIX functionality through VI API, when that happens it will be subject to VI licensing.

       

       

      So it looks like for all those that enjoyed the RCLI for VM management, you still have an option of looking at VMware VIX and specifically the vmrun binary that is available. The VIX API has actually been around for sometime and I'm not an expert in the history but as of version 1.6.2, a pre-compiled binary was released which provides a way for a user to automate some basic tasks for virtual machine management so long as your VM(s) have VMware Tools installed and you're using at least ESX(i) 3.5u3+. The VIX API can be installed on both Windows and Linux and the neat thing about the tool is you can talk directly to an individual ESX(i) host or vCenter. There are some known issues like reverting snapshots, but this is definitely a very powerful tool in my mind to provide further management of your VM(s) and it's great to hear this will eventually be part of the standard VI API, makes it easier on developers to create tools/applications across a common API.

       

      Here is a quick list of available options (VMware VIX installed on VIMA):

       

      [vi-admin@vima ~]$ vmrun
      
      vmrun version 2.0.0 build-127388
      
      Usage: vmrun [AUTHENTICATION-FLAGS] COMMAND [PARAMETERS]
      
      
      
      AUTHENTICATION-FLAGS
      --------------------
      These must appear before the command and any command parameters.
      
         -h <hostName>  (not needed for Workstation)
         -P <hostPort>  (not needed for Workstation)
         -T <hostType> (ws|server|server1)
           for example, use '-T server' for Server 2.0
                        use '-T server1' for Server 1.0
         -u <userName in host OS>  (not needed for Workstation)
         -p <password in host OS>  (not needed for Workstation)
         -gu <userName in guest OS>
         -gp <password in guest OS>
      
      
      
      POWER COMMANDS           PARAMETERS           DESCRIPTION
      --------------           ----------           -----------
      start                    Path to vmx file     Start a VM
                               [gui|nogui]
      
      stop                     Path to vmx file     Stop a VM
                               [hard|soft]
      
      reset                    Path to vmx file     Reset a VM
                               [hard|soft]
      
      suspend                  Path to vmx file     Suspend a VM
                               [hard|soft]
      
      pause                    Path to vmx file     Pause a VM
      
      unpause                  Path to vmx file     Unpause a VM
      
      
      
      SNAPSHOT COMMANDS        PARAMETERS           DESCRIPTION
      -----------------        ----------           -----------
      snapshot                 Path to vmx file     Create a snapshot of a VM
                               Snapshot name
      
      deleteSnapshot           Path to vmx file     Remove a snapshot from a VM
                               Snapshot name
      
      revertToSnapshot         Path to vmx file     Set VM state to a snapshot
                               Snapshot name
      
      
      
      RECORD/REPLAY COMMANDS   PARAMETERS           DESCRIPTION
      ----------------------   ----------           -----------
      beginRecording           Path to vmx file     Begin recording a VM
                               Snapshot name
      
      endRecording             Path to vmx file     End recording a VM
      
      beginReplay              Path to vmx file     Begin replaying a VM
                               Snapshot name
      
      endReplay                Path to vmx file     End replaying a VM
      
      
      
      GUEST OS COMMANDS        PARAMETERS           DESCRIPTION
      -----------------        ----------           -----------
      runProgramInGuest        Path to vmx file     Run a program in Guest OS
                               [-noWait]
                               [-activeWindow]
                               [-interactive]
                               Complete-Path-To-Program
                               [Program arguments]
      
      fileExistsInGuest        Path to vmx file     Check if a file exists in Guest OS
                               Path to file in guest
      
      setSharedFolderState     Path to vmx file     Modify a Host-Guest shared folder
                               Share name
                               Host path
                               writable | readonly
      
      addSharedFolder          Path to vmx file     Add a Host-Guest shared folder
                               Share name
                               New host path
      
      removeSharedFolder       Path to vmx file     Remove a Host-Guest shared folder
                               Share name
      
      listProcessesInGuest     Path to vmx file     List running processes in Guest OS
      
      killProcessInGuest       Path to vmx file     Kill a process in Guest OS
                               process id
      
      runScriptInGuest         Path to vmx file     Run a script in Guest OS
                               Interpreter path
                               script_text
      
      deleteFileInGuest        Path to vmx file     Delete a file in Guest OS
                               Path in guest
      
      createDirectoryInGuest   Path to vmx file     Create a directory in Guest OS
                               Directory path in guest
      
      deleteDirectoryInGuest   Path to vmx file     Delete a directory in Guest OS
                               Directory path in guest
      
      listDirectoryInGuest     Path to vmx file     List a directory in Guest OS
                               Directory path in guest
      
      copyFileFromHostToGuest  Path to vmx file     Copy a file from host OS to guest OS
                               Path on host
                               Path in guest
      
      copyFileFromGuestToHost  Path to vmx file     Copy a file from guest OS to host OS
                               Path in guest
                               Path on host
      
      renameFileInGuest        Path to vmx file     Rename a file in Guest OS
                               Original name
                               New name
      
      captureScreen            Path to vmx file     Capture the screen of the VM to a local file
                               Path on host
      
      writeVariable            Path to vmx file     Write a variable in the VM state
                               [runtimeConfig|guestEnv]
                               variable name
                               variable value
      
      readVariable             Path to vmx file     Read a variable in the VM state
                               [runtimeConfig|guestEnv]
                               variable name
      
      
      
      VPROBE COMMANDS          PARAMETERS           DESCRIPTION
      ---------------          ----------           -----------
      vprobeVersion            Path to vmx file     List VP version
      
      vprobeLoad               Path to vmx file     Load VP script
                               'VP script text'
      
      vprobeReset              Path to vmx file     Disable all vprobes
      
      vprobeListProbes         Path to vmx file     List probes
      
      vprobeListGlobals        Path to vmx file     List global variables
      
      
      
      GENERAL COMMANDS         PARAMETERS           DESCRIPTION
      ----------------         ----------           -----------
      list                                          List all running VMs
      
      upgradevm                Path to vmx file     Upgrade VM file format, virtual hw
      
      installtools             Path to vmx file     Install Tools in Guest
      
      register                 Path to vmx file     Register a VM
      
      unregister               Path to vmx file     Unregister a VM
      
      listRegisteredVM                              List registered VMs
      
      clone                    Path to vmx file     Create a copy of the VM
                               Path to destination vmx file
                               full|linked
                               [Snapshot name]
      
      
      
      
      Examples:
      
      
      Starting a virtual machine with Workstation on a Windows host
         vmrun -T ws start "c:\my VMs\myVM.vmx"
      
      
      Stopping a virtual machine with Server on a linux host
         vmrun -T server -h https://myHost.com/sdk -u hostUser -p hostPassword stop "[storage1] vm/myVM.vmx"
      
      
      Running a program in a virtual machine with Workstation on a Windows host with Windows guest
         vmrun -T ws -gu guestUser -gp guestPassword runProgramInGuest "c:\my VMs\myVM.vmx" "c:\Program Files\myProgram.exe"
      
      
      Running a program in a virtual machine with Server on a linux host with linux guest
         vmrun -T server -h https://myHost.com/sdk -u hostUser -p hostPassword -gu guestUser -gp guestPassword runProgramInGuest "[storage1] vm/myVM.vmx" /usr/bin/X11/xclock -display :0
      
      
      Creating a snapshot of a virtual machine with Workstation on a Windows host
         vmrun -T ws snapshot "c:\my VMs\myVM.vmx" mySnapshot
      
      
      Reverting to a snapshot with Workstation on a Windows host
         vmrun -T ws revertToSnapshot "c:\my VMs\myVM.vmx" mySnapshot
      
      
      Deleting a snapshot with Workstation on a Windows host
         vmrun -T ws deleteSnapshot "c:\my VMs\myVM.vmx" mySnapshot
      
      

       

      So it looks like for those that are looking to make use of the free version of ESXi, you still have some capabilities for VM management using VMware VIX, note VIX is only for guest management and there are no available tools or exposed functionality for host management. If you're looking for host management utilities then I would suggest purchasing at least the Foundation license and take advantage of VI Perl Toolkit/RCLI, VI Powershell, VI API, etc.

       

       

       

       

      =========================================================================

      William Lam

      VMware vExpert 2009

      VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

      http://twitter.com/lamw

       

      http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

       

      If you find this information useful, please award points for "correct" or "helpful".