vSphere Management Assistant (vMA)

A very nice tool that an administrator can download is a virtual appliance called the vMA which is Linux based (SUSE Linux Enterprise Server 11, SP1), it has several components, including the vCLI and vSphere SDK for Perl. The requirements for the vMA aren’t too crazy, must have 1 vCPU, at least 600 MB of memory, 3GB disk minimum and needs to be deployed on one of these platforms:
– vSphere ESX 4.0 U2 or newer
– vSphere ESXi 4.1 or newer
– vCenter 4.0 U2 or newer 
This appliance gets deployed like any other; first we download it from VMware’s website. Once we have the *.ova or *.ovf file then go to File > Deploy OVF Template in the vSphere Client and finish the wizard. 
The vMA will allow us to manage our hosts via command line as well as run scripts. Our vMA commands sent directly to our host are send via vSphere SDK for Perl API, and if we are sending commands to a host but through vCenter then it will be sent to vCenter via vSphere SDK for Perl and then from vCenter to the host using vCenter’s private protocol. 
Using our vifp interface, we can add, show, or remove target servers. A target server is what we are trying to connect to here. If we want to go ahead and set that target as the default for this session then we will type to vifptarget command. We can choose to establish multiples servers as target servers. We will just need to use the – -server option to go ahead and specify which one we are going to be running our commands against. So, for example: 
To add a server as a target: 
vifp addserver 
To list target servers:
vifp listservers
To set a server as the target for the vMA session: 
vifptarget -s 
To remove a target server:
vifp removeserver 

Using vMA to manipulate the VM’s power state

Another set of useful commands are the vmware-cmd ones. I can use “vmware-cmd <vmx path> getstate to determine what the VM’s power state is.
If I want to power on a VM then the command will be ”vmware-cmd <vmx path> start. “
Alternatively to power it off, use ”vmware-cmd <vmx path> stop soft
Something else I can do is use the ”esxcli vm process list“ to list all virtual machine processes.
This can be useful when determining the world ID or UUID of the virtual machine, this also shows the path to the VM’s .vmx file.

Using the vMA to determine the relationship between the UUID and the datastore name

I am continuing to prepare for the VCAP-DCA, a big part of this process is practicing my command line skills.

Today I was using the vMA to practice some list commands and there was one in particular I wanted to share.

You can list the path names to your virtual machines that are registered with the target server (server you are running the commands against).

To do this use:

vmware-cmd -l | more

Your results may look something like:

From there you may notice the 3rd directory in the path to the .vmx file. This is the UUID (universally unique identifier) of the file system on which the virtual machine is residing.

To figure out which UUID belongs to which datastore, use:

esxcli storage filesystem list

Now I can tell which UUID is associated to the “Local01” and “Shared” datastores. Using these two commands, I can tell that “TestVM01” resides on the “Local01” datastore.