VMware {code} Community
qc4vmware
Virtuoso
Virtuoso

VcTag scripting object

I am not sure if I missed the memo or what but it seems that in 5.1 custom fields are now read only and everything needs to be converted to tags.  I am trying to figure out how to programatically interact with the tagging as we use custom fields to sync some information to and fro from our machine database.  I see the property "tags" on most of the managed entities but I don't see where I can manipulate the tags (add/change/delete).  All I can do is get an array of the tags currently associated with the entity.

Do I need to tweak something in my vCenter configuration to keep the custom fields in place for now and useable as they were before?  The api docs all say "experimental" on that attribute and the vcTag object type.

This is a cross posting from the Orchestrator forums as I use orchestrator/javascript for everyting along with the vCenter plugin.

Paul

Tags (2)
Reply
0 Kudos
6 Replies
stumpr
Virtuoso
Virtuoso

I can still set Custom Fields (Annotations) in vSphere 5.1 through the vCenter API without VCO.  Perhaps you have a permission issue?

Tags don't have a public API for setting values that I know of, it's either a private (unpublished) API or done internally.  Most of the tags are used to categorize objects.  For example, uplink portgroups in a distributed virtual switch have a Tag.  I assume to make it easier to differentiate it from other portgroups quickly by VMware UI tools.

I'll give a quick test in VCO to see if it's a bug.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
qc4vmware
Virtuoso
Virtuoso

Thanks for checking... I went back and took a look at my permissions and that is not the issue.  From the vCenter client I can set the custom field values.  From the new web client though I get presented with a wizard which wants to convert all of the custom fields to tags.  After upgrading to 5.1 the workflows I have that create and modify the custom fields started failing. I may have jumped to some incorrect conclusions about what was taking place but the behavior I observed lead me to believe that the custom fields were being migrated to this new tagging system.

I will play around with things some more and if I can't get it working I will post some of the log messages I am getting and some code snippets.

Paul

Reply
0 Kudos
qc4vmware
Virtuoso
Virtuoso

ARGH... ok I just re-ran my workflow and this time it succeeded.  I will keep playing with this to see if I can pinpoint where in my environment this was tripping up.  Hopefully it wasn't just an issue with the vCenter plugin as I have on occassion had those do whacky things which clear up once the vCO service is restarted.

Paul

Reply
0 Kudos
qc4vmware
Virtuoso
Virtuoso

Clearly I am a confused individual of some sort.  The custom fields are updating just fine everywhere I attempt this now.  I would like to know how I add/change/delete tags programatically though.  I jumped to a conclusion that the custom fields were being deprecated since they were no longer shown in the host summary page as they are as annotations in the windows client but the tags are shown on the summary page in the web client.  Does anyone have insight as to the long term plan?  Will both always exist?  Are they in fact moving toward tags and eliminating the custom fields?  It is a bit frustrating as we actually use those custom fields and you have to dig a little to get to the information.  The only way I could see it was by getting into a view where a list of hosts is shown and checking the boxes to show the columns.  It also seems as if you can no longer edit the custom fields in the web client.  You get the wizard popping up :

Screen Shot 2013-01-03 at 6.34.24 PM.png

For now I want to maintain both tags and custom fields until we hit a point where its one or the other and so my admins can easily see the same data in either client. The verbiage in this wizard is what lead me to believe along with my failing workflows that the custom fields were locked out and read only.

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

I don't believe the Web Client removes Custom Values, just creates Tags+Categories in the Web Client that are equivalent.  However, I haven't had time to play with the web client in much detail.

Tags that are in the SDK interface are not the same as the Web Client Tags, which I don't think map through to the SDK in any form.

The custom attributes are not read only in the current SDK release, but you can't edit them in the web client as far as I know.

There is a web client SDK, you might be able to get some way to bridge the gap between custom fields and web client tags.  If so, there may be some automation glue you can create in Orchestrator to update the web client tags on a schedule with updates to the custom fields in the SDK interface.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
ivankrolo
VMware Employee
VMware Employee

I'm pretty sure there isn't a way to update the tags with vCO.  I've struggled with finding a method, but the .tag attribute of a VC:VirtualMachine doesn't seem to exist (api says it may not), and the only use of VcTag is by a few managed entities possibly exposing it through the .tag attribute.  Smiley Sad

Reply
0 Kudos