What’s New in vSphere API 5.0

Because vSphere 5.0 is now released, I can talk about the changes of the API in public. As you may have heard me saying many times, management APIs are the “view” to the product. New features can be exposed via APIs. Understanding the changes in APIs helps you understand the product itself.

The API Reference 5.0 has the first page “New and Changed Managed Object Elements in 5.0” summarizing all the changes. To support vSphere 5.0 in new VIJava API , I’ve gone through all these changes. I will write a separate article on VIJava new release soon.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

New Managed Object Types

Nine new managed object types have been added into 5.0: GuestAuthManager, GuestFileManager, GuestOperationsManager, GuestProcessManager, HostCacheConfigurationManager, HostEsxAgentHostManager, HostImageConfigManager, IscsiManager, StoragePod.

As you can see, the first 4 of them are related guest OS management. The VIX APIs is now integrated into vSphere API, meaning you no longer have limitation on programming languages as imposed by VIX. The GuestOperationsManager is the entry point which you can get from ServiceInstance. From there, you can get GuestAuthManager for authentication, GuestFileManager for guest file management including copying in and out, and GuestProcessManager for guest OS process management.

The latter 4 is closely related to HostSystem. You can get hold of these managed objects from a HostSystem object. HostCacheConfigurationManager provides access to performance tuning features of ESXi using solid state drive based cache. HostEsxAgentHostManager. HostEsxAgentHostManager “configures agent virtual machine resource configuration, such as what network and datastore to use for agent virtual machines.” HostImageConfigManager “configures ESXi software image, including properties such as acceptance level. It is currently designed to be host agent specific.” IscsiManager manages “mapping VMkernel NIC to iSCSI Host Bus Adapter.” (Note: I changed ESX to ESXi here.)

The last one “StoragePod” is a subtype of Folder that “aggregates the storage resources of associated Datastore objects into a single storage resource for use by virtual machines. The storage services such as Storage DRS (Distributed Resource Scheduling), enhance the utility of the storage pod.” StoragePod does not define any additional method but two properties.

New Methods to Existing Managed Object Types

There are 15 existing managed object types that have new methods. The following table from API reference lists all of them.

AuthorizationManager HasPrivilegeOnEntity
ClusterComputeResource ClusterEnterMaintenanceMode
Datastore DatastoreEnterMaintenanceMode
DatastoreExitMaintenanceMode
DistributedVirtualSwitch AddNetworkResourcePool
RemoveNetworkResourcePool
DistributedVirtualSwitchManager RectifyDvsOnHost
ExtensionManager QueryManagedBy
Folder CreateStoragePod
HostActiveDirectoryAuthentication ImportCertificateForCAM
JoinDomainWithCAM
HostFirewallSystem UpdateRuleset
HostProfileManager CheckAnswerFileStatus
ExportAnswerFile
QueryAnswerFileStatus
QueryProfileStructure
RetrieveAnswerFile
UpdateAnswerFile
HostStorageSystem AttachScsiLun
DetachScsiLun
DiscoverFcoeHbas
MarkForRemoval
MountVmfsVolume
UnmountVmfsVolume
Profile RetrieveDescription
SessionManager AcquireGenericServiceTicket
StorageResourceManager ApplyStorageDrsRecommendation
ApplyStorageDrsRecommendationToPod
CancelStorageDrsRecommendation
ConfigureStorageDrsForPod
RecommendDatastores
RefreshStorageDrsRecommendation
VirtualMachine ConsolidateVMDisks
EstimateStorageForConsolidateSnapshots

New Managed Object Properties

Here is the least change with only one new property called “licensableResource” defined in HostSystem. The type for the new property is HostLicensableResourceInfo, which are essentially key/value pairs.

Changed Methods With Additional Parameters

There are 11 methods in 8 managed object types having additional parameters.

HostDatastoreSystem QueryVmfsDatastoreCreateOptions
HostProfileManager ApplyHostConfig
CreateDefaultProfile
QueryHostProfileMetadata
HostStorageSystem ComputeDiskPartitionInfo
ComputeDiskPartitionInfoForResize
HostSystem ReconnectHost
ProfileComplianceManager QueryExpressionMetadata
ProfileManager QueryPolicyMetadata
VirtualMachine RemoveAllSnapshots
VirtualMachineSnapshot RemoveSnapshot

As I mentioned in previous blog, vSphere Web Services APIs are wire compatible but not code compatible, meaning your existing application that use any of these 11 methods will need to change for upgrading to vSphere 5.0. The change may as simple as adding a null in place of the new parameters.

To help mitigate the compatibility issue, I’ve kept the old method and route it to the new method with null in place of the new parameters. So if you are using VIJava API, your code does not need to recompile at all.

New Data Objects

There are much more data object types than managed object types in vSphere API. Same is true for new data object type types and new managed object types. When we work with vSphere APIs, the most important part is the managed object types. The data object types are secondary.

Given the fact that there are too many data objects to cover and they are not so important, I will just leave them out in this article. You can always check out here for the information.

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

17 Comments

  1. Thulasinathan Kandasamy
    Posted August 26, 2011 at 7:00 am | Permalink

    Hi Steve,

    Thank you for this information.

    I tried to search for ManagedEntities of type Datastore like below on vCenter5.0. Somehow I didn’t get any objects in return.

    ManagedEntity[] datastores = new InventoryNavigator(rootFolder).searchManagedEntities(“Datastore”);

    So, I went ahead getting it from HostSystem using hostSystemObj.getDatastores(); that works just fine.

    Did anything else change that prevents searchManagedEntities from working for Datastore?

    Regards,
    Tulsi

  2. Posted August 26, 2011 at 10:09 am | Permalink

    Hi Tulsi,
    Thanks for letting me know the issue. Are you using vijava 5.0 beta I posted yesterday? Thanks!
    Steve

  3. Thulasinathan Kandasamy
    Posted August 27, 2011 at 11:06 am | Permalink

    Hi Steve,

    I was using the vijava 2.1 for that test. That could be the reason. I’ve started using the vijava 5.0 beta.

    Thank you.

    Regards,
    Tulsi

  4. Thulasinathan Kandasamy
    Posted August 30, 2011 at 5:16 pm | Permalink

    Hi Steve,

    It works fine on vijava 5.0 beta. I.e. the newer api returns the ManagedEntities while searching for Datastore or Network using searchManagedEntities method.

    The earlier version didn’t work this way on vCenter5.0 did the class version or something change?

    Thank you

    Regards,
    Tulsi

  5. Posted August 30, 2011 at 6:27 pm | Permalink

    Hi Tulsi,

    Thanks for your feedback. Could you file a bug in the project home http://vijava.sf.net? Thanks!

    -Steve

  6. Thulasinathan Kandasamy
    Posted September 2, 2011 at 10:18 am | Permalink

    Sure Steve.

    Regards,
    Tulsi

  7. Thulasinathan Kandasamy
    Posted September 5, 2011 at 7:47 am | Permalink

    Hi Steve,

    I created a Bug. The update is I couldn’t search for VirtualApp either.

    Just a quick question is there an API to know the version of the vSphere that we are talking to?

    Regards,
    Tulsi

  8. Thulasinathan Kandasamy
    Posted September 5, 2011 at 8:02 am | Permalink

    Oops. I’m able to search for VirtualApp.

    Regards,
    Tulsi

  9. Posted September 5, 2011 at 11:45 pm | Permalink

    Hi Tulsi,

    Check out the VerUtil.java in the API code:
    http://vijava.svn.sourceforge.net/viewvc/vijava/trunk/src/com/vmware/vim25/mo/util/

    Steve

  10. Eric
    Posted September 29, 2011 at 11:47 am | Permalink

    Hi,

    is it possible to configure autodeploy using the java sdk instead of powershell?

    thanks!

    Eric

  11. Posted September 29, 2011 at 4:43 pm | Permalink

    Hi Eric,

    Great question. I don’t know the answer and will try autodeploy later. In the meantime, if you find anythere, please let us know.

    Thanks!

    Steve

  12. Udaya
    Posted October 3, 2011 at 4:10 am | Permalink

    Hi Steve,
    I am trying to create portgroup in vsphere 5.0. Please let me know the code changes need to be done in the DistributedVirtualSwicth.addPortGroup_task method…

    Regards,
    Udaya

  13. krishna
    Posted November 29, 2011 at 10:31 pm | Permalink

    Hi,

    Is there anyway I can know the VIJAVA SDK version that a Application is using programmatically ?

    thanks, krishna

  14. Posted November 30, 2011 at 12:43 am | Permalink

    Hi Krishna,
    That is a good question. We don’t have it from the API itself. Any use case in which you have to have it?
    BTW, if you meant for the version of the vSphere SDK version, it can be easily found out from the AboutInfo object.
    Steve

  15. Geeta Gharpure
    Posted May 14, 2012 at 2:00 pm | Permalink

    Hello Steve,

    Can you please post code snip to show how to differentiate a StoragePod from a Folder?
    I am trying to use ‘instance of’ to identify a StoragePod. Here is the code snip-
    ManagedEntity mes[] = parent.getChildEntity();
    for (ManagedEntity m : mes) {

  16. Geeta Gharpure
    Posted May 14, 2012 at 2:03 pm | Permalink

    ManagedEntity mes[] = parent.getChildEntity();
    for (ManagedEntity m : mes) {
    if (m instanceof StoragePod) {
    //execute storagepod related logic
    }
    }

    Above code is not working for me though. Can you please tell me what am I missing?

  17. Posted May 14, 2012 at 6:20 pm | Permalink

    Did you find StoragePod instance in the child property whichh is an array of ManagedEntity?
    Steve

One Trackback

  • By Announcing VI Java API 5.0 Beta | DoubleCloud.org on August 25, 2011 at 1:34 pm

    […] biggest change in this new release is the vSphere 5.0 support. If you haven’t read what’s new in vSphere API 5.0, it’s time to do so. The overall structure of the API is the same as before and 100% compatible […]

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.