Most Used API in vSphere

Yesterday I blogged about the least used API in VMware vSphere. This naturally leads to another question, “what is the most used API in vSphere?” It’s a harder question than the “least” one, because for the latter I can be very sure that zero is the lowest possible usage. If that API is not the least, it must be one of the least.

Before we try to figure out the answer, let’s clarify a bit the “most used.” Does it mean the one that is called the most times? Does it mean the one that is touched and used by most developers? For the first case, it’s very hard, if possible, to get the stats. For the second, it seems a bit easier. So we will stick with the second definition: the API used by most developers.

Bothered by SLOW Web UI to manage vSphere? Want to manage ALL your VMware vCenters, AWS, Azure, Openstack, container behind a SINGLE pane of glass? Want to search, analyze, report, visualize VMs, hosts, networks, datastores, events as easily as Google the Web? Find out more about vSearch 3.0: the search engine for all your private and public clouds.

As you may have known that vSphere APIs are the Web Service layer on top of which several different toolkits are built, for example, vSphere Java API, VI Perl, PowerCLI, etc. With the introduction of high level APIs/toolkits, some vSphere APIs are hidden. For example, vSphere Java API provides explicit getter methods with each managed object type for reading its properties. Underneath these getter methods is the PropertyCollector. In most cases, a developer using vSphere Java API does not need to even know about PropertyCollector, but it doesn’t mean she is not using the PropertyCollector at Web Service layer. For simplicity, we will base our discussion on the vSphere Web Services APIs.

Compared with any other managed objects in vSphere API, the PropertyCollector received unproportionally high attention among the developers especially for the newcomers. The reason for that is the PropertyCollector is almost the only way to get any properties of a managed object in vSphere API. Should you develop anything useful, it’s most likely that you want to use it to read properties of some 90+ managed objects like VirtualMachine, HostSystem, etc., before taking any actions by calling other methods. For that, we can safely pin down the scope to the PropertyCollector itself.

Depending on your definition of API, the class/type may well be the API. For others, it’s more like a method. Among the several methods in the PropertyCollector, I think it’s fair to say that the retrieveProperties() and its newer equivalent retrievePropertiesEx(), as shown below, are the most used mainly because they are relatively easy one to use. I have to admit that it also depends on your application – you can also choose to use more the checkForUpdates() and waitForUpdates() (or its newer waitForUpdatesEx).

/** @deprecated as of SDK4.1 */
public ObjectContent[] retrieveProperties(PropertyFilterSpec[] specSet) throws InvalidProperty, RuntimeFault, RemoteException
{
  return getVimService().retrieveProperties(getMOR(), specSet);
}
 /** @since SDK4.1 */
public RetrieveResult retrievePropertiesEx(PropertyFilterSpec[] specSet, RetrieveOptions options) throws InvalidProperty, RuntimeFault, RemoteException
{
  return getVimService().retrievePropertiesEx(getMOR(), specSet, options);
}

This entry was posted in vSphere API and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Angela
    Posted July 25, 2011 at 6:02 am | Permalink

    Very right Steve!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  • NEED HELP?


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.