-
Notifications
You must be signed in to change notification settings - Fork 923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] How to get Tags that have been assigned to VMs #131
[Question] How to get Tags that have been assigned to VMs #131
Comments
@colross are you referring to the tags in the VirtualMachine Summary view in the web client on 5.5? |
@michaelrice - Thank you, yes - that is exactly what I am referring to. Basically, I want to be able to iterate through all VMs and take action based upon the tag that they have. |
@colross The vm.tag is something else. That is a dataobject that can not be seen from the user interface. You could almost think of it like a primitive form of metadata. You can set it from the API and get it from the API but you cant see it in the UI. As far as using what you are referring to I do not think that is something you can access via exposed API calls based on this KB article http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2064168 |
This is also relevant https://communities.vmware.com/thread/482030 |
@michaelrice - appreciate the response. Let me explain what I am attempting to do - maybe you have ideas on how this can be achieved. I have an abstracted security policy in my underlying infrastructure, in which all I need to do is drop devices into buckets and they automatically inherit the policy associated with that bucket. I am trying to figure out some attribute in vCenter that will indicate which bucket to drop any specific interface into. There could be multiple interfaces per device, and multiple tags per interface (traffic vs mgmt for example). The underlying infrastructure is ready to go, I just need to be able to learn from vCenter information that indicates which buckets to drop things into. Example. A device that is PCI, WebServer will inherit both the PCI policy and the WebServer policy on its traffic interface, and on its management interface, it will inherit the PCI and management policies. My idea was to use tags to do this, such that as I tag devices, they automatically receive security policy, which clearly will not work if I can not get tag info. So, I need to be able to append some attribute that will work. BTW - this is an existing environment, so this has to be something that be appended, and not a big change to how this is deployed. |
@colross If basic key -> value pairs will work for you I have made a sample showing how to setup basic key, value pairs in the extraConfig. The key is a string and the value can be just about anything. I have even used this method to store base64 encoded files and very large serialized json and xml payloads for values. I will open a pull request shortly with the example. |
These work similar to metadata. fixes vmware#131
@michaelrice - Thanks for the idea. For now, I think that adding info into the annotation field will work (is this the field you were suggesting?) This can be manually updated directly from vCenter. The only bad part is that as it is a string, and not a fixed choice, it is prone to typos/errors. But, for now, I think that it will work nicely. Now to figure out how I can see all IP addresses, and not just the first one - Thanks again! |
Hi - I am not sure if I am in the correct place here, so my apologies if I am not.
I have a question. In vCenter, I am using tags on my VMs, and I want to be able to select a device based upon its tag. The issue that I am having is that the vm.tag attribute is always empty for everything except for the vCenter server itself.
print vm.tag
(vim.Tag) []
In my vCenter, this device has a tag.
Am I mistaking what the vm.tag attribute is? How can I associate a VM with its tag?
Cheers
The text was updated successfully, but these errors were encountered: