Add tagging support to networks

Currently, when using the VM provisioning dialog, it’s possible to restrict resources by tagging them and assign tag filters to groups.
That’s true for providers / clusters / hosts / templates / datastores / resource pools but there is no way to tag networks. I’ve tried to do it via a button and an automation method but received an error

`method_missing': undefined method `is_tagged_with?' for #<Lan:0x0000000fb91040> (NoMethodError)

Is there any plans to add tagging support for networks ? or is there an other way to prevent a network to a group ?

1 Like

We ended up filtering the networks that the users can see – obviously you would need to create different dialogs based upon the user groups. I do hope they introduce network tagging in the future.

e.g. will limit the choice down to our 10.x range for VM’s

:data_type: :string
:display: :edit
:required: true
:description: vLan
:method: :allowed_vlans
:dvs: true
:vlans: true

  • :tag:
    :filter: !ruby/regexp /(VM Network 10.x)/i

The way that we did this was using tagged groups and service dialogs. Basically, we tag groups with the names of the vlans they have access to and then provide those during the service dialog with dynamic drop-downs.

I managed to tag VLANs and trying to filter them based on tags within the provisioning dialog if possible.

The relevant dialog yaml portion is:

    :description: Network
            :dvs: true
            :vlans: true
          :method: :allowed_vlans

I checked the allowed_vlans method in manageiq/app/models/miq_provision_virt_workflow.rb (not sure if this is the right place to look at) and it filters the VLANs based on options :

  def allowed_vlans(options = {})
    @allowed_vlan_cache ||= available_vlans_and_hosts(options)[0]
    filter_by_tags(@allowed_vlan_cache, options)

The filter of @spole83 looks to be static - I’d like to filter based on tags of the current user’s group, if possible. I found some filter samples in manageiq/db/fixtures/miq_searches.yml but cannot adapt them for my usecase:

    filter: !ruby/object:MiqExpression
          tag: Vm.managed-environment
          value: uat

Is this possible or am I on a completely wrong path?