In this blog, I will give a detailed description about
various VMware technologies such as ESXi, vSphere Client, Hosted
Architecture and how to install ESXi, vSphere Client on your machine.
Also, I will talk about how to use vSphere Java API to perform VM operations.
- ESXi: It is a Type-1 hypervisor in which the virtualization layer runs directly on hardware.
- Hosted Architecture: It is a Type-2 hypervisor in which virtualization layer runs on top of a host OS.
Players: VMware Fusion (Mac), VMware Player (Windows, Linux), VMware Workstation (Windows, Linux), Oracle VirtualBox (Windows, Linux and Mac). - vSphere Client: It is an interface for administering ESXi and vCenter Server.
- vCenter Server: Centralized Management of entire vSphere infrastructure. It has multiple ESXi hosts.
Step 1: Download and install ESXi.
- Register yourself at my.vmware.com
- You can download ESXi from: http://www.vmwarearena.com/2013/10/vsphere-55-download-free-esxi-55.html
- For installing ESXi, you have to first install any one of the above mentioned hosted architecture's players. Since, I am a Mac user I would suggest you to download VMware Fusion and for windows I would suggest Oracle VirtualBox.
- Once VMware fusion is successfully downloaded and installed, we will then setup ESXi.
Install ESXi - In VMware fusion create a virtual machine
- If your machine only has 4GB RAM, use ESXi 5.1 instead of using ESXi 5.5
- VMware Fusion Settings:
Select 2 cores, for ESXi 5.5: 4GB RAM; ESXi 5.1: 2.5GB RAM, Disk: Thin Provisioned, Network Adapter: Bridged, Guest OS: VMware ESXi 5.
Note: Change the network type to bridge to connect vSphere client to ESXi.
Step 2: Download and install vSphere Client.
Mac users cannot directly install vSphere Client on Mac OS. First install Windows 7 in VMware Fusion and then install vSphere Client on Windows 7.
Mac users cannot directly install vSphere Client on Mac OS. First install Windows 7 in VMware Fusion and then install vSphere Client on Windows 7.
- You can download vSphere Client from:
http://vsphereclient.vmware.com/vsphereclient/1/9/9/3/0/7/2/VMware-viclient-all-5.5.0-1993072.exehttp://vsphereclient.vmware.com/vsphereclient/1/2/3/5/2/3/3/VMware-viclient-all-5.1.0-1235233.exe
- Once vSphere Client is downloaded, install it on Windows and invoke it.
Use IP address, User name and Password of ESXi to access ESXi from vSphere Client.
- Upload ISO files of different OS to ESXi before creating VM. You can select any of the below options to upload ISO file.
– Putty
– VI client: datastore browser.
– VI client: mount external ISO file.
– VI client: datastore browser.
– VI client: mount external ISO file.
- Create new VM and Resource Pool.
![]() |
- List of VMs within ESXi
- VM1: xphome-656-1
- VM2: ubuntu1410-656-2
Step 4: Perform VM operations using vSphere Java API (vijava)
In this blog, I will explain only 2 VM operations i.e Power On and Power Off VM. There are many other VM operations such as snapshot, clone, migrate which I will be talking about in my next blog.
Power On and Power Off operations can be performed using vSphere Client. But in this blog I will show how to perform these operations using Java code.
In Eclipse IDE, add the following external JARs to perform VM operations using java code:
- dom4j-1.6.1.jar
- vijava55b20130927.jar
Step 5: Code Snippet
I will only give code snippets which will help you in understanding how to connect to ESXi by writing java code and perform different VM operations.
- Connect to ESXi
ServiceInstance si = new ServiceInstance(new URL("https://IP OF ESXi/sdk"), "username", "password", true); - Power On VM
{
Task task = vm1.powerOnVM_Task(null);
task.waitForTask();
System.out.println("Power On VM: status = " + task.getTaskInfo().state);
}
- Power Off VM
{
Task task = vm1.powerOffVM_Task();
task.waitForTask();
System.out.println("Power off VM: status = " + task.getTaskInfo().state);
}
Here is the console output and vSphere Client recent task output to show that Power On and Power Off VM operations are successfully performed.
In the above displayed output, I have also extracted Host and VM information using vijava.
Please explore vijava api more so that you can get crystal clear understanding of how host and vm information can be extracted.
--------------------------------------------------------------------------------------------------------------------------
So, we have seen how to use vSphere Java API to perform VM operations.









