How to Tag VMs in vCenter When Deploying from OpenNebula + Keep Tags Synchronized?

Hi everyone,

I’m trying to deploy VMs from OpenNebula into vCenter and automatically assign vCenter Tags to those VMs.

My questions:

  • What is the correct place in the OpenNebula vCenter driver to inject custom logic for tagging VMs?

  • Does OpenNebula currently support synchronizing tags from OpenNebula → vCenter during VM updates?

  • If not, what is the recommended approach to implement this (modify update scripts? add VCENTER_TAG inside the driver? )

  • Has anyone already implemented something similar?

Any guidance or examples would be greatly appreciated.

Thanks!

Hello,

You would want to modify or extend the virtual_machine.rb file of the vcenter_driver library files I think, that one does all the virtual machine management. Then, you’d probably have to extend the monitor scripts for the vcenter driver as well.

There is a VCENTER_TAG reference in the code, but the code around gathering it only seems to check the OpenNebula Attribute, not actually gather the information from vCenter. That could be a good place to start with experimenting though.

I haven’t worked with this vcenter library in quite a while now but I do know it works with RbVmomi, and those documents are here(should work with rbvmomi2 as well) and you may be able to extend it this way:

Reading through the vcenter_driver’s virtual_machine.rb that I linked earlier should help a bit. I have not heard of someone synchronizing the tags between vCenter and OpenNebula. I think we just gathered them at first and then you used the OpenNebula Labels system after that.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.