Should all models be taggable?


#1

The taggable methods for service models are defined in MiqAeServiceModelBase, which would imply they they are relevant to all service models. I’ve recently noticed however that this isn’t necessarily the case; several of the /app/models that the service models map to don’t include acts_as_miq_taggable, so do not support tagging (the Lan/MiqAeServiceLan pairing being an example). If we try to access the tags method of such a service model object for example we get an exception:

NoMethodError: undefined method tag_list for #<Lan:0x00000008e936c8>

So a bit of an architectural question, what would be the downside of making all models taggable? Even of we didn’t expose this in the WebUI, it’s fantastically useful to be able to apply and read tags to/from an object from automate.

pemcg


#2

@Fryguy Can you comment from an architectural perspective?


#3

Code-wise everything is technically taggable, since it’s a polymorphic association under the covers. I think from a logical perspective, we’ve only ever allowed tagging of managed entities because tagging drives things like policy and reporting, and policy and reporting can only deal with managed entities. I guess I could be convinced of being able to tag other things with some valid use cases, but I don’t think we should allow literally everything to be tagged (e.g. I’m thinking underlying things like join tables should not allow tags) @chessbyte Thoughts here?

As far as the service models having those methods at the base, that seems like it might be a bug. If the corresponding ActiveRecord model doesn’t have acts_as_miq_taggable, then the methods for tagging won’t exist, and calling them should blow up.


#4

I think from a logical perspective, we’ve only ever allowed tagging of managed entities because tagging drives things like policy and reporting, and policy and reporting can only deal with managed entities.

  • Can you clarify what exactly you mean by “managed entities”? External things like Host as opposed to internal things like MiqQueue?
    I see some internal things like MiqAction, MiqEventDefinition and MiqRegion have acts_as_miq_taggable, while say EmsEvent doesn’t.

  • Is this what the /managed tag namespace stands for?


#5

Yes, “managed entities” are those top level objects you generally see and manage in the UI…Vms, Host, Cluster, Container, ContainerGroup, etc.

I’m not sure why MiqAction and MiqEventDefinitions are marked as taggable…that seems like maybe a bug or at the very least not needed, but I’m not sure of the details behind it. I’d be scared of tagging EmsEvent…that would probably kill the tag subsystem. :smile:

The /managed tag namespace differentiates customer tags from internal system tags. It’s not directly related to the term “managed entities”. @gtanzillo would probably know more on this aspect.