VMware {code} Community
SandipH
Contributor
Contributor

vSphere SDK API to get Tags of VirtualMachine (ManagedEntity) from vCenter 5.5

Hi,

I am trying to get tags associated with virtual machine in Java using  vSphere 5.5 SDK API. I am retrieving those from valid ManagedEntity (VirtualMachine) object. The problem is retrieved tags array is empty.

The documentation at following link says "Experimental. Subject to change.Since vSphere API 4.0"

http://pubs.vmware.com/vsphere-55/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.ManagedEntity...

I tried PowerShell cmdlets 'Get-Tag' and its working as expected however I cannot use powershell due to platform compatibility reasons.

I wanted to know if tags in ManagedEntity are not supported then what is the the alternative way to get tags for virtual machine and vapp from vCenter using SDK API in Java from linux machine?

Thanks and Regards,

SandipH

4 Replies
stumpr
Virtuoso
Virtuoso

To be completely confusing, the Tags in the current vSphere API are not the same Tags as seen in the vSphere Web Client.  Unfortunately, the Web Client Tags are actually stored and managed by the Inventory Service, separate from the vSphere API (and database). 

Currently the only official version for managing the vSphere Web Client Tags is PowerCLI. 

I did poke around with some SSL packet captures and it possible to expose those calls to other API kits (such as Java, Perl, C#, etc).  However, I have not had the cycles to really build anything out.  It was a mix of SOAP and some XPATH queries.

Reuben Stump | http://www.virtuin.com | @ReubenStump
FrankCRoth
Contributor
Contributor

Hi,

facing the exact same issue. Added Tags to virtual system object using WebGui works but SDK does return empty tags array.

Is there any plans from VMWare to change this in future?

Cheers,

Frank

admin
Immortal
Immortal

stumpr is right. The tag managed entity that you see as part of the vSphere SDK API is deprecated. Tags are stored in Inventory Service and can be created either using the web client or power CLI. If you are experimenting with the 6.0 Beta version, then tagging can also be accessed via API using the public SDK. But for 5.5, web client and power CLI are the only ways to get to tagging, sorry Smiley Sad

krishna_tvssjr
Contributor
Contributor

Hi,

I am using the latest VMware Java SDK version 7U03. And still The tags array is returning empty. Is this handled in any versions of SDK? Any alternatives to fetch tags of VM? 

Thanks

Ramakrishna

Reply
0 Kudos