VMware {code} Community
supertom
Contributor
Contributor
Jump to solution

advice on which apis/tools to use

HI Folks,

I'm pretty new to VMware and honestly, navigating through the available APIs and product descriptions is pretty confusing.  I'm hoping I can tell you what I want to do and what I've tried and you can point me in the right direction.
I'm running ESX in several remote locations.  I want to be do the following actions in a scripted manner on the ESX server and guest OSes in these remote locations.  For now, all of my guest OSes are Linux and I don't expect that to change.
* Turn on/off/suspend/restart (vmrun can do this)
* Run commands inside the guest (vmrun can do this)
* Create and Clone Guest VMs in the remote location (?)
* get data about the ESX server (CPU, disk, memory, network I/O, etc.)
* get data about the Guest OSes (vmrun to run commands, unless there is a better way)
So, the big question in my mind is the create and clone.  Looks like certain versions of vmrun support "clone" (looks like later version don't?).  I've also come across the vsphere client, which doesn't run on anything but windows (boo!) but I'm not even sure if should be using it.
So, what should I use?  I also see the VI Java API, which seems to be an open source implementation?
Any help you guys can give is most appreciated.
Thanks,
Tom
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

First of all, vSphere Hypervisor is just the name for the free download of ESXi. The current release is 4.1.

But yes, you will not be able to test your application without a licensed installation of ESX (or ESXi). Any API operations (either via the vSphere API or the VIX API) that modify state (including powering on a VM) are disallowed on the free version of ESX. I know this is inconvenient, but that is the policy.

Any paid license, including the Essentials license, will suffice.

View solution in original post

0 Kudos
8 Replies
verminator
Enthusiast
Enthusiast
Jump to solution

The VIX API does most of the virtual machine functions you've specified.

http://www.vmware.com/support/developer/vix-api/vix110_reference/lang/c/functions/VixVM_Clone.html

You can refer the API documentation, to check if there's any functionality you need that might not be in there.http://www.vmware.com/support/developer/vix-api/vix110_reference/index2.html has a very nice graphical layout of which functions are supported by VIX, and on which VMWare product.

PS - It looks like the clone method doesnt show up for ESX server, but you might want to give that a shot anyway.

Also AFAIK, I'm not sure the VIX API allows access to "get data about the ESX server (CPU, disk, memory, network I/O, etc.)". It is a simple API for managing the VMs, not really the server hosting them. You might possibly need the VI API.

0 Kudos
admin
Immortal
Immortal
Jump to solution

Hi Tom,

vmrun (and the VIX API upon which it is based) will not be able to meet all your needs, unfortunately.

VIX and vmrun do not support cloning on ESX (only on VMware Workstation), and neither support VM creation on any VMware platform.

VIX and vmrun also do not publish information on the ESX host.

To perform these operations, you will have to look at the vSphere API. This a web service/SOAP-based API that provides host and VM management functions. The VI Java API is one flavor of this; it builds some abstractions and conveniences on top of the SOAP calls. There is also the vSphere SDK for Perl (http://www.vmware.com/support/developer/viperltoolkit/). Lastly, the WSDL for the raw SOAP API is available if you wish to roll your own API bindings.

However, the vSphere API does not currently support the guest operations from VIX or vmrun, so you will need to use both APIs to achieve all your goals. I know this is inconvenient, and we are investigating ways of simplifying the APIs environment for vSphere.

0 Kudos
supertom
Contributor
Contributor
Jump to solution

Thanks for the response. 

I don't see ESX listed here.  Is ESX now vSphere?

http://www.vmware.com/support/developer/vix-api/vix110_reference/index2.html

I also don't see any mention of creating new VMs, and as you mentioned, looks like clone is not available.  Can you explain to me where the VI Java API fits into all of this?

Also, what about the Web Services?  If I'm using ESX, and ESX is vSphere, can I use those?

http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/index.html

I look forward to your response.  I know this is the VIX API group, but honestly, they've made this way too complicated, and the tools are grossly incomplete.

0 Kudos
supertom
Contributor
Contributor
Jump to solution

Hi mattrich,

Thanks for your response.  So, going back to my original list:

* Turn on/off/suspend/restart (vmrun)
* Run commands inside the guest (vmrun)
* Create and Clone Guest VMs in the remote location (vSphere Web Services SDK [1])
* get data about the ESX server (vSphere Web Services SDK)
* get data about the Guest OSes (vmrun to run commands, unless there is a better way)
Is that correct?  So, ESX is now vSphere, so when we upgrade, will my code still work?  Also, for testing/development purposes, can I use the vSphere Hypervisor locally to test out the code I'm writing?
Thanks,
Tom
0 Kudos
admin
Immortal
Immortal
Jump to solution

Yes, that list looks right. You could do the VM power on/off/reset/suspend through the vSphere API as well, whichever is easiest.

vSphere is the new term for Virtual Infrastructure; that is, ESX and vCenter Server. The APIs should be mostly forwards compatible. The major exception to watch out for is only the newest VIX releases (after 1.10.1) support the newest vSphere releases (4.1 and later).

As for testing locally, it will provided you have a non-free license installed on your local ESX host. ESX only supports remote automation if a paid license is attached to the host.

0 Kudos
supertom
Contributor
Contributor
Jump to solution

I really appreciate the help, this is awesome.

Just to be clear, I installed vSphere Hypervisor locally and have the free license.  I would like to develop against that and then when things are working, point at one of our real ESX hosts. 

(I'm not using these terms interchangably, but rather, we have purchased ESX, I believe 4x, and it is deployed.  I just (yesterday) downloaded vSphere Hypervisor as I understand this to be the new version of the ESX family).

Are you saying that what I described won't work because I'm using the free version?

Thanks,

Tom

0 Kudos
admin
Immortal
Immortal
Jump to solution

First of all, vSphere Hypervisor is just the name for the free download of ESXi. The current release is 4.1.

But yes, you will not be able to test your application without a licensed installation of ESX (or ESXi). Any API operations (either via the vSphere API or the VIX API) that modify state (including powering on a VM) are disallowed on the free version of ESX. I know this is inconvenient, but that is the policy.

Any paid license, including the Essentials license, will suffice.

0 Kudos
supertom
Contributor
Contributor
Jump to solution

Thanks very much for all the details - your answer was very helpful.

0 Kudos